diff --git a/src/ecoprimer.c b/src/ecoprimer.c index 998a248..2342318 100644 --- a/src/ecoprimer.c +++ b/src/ecoprimer.c @@ -777,7 +777,6 @@ int main(int argc, char **argv) pairs = buildPrimerPairs(seqdb, seqdbsize, primers, &options); printpairs (pairs, &options,taxonomy); - // closlibman (); return 0; } diff --git a/src/libecoprimer/aproxpattern.c b/src/libecoprimer/aproxpattern.c index 620bc80..0cf349e 100644 --- a/src/libecoprimer/aproxpattern.c +++ b/src/libecoprimer/aproxpattern.c @@ -97,8 +97,8 @@ pprimercount_t lookforAproxPrimer(pecodnadb_t database, uint32_t seqdbsize,uint3 params.circular = options->circular; params.maxerr = options->error_max; - params.omask = (1 << options->strict_three_prime) -1; -// params.omask = 0; +// params.omask = (1 << options->strict_three_prime) -1; + params.omask = 0; params.patlen = options->primer_length; positions.val=NULL; diff --git a/src/libecoprimer/pairs.c b/src/libecoprimer/pairs.c index 24b6dde..a11030d 100644 --- a/src/libecoprimer/pairs.c +++ b/src/libecoprimer/pairs.c @@ -8,6 +8,7 @@ #include "ecoprimer.h" #include #include +#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 diff --git a/src/libthermo/thermostats.c b/src/libthermo/thermostats.c index 3e47e70..525cc42 100644 --- a/src/libthermo/thermostats.c +++ b/src/libthermo/thermostats.c @@ -4,8 +4,7 @@ #include #include "thermostats.h" -static word_t extractSite(char* sequence, - size_t begin, size_t length, bool_t strand) +word_t extractSite(char* sequence, size_t begin, size_t length, bool_t strand) { char *c; char *start; diff --git a/src/libthermo/thermostats.h b/src/libthermo/thermostats.h index 2e5a630..40c4806 100644 --- a/src/libthermo/thermostats.h +++ b/src/libthermo/thermostats.h @@ -4,5 +4,6 @@ #include "../libecoprimer/ecoprimer.h" void getThermoProperties (ppair_t* pairs, size_t count, poptions_t options); +word_t extractSite(char* sequence, size_t begin, size_t length, bool_t strand); #endif \ No newline at end of file