New version 0.2 of ecoPCR, with Tm computation.

Take care file format have change. You must use corresponding version of ecogrep
You can use -t option to go back to the old format without tm computation

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/trunk@238 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
2010-01-22 09:16:53 +00:00
parent ad6f493d0f
commit f7e25b2082
7 changed files with 796 additions and 17 deletions

View File

@ -1,11 +1,13 @@
#include "libecoPCR/ecoPCR.h"
#include "libthermo/nnparams.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#define VERSION "0.1"
#define VERSION "0.2"
/* ----------------------------------------------- */
/* printout help */
@ -42,7 +44,12 @@ static void PrintHelp()
PP "-r : [R]estricts the search to the given taxonomic id.\n");
PP " Taxonomy id are available using the ecofind program.\n");
PP " see its help typing ecofind -h for more information.\n");
PP "-c : Consider that the database sequences are [c]ircular");
PP "-c : Consider that the database sequences are [c]ircular\n");
PP "-t : don't calculate tm (backward compatibility with old ecoPCR\n");
PP " output file format)\n");
PP "-m : Salt correction method for Tm computation (SANTALUCIA : 1\n");
PP " or OWCZARZY:2, default=1)\n\n");
PP "-a : Salt contentration in M for Tm computation (default 0.05 M)\n\n");
PP "\n");
PP "------------------------------------------\n");
PP "first argument : oligonucleotide for direct strand\n\n");
@ -64,11 +71,13 @@ static void PrintHelp()
PP "column 13 : strand (direct or reverse)\n");
PP "column 14 : first oligonucleotide\n");
PP "column 15 : number of errors for the first strand\n");
PP "column 16 : second oligonucleotide\n");
PP "column 17 : number of errors for the second strand\n");
PP "column 18 : amplification length\n");
PP "column 19 : sequence\n");
PP "column 20 : definition\n");
PP "column 16 : Tm for hybridization of primer 1 at this site\n");
PP "column 17 : second oligonucleotide\n");
PP "column 18 : number of errors for the second strand\n");
PP "column 19 : Tm for hybridization of primer 1 at this site\n");
PP "column 20 : amplification length\n");
PP "column 21 : sequence\n");
PP "column 22 : definition\n");
PP "------------------------------------------\n");
PP " http://www.grenoble.prabi.fr/trac/ecoPCR/\n");
PP "------------------------------------------\n\n");
@ -97,6 +106,9 @@ static void ExitUsage(stat)
#undef PP
void printRepeat(ecoseq_t *seq,
char* primer1, char* primer2,
char compute_tm,
PNNParams tparm,
PatternPtr o1, PatternPtr o2,
char strand,
char kingdom,
@ -128,6 +140,8 @@ void printRepeat(ecoseq_t *seq,
char *amplifia = NULL;
int32_t amplength;
double tm1,tm2;
double tm=0;
AC = seq->AC;
seqlength = seq->SQ_length;
@ -222,7 +236,38 @@ void printRepeat(ecoseq_t *seq,
ecoComplementSequence(oligo2);
amplifia[amplength - o2->patlen - o1->patlen]=0;
printf("%-15s | %9d | %8d | %-20s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %c | %-32s | %2d | %-32s | %2d | %5d | %s | %s\n",
if (compute_tm)
{
tm1=nparam_CalcTwoTM(tparm,oligo1,primer1,o1->patlen) - 273.15;
tm2=nparam_CalcTwoTM(tparm,oligo2,primer2,o2->patlen) - 273.15;
tm = (tm1 < tm2) ? tm1:tm2;
printf("%-15s | %9d | %8d | %-20s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %c | %-32s | %2d | %5.2f | %-32s | %2d | %5.2f | %5d | %s | %s\n",
AC,
seqlength,
taxid,
rank,
species_taxid,
scientificName,
genus_taxid,
genus_name,
family_taxid,
family_name,
superkingdom_taxid,
superkingdom_name,
strand,
oligo1,
error1,
tm1,
oligo2,
error2,
tm2,
amplength - o1->patlen - o2->patlen,
amplifia,
seq->DE
);
}
else
printf("%-15s | %9d | %8d | %-20s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %8d | %-30s | %c | %-32s | %2d | %-32s | %2d | %5d | %s | %s\n",
AC,
seqlength,
taxid,
@ -300,8 +345,12 @@ int main(int argc, char **argv)
int32_t g=0;
int32_t circular=0;
char compute_tm=0;
int32_t saltmethod=SALT_METHOD_SANTALUCIA;
double salt=0.05;
CNNParams tparm;
while ((carg = getopt(argc, argv, "hcd:l:L:e:i:r:k")) != -1) {
while ((carg = getopt(argc, argv, "hcd:l:L:e:i:r:km:a:t")) != -1) {
switch (carg) {
/* -------------------- */
@ -366,7 +415,25 @@ int main(int argc, char **argv)
circular = 1;
break;
case '?': /* bad option */
/* --------------------------- */
case 't': /* compute tm of amplification */
compute_tm = 1; /* --------------------------- */
break;
/* --------------------------------- */
case 'm': /* set salt method */
/* --------------------------------- */
sscanf(optarg,"%d",&(saltmethod));
compute_tm = 1;
break;
/* --------------------------------- */
case 'a': /* set salt */
/* --------------------------------- */
sscanf(optarg,"%lf",&(salt));
compute_tm = 1;
break;
case '?': /* bad option */
/* -------------------- */
errflag++;
}
@ -404,6 +471,11 @@ int main(int argc, char **argv)
errflag++;
}
if (compute_tm)
nparam_InitParams(&tparm,DEF_CONC_PRIMERS,
DEF_CONC_PRIMERS,
salt,
saltmethod);
if (!oligo1 || !oligo2)
errflag++;
@ -423,6 +495,18 @@ int main(int argc, char **argv)
printf("# reverse strand oligo2 : %-32s ; oligo1c : %32s\n", o2->cpat,o1c->cpat);
printf("# max error count by oligonucleotide : %d\n",error_max);
if (compute_tm)
{
double tm,tm1,tm2;
tm1=nparam_CalcSelfTM(&tparm,o1->cpat,o1->patlen) - 273.15;
tm2=nparam_CalcSelfTM(&tparm,o2->cpat,o2->patlen) - 273.15;
tm = (tm1 < tm2) ? tm1:tm2;
printf("# optimal Tm for primers 1 : %5.2f\n",tm1);
printf("# optimal Tm for primers 2 : %5.2f\n",tm2);
}
printf("# database : %s\n",prefix);
if (lmin && lmax)
printf("# amplifiat length between [%d,%d] bp\n",lmin,lmax);
@ -523,7 +607,7 @@ int main(int argc, char **argv)
if (length &&
(!lmin || (length >= lmin)) &&
(!lmax || (length <= lmax)))
printRepeat(seq,o1,o2c,'D',kingdom_mode,posi,posj,erri,errj,taxonomy);
printRepeat(seq,oligo1,oligo2,compute_tm,&tparm,o1,o2c,'D',kingdom_mode,posi,posj,erri,errj,taxonomy);
//printf("%s\tD\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o1Hits,o2cHits,posi,posj,scname);
}
@ -577,7 +661,7 @@ int main(int argc, char **argv)
if (length &&
(!lmin || (length >= lmin)) &&
(!lmax || (length <= lmax)))
printRepeat(seq,o2,o1c,'R',kingdom_mode,posi,posj,erri,errj,taxonomy);
printRepeat(seq,oligo1,oligo2,compute_tm,&tparm,o2,o1c,'R',kingdom_mode,posi,posj,erri,errj,taxonomy);
//printf("%s\tR\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o2Hits,o1cHits,posi,posj,scname);
}
}