Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: Question: homemade blat: insert query from keyboard to find an oligo in an hashtableby Cristoforo (Curate) |
on Dec 05, 2015 at 18:03 UTC ( [id://1149470]=note: print w/replies, xml ) | Need Help?? |
It's possible to search for a query not the length used to create the index (for example a query >n or a multiple of n) without recreating the whole hashtable?This program does it. Update: Changed program so it finds matches in while loop - no need to store data. Process it as you read it. For 3 runs of the program (using the same data file I used in my first post).
  And it seems that the position of the oligos found in the sequence are shifted by one, i know that we count from zero but i can't figure out how to change it This code push @pos, $-[0] + 1; will give the position as though counting from 1 (instead of 0). It adds 1 to the offset of the beginning of the pattern match. The @- special variable can be found here Variables related to regular expressions. Scroll down to •@LAST_MATCH_START. It says $-[0] is the offset of the start of the last successful match. $-[n] is the offset of the start of the substring matched by n-th subpattern, or undef if the subpattern did not match.
In Section
Seekers of Perl Wisdom
|
|