in reply to
Re: string similarity by using a function sort_by_similarity()
in thread string similarity by using a function sort_by_similarity()
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.