1 #!/usr/bin/perl 2 use warnings; 3 use strict; 4 5 my %windowSeqScores = (); 6 7 #my $matrixHashRef = loadMatrix("psuedoCountMatrix.txt"); 8 9 my $sequenceRef = loadSequence("/scratch/Drosophila/dmel-2L-chromosome-r5.54.fasta"); 10 my $windowSize = 23; 11 my $stepSize = 1; 12 my $maxScore = 0; 13 my $sequence = @_; 14 my $in_file = 'uniqueKmersEndingGG.fasta'; 15 16 open (my $fh, '>', $in_file) or die "Could not open file 'filename' $!"; 17 18 for ( 19 my $windowStart = 0; 20 $windowStart <= (length($$sequenceRef) - $windowSize); 21 $windowStart += $stepSize 22 ) 23 { 24 my $windowSeq = substr($$sequenceRef, $windowStart, $windowSize); 25 # processOneSequence($windowSeq); 26 # print $windowSeq; 27 } 28 #print $windowSeq; 29 #sub processOneSequence { 30 # my ($windowSeq) = @_; 31 # unless (defined $windowSeqScores{$windowSeq}) { 32 # my $score = scoreSequence ($windowSeq); 33 # $windowSeqScores {$windowSeq} = $score; 34 # if ( $score > $maxScore) { 35 # $maxScore = $score; 36 # print $windowSeq, "\t", $score, "\n"; 37 # } 38 # } 39 #} 40 41 sub loadSequence { 42 my ($sequenceFile) = @_; 43 my $sequence = ""; 44 my $counter = 0; 45 unless (open(FASTA, "<", $sequenceFile)) { 46 die $!; 47 } 48 49 while () { 50 my $line = $_; 51 chomp($line); 52 if ($line !~ /^>/) { 53 my $sequence = $line; 54 if (length($sequence) == 15) { 55 $counter = $counter + 1; 56 print $_; 57 } 58 } 59 return \$sequence; 60 } 61 } 62 print $sequence;