From 50c26e81b9f30c759520ced461281da3fbbf4710 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Tue, 14 Jul 2009 22:23:18 +0000 Subject: [PATCH] Added command line options for: a. 'salt method' like "-m 1" or "-m 2" here 1 is for SANTALUCIA and 2 is for OWCZARZY b. 'salt concentration' "-a 0.01" valid range is from 0.01 to 0.3. if not specified then we use default 0.05 git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/trunk@224 60f365c0-8329-0410-b2a4-ec073aeeaa1d --- src/ecoprimer.c | 28 +++++++++++++++++++++++++--- src/libecoprimer/ecoprimer.h | 2 ++ src/libthermo/nnparams.c | 8 -------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/ecoprimer.c b/src/ecoprimer.c index 75ed821..9651d67 100644 --- a/src/ecoprimer.c +++ b/src/ecoprimer.c @@ -157,6 +157,8 @@ void initoptions(poptions_t options) options->no_multi_match=FALSE; options->pnparm = NULL; strcpy(options->taxonrank, DEFAULTTAXONRANK); /*taxon level for results, species by default*/ + options->saltmethod = SALT_METHOD_SANTALUCIA; + options->salt = DEF_SALT; } void printapair(int32_t index,ppair_t pair, poptions_t options) @@ -540,11 +542,10 @@ int main(int argc, char **argv) //printf ("\nGETREVCODE: A=%d, C=%d, G=%d, T=%d\n", GETREVCODE(t[0]), GETREVCODE('C'), GETREVCODE('G'), GETREVCODE('T')); //return 0; CNNParams nnparams; - nparam_InitParams(&nnparams, DEF_CONC_PRIMERS,DEF_CONC_SEQUENCES,DEF_SALT,SALT_METHOD_SANTALUCIA); initoptions(&options); - while ((carg = getopt(argc, argv, "hfvcUDSd:l:L:e:i:r:R:q:3:s:x:t:O:")) != -1) { + while ((carg = getopt(argc, argv, "hfvcUDSd:l:L:e:i:r:R:q:3:s:x:t:O:m:a:")) != -1) { switch (carg) { /* ---------------------------- */ @@ -674,7 +675,19 @@ int main(int argc, char **argv) sscanf(optarg,"%d",&(options.primer_length)); break; - /* -------------------- */ + /* --------------------------------- */ + case 'm': /* set salt method */ + /* --------------------------------- */ + sscanf(optarg,"%d",&(options.saltmethod)); + break; + + /* --------------------------------- */ + case 'a': /* set salt */ + /* --------------------------------- */ + sscanf(optarg,"%f",&(options.salt)); + break; + + /* -------------------- */ case 'c': /* sequences are circular */ /* --------------------------------- */ options.circular = 1; @@ -687,6 +700,15 @@ int main(int argc, char **argv) } options.pnparm = &nnparams; + if (options.saltmethod != 2) //if not SALT_METHOD_OWCZARZY + options.saltmethod = SALT_METHOD_SANTALUCIA; //then force SALT_METHOD_SANTALUCIA + + + if (options.salt < 0.01 || options.salt > 0.3) //if salt value out of literature values + options.salt = DEF_SALT; //set to default + + nparam_InitParams(&nnparams, DEF_CONC_PRIMERS,DEF_CONC_SEQUENCES,options.salt,options.saltmethod); + fprintf(stderr,"Reading taxonomy database ..."); taxonomy = read_taxonomy(options.prefix,0); fprintf(stderr,"Ok\n"); diff --git a/src/libecoprimer/ecoprimer.h b/src/libecoprimer/ecoprimer.h index f226a01..68b774e 100644 --- a/src/libecoprimer/ecoprimer.h +++ b/src/libecoprimer/ecoprimer.h @@ -278,6 +278,8 @@ typedef struct { int32_t outsamples; int32_t intaxa; int32_t outtaxa; + int saltmethod; + float salt; PNNParams pnparm; } options_t, *poptions_t; diff --git a/src/libthermo/nnparams.c b/src/libthermo/nnparams.c index a7ed186..047498c 100644 --- a/src/libthermo/nnparams.c +++ b/src/libthermo/nnparams.c @@ -89,14 +89,6 @@ float nparam_CalcTM(float entropy,float enthalpy) return tm; } -/* PURPOSE: Initialize nearest neighbor parameters. -* -* PARAMETERS: -* none -* -* RETURN VALUE: -* void -*/ void nparam_InitParams(PNNParams nparm, float c1, float c2, float kp, int sm) {