I would like to explain my problem in detail as follows.
I would like to compare a biological DNA sequence say,
Query sequence with which I am comparing say,
based on certain windowsize and threshold.If windowsize is 5,the sequence gets partitioned into strings of length 5 as follows.
Input sequence strings(@inputsubs):-GATCA ATCAA TCAAG CAAGA AAGCG....
Query sequence strings(@querysubs):-CTGAG TGAGG GAGGG AGGGG GGGGT....
Now each string in the @inputsubs is being compared with each and every string in the @querysubs.If there are atleast 3(or more than 3) same bases i.e., three similar characters,then they can be grouped into an array i.e., here 3 is the threshold.
So,I want all those strings which can show the similarity >=threshold.When I have used brute force method to compare the strings,by using count method.It was taking more time.So I tried to use the function sort_by_similarity
By using this function,I could get the array of strings which are sorted in an ascending order ie., starting from strings that have strings of lowest similarity and ending with the strings that have highest similarity with the querystrings.But I would like to have only those strings which have a similarity >=threshold i.e.,
If input is abcdef,query is abcefg windowsize is 3,threshold is 2,I would like to have
My code is as follows.
use String::Similarity::Group ':all';
#use Smart::Comments '###';
print "Enter the input sequence\n";
print "Enter the query sequence\n";
Please suggest me in case of any improvements or other less time taking methods to get the desired output.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||