Added Code to make sure that if -3 option is given then 3' end must match upto given number of base pairs

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/trunk@231 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
2009-07-30 22:20:07 +00:00
parent 494791d133
commit 1911880bb9
5 changed files with 44 additions and 5 deletions

View File

@ -8,6 +8,7 @@
#include "ecoprimer.h"
#include <string.h>
#include <stdlib.h>
#include "../libthermo/thermostats.h"
static void buildPrimerPairsForOneSeq(uint32_t seqid,
pecodnadb_t seqdb,
@ -187,6 +188,9 @@ static void buildPrimerPairsForOneSeq(uint32_t seqid,
bool_t strand;
//char prmr[50];
//float mtemp;
word_t w1, w1a, omask = (0x1L << options->strict_three_prime) -1;;
word_t w2, w2a, wtmp;
uint32_t bp1,bp2;
//prmr[options->primer_length] = '\0';
@ -292,6 +296,42 @@ static void buildPrimerPairsForOneSeq(uint32_t seqid,
current.asdirect2=bswp;
}
//Code to make sure that if -3 option is given then
//3' end must match upto given number of base pairs
if (options->strict_three_prime > 0)
{
w1 = current.p1->word;
w2 = current.p2->word;
if (!current.asdirect1) //make sure that word is from 5' to 3'
w1=ecoComplementWord(w1,options->primer_length);
if (!current.asdirect2) //make sure that word is from 5' to 3'
w2=ecoComplementWord(w2,options->primer_length);
//now both w1 and w2 are from 5' to 3' end
bp1 = matches[i].position;
bp2 = matches[j].position;
if (!strand)
{
bp1 = matches[j].position;
bp2 = matches[i].position;
}
//get word of first approximate repeat
w1a = extractSite(seqdb[seqid]->SQ,bp1,options->primer_length,strand);
//get word of second approximate repeat
w2a = extractSite(seqdb[seqid]->SQ,bp2,options->primer_length,!strand);
w1 = w1 & omask; //keep only strict_three_prime bases on the right (3') end
w2 = w2 & omask; //keep only strict_three_prime bases on the right (3') end
w1a = w1a & omask; //keep only strict_three_prime bases on the right (3') end
w2a = w2a & omask; //keep only strict_three_prime bases on the right (3') end
//now check that both words and primers of amplifia have same bases on 3' end
if (w1 ^ w1a != 0) continue;
else if (w2 ^ w2a != 0) continue;
}
// Look for the new pair in already seen pairs