LONG:while () { $jump ++; if ($jump <= $rows2jump){ $counter2++; next LONG; } $counter2++; #number of lines processed #Lets deal with the sequences head here if ($_ =~ /^>/) { $h_title = "$_"; $h_title =~ s/^>//; #Check if head exists #If head doesnt exist, insert it in the
head index table $sth1->execute($h_title) or
print "$DBI::errstr"; #Get last id $h_title_counter = $dbh->selectrow_array("SELECT MAX(id) FROM head_index"); next LONG; } #Here we will deal with the actal sequence chop; #To remove the > at the end of the line my $line = "$_"; #Input stuff in mysql for my $x (0 ... (length($line) - ($word_length)-1)) { my $word = substr($line, $x, $word_length);
#Now we have it with a big cache, hope to speed things up if ($most_used_words{$word}) { #UPDATE e_match_word set counter = counter+1 WHERE word = ? $sth3->execute($word) or print "$DBI::errstr"; #print "cached result\n"; } elsif ($dbh->selectrow_array("SELECT 1 FROM e_match_word WHERE word = ?", undef, $word)) { #UPDATE e_match_word set counter = counter+1 WHERE word = ? $sth3->execute($word) or print "$DBI::errstr"; #print "not cached result\n"; } else { #INSERT INTO e_match_word VALUES (?,?) $sth2->execute($word, 1) or print "$DBI::errstr"; $wordcounter++; #print "new word\n"; } #INSERT INTO e_match_info values (?,?,?) $sth4->execute($word, $h_title_counter, $x) or print "$DBI::errstr"; } #$percent_done = int(($counter2/$counter) * 100); $status = "Searching for exact patterns.. processing line $counter2 of $counter"; $mw->update(); $mw->update; exit if ($stop); } close (READ); }