int countMatches (string genome, string sequence3, float minscore)
{
float n = 0;
float c = 0;
float m = 0;
for (int i = 0; i <= genome.length(); i++)
{
int d;
if (sequence3 != genome.substr(i, sequence3.length()))
{
int a = 0;
while (a <= sequence3.length())
{
if (genome[a] == sequence3[a] )
{
m = m+1;
}
a++; //add 1 and redo the a loop until a is equal to the length
}
d = m/sequence3.length();
cout << "similarity : " << d;
}
if (sequence3 == genome.substr(i,sequence3.length()) || d >= minscore)
{
c = c + 1;
}
ok, but if you are looking for ccc and the string to search is
cccccccccccc how many do you have :)
also we need to understand the fuzzy matching algorithm better. Its not really explained what the similarity score thing is in the problem, we have to infer it from (not working) code...
Are garden gnomes living beings now?
Modern science is amazing!
Sorry for the laugh. Gotta admit it is kind of funny. Anyway, +1 to jonnin for asking the question that needs to be asked: how is your fuzzy matching algorithm supposed to work? Because actual comparative genomics is significantly more involved...
Take your g(e)nome (sorry, I saw the same as @Duthomas!) string and numerically slide the sequence string along underneath.
For each possible position, count the number of matching characters between the genome substring and the searched-for sequence, divide this by the sequence length (careful not to use integer division) and compare with minscore. If the matching fractional equals or exceeds minscore then increment the count of matching subsequences.