Commit 0f4f2a74 by Eric Coissac

Revert previous commit

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/trunk@261 60f365c0-8329-0410-b2a4-ec073aeeaa1d
parent b3d6acae
EXEC=ecoprobe
EXEC=ecoPrimer
PRIMER_SRC= ecoprobe.c
PRIMER_SRC= ecoprimer.c
PRIMER_OBJ= $(patsubst %.c,%.o,$(PRIMER_SRC))
SRCS= $(PRIMER_SRC)
LIB= -lecoprobe -lecoPCR -lthermo -lz -lm
LIB= -lecoprimer -lecoPCR -lthermo -lz -lm
LIBFILE= libecoPCR/libecoPCR.a \
libecoprobe/libecoprobe.a \
libecoprimer/libecoprimer.a \
libthermo/libthermo.a \
......@@ -21,13 +21,13 @@ all: $(EXEC)
########
#
# ecoprobe compilation
# ecoPrimer compilation
#
########
# executable compilation and link
ecoprobe: $(PRIMER_OBJ) $(LIBFILE)
ecoPrimer: $(PRIMER_OBJ) $(LIBFILE)
$(CC) $(LDFLAGS) -O5 -m64 -o $@ $< $(LIBPATH) $(LIB)
......@@ -40,8 +40,8 @@ ecoprobe: $(PRIMER_OBJ) $(LIBFILE)
libecoPCR/libecoPCR.a:
$(MAKE) -C libecoPCR
libecoprobe/libecoprobe.a:
$(MAKE) -C libecoprobe
libecoprimer/libecoprimer.a:
$(MAKE) -C libecoprimer
libthermo/libthermo.a:
$(MAKE) -C libthermo
......@@ -56,7 +56,7 @@ clean:
rm -f *.o
rm -f $(EXEC)
$(MAKE) -C libecoPCR clean
$(MAKE) -C libecoprobe clean
$(MAKE) -C libecoprimer clean
$(MAKE) -C libthermo clean
......
MACHINE=MAC_OS_X
LIBPATH= -Llibapat -LlibecoPCR -Llibecoprobe -Llibthermo
LIBPATH= -Llibapat -LlibecoPCR -Llibecoprimer -Llibthermo
MAKEDEPEND = gcc -D$(MACHINE) -M $(CPPFLAGS) -o $*.d $<
CC=gcc
......
......@@ -15,31 +15,31 @@
#include"nnparams.h"
float forbidden_entropy;
double forbidden_entropy;
float nparam_GetInitialEntropy(PNNParams nparm)
double nparam_GetInitialEntropy(PNNParams nparm)
{
return -5.9f+nparm->rlogc;
}
//Retrieve Enthalpy for given NN-Pair from parameter table
float nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1)
double nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1)
{
return ndH(x0,x1,y0,y1); //xx, yx are already numbers
}
//Retrieve Entropy for given NN-Pair from parameter table
float nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1)
double nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1)
{
//xx and yx are already numbers
char nx0=x0;//nparam_convertNum(x0);
char nx1=x1;//nparam_convertNum(x1);
char ny0=y0;//nparam_convertNum(y0);
char ny1=y1;//nparam_convertNum(y1);
float answer = ndS(nx0,nx1,ny0,ny1);
double answer = ndS(nx0,nx1,ny0,ny1);
/*Salt correction Santalucia*/
if (nparm->saltMethod == SALT_METHOD_SANTALUCIA) {
if(nx0!=5 && 1<= nx1 && nx1<=4) {
......@@ -51,7 +51,7 @@ float nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1)
}
/*Salt correction Owczarzy*/
if (nparm->saltMethod == SALT_METHOD_OWCZARZY) {
float logk = log(nparm->kplus);
double logk = log(nparm->kplus);
answer += ndH(nx0,nx1,ny0,ny1)*((4.29 * nparm->gcContent-3.95)*0.00001*logk+ 0.0000094*logk*logk);
}
return answer;
......@@ -75,9 +75,9 @@ float nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1)
* temperature
*/
float nparam_CalcTM(float entropy,float enthalpy)
double nparam_CalcTM(double entropy,double enthalpy)
{
float tm = 0; // absolute zero - return if model fails!
double tm = 0; // absolute zero - return if model fails!
if (enthalpy>=forbidden_enthalpy) //||(entropy==-cfact))
return 0;
if (entropy<0) // avoid division by zero and model errors!
......@@ -90,7 +90,7 @@ float nparam_CalcTM(float entropy,float enthalpy)
}
void nparam_InitParams(PNNParams nparm, float c1, float c2, float kp, int sm)
void nparam_InitParams(PNNParams nparm, double c1, double c2, double kp, int sm)
{
nparm->Ct1 = c1;
nparm->Ct2 = c2;
......@@ -100,7 +100,7 @@ void nparam_InitParams(PNNParams nparm, float c1, float c2, float kp, int sm)
{
maxCT = 2;
}
float ctFactor;
double ctFactor;
if(nparm->Ct1 == nparm->Ct2)
{
ctFactor = nparm->Ct1/2;
......@@ -461,7 +461,7 @@ void nparam_InitParams(PNNParams nparm, float c1, float c2, float kp, int sm)
int nparam_CountGCContent(char * seq ) {
int lseq = strlen(seq);
int k;
float count = 0;
double count = 0;
for( k=0;k<lseq;k++) {
if (seq[k] == 'G' || seq[k] == 'C' ) {
count+=1;
......@@ -478,38 +478,42 @@ void nparam_CleanSeq (char* inseq, char* outseq, int len)
if (len != 0)
seqlen = len;
for (i = 0, j = 0; i < seqlen; i++)
outseq[0]='x';
for (i = 0, j = 0; i < seqlen && outseq[0]; i++,j++)
{
switch (inseq[i])
{
case 'a':
case '\0':
case 'A':
outseq[j++] = 'A'; break;
outseq[j] = 'A'; break;
case 'c':
case '\1':
case 'C':
outseq[j++] = 'C'; break;
outseq[j] = 'C'; break;
case 'g':
case '\2':
case 'G':
outseq[j++] = 'G'; break;
outseq[j] = 'G'; break;
case 't':
case '\3':
case 'T':
outseq[j++] = 'T'; break;
outseq[j] = 'T'; break;
default:
outseq[0]=0;
}
}
outseq[j] = '\0';
}
//Calculate TM for given sequence against its complement
float nparam_CalcSelfTM(PNNParams nparm, char* seq, int len)
double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len)
{
float thedH = 0;
//float thedS = nparam_GetInitialEntropy(nparm);
float thedS = -5.9f+nparm->rlogc;
float mtemp;
double thedH = 0;
//double thedS = nparam_GetInitialEntropy(nparm);
double thedS = -5.9f+nparm->rlogc;
double mtemp;
char c1;
char c2;
char c3;
......@@ -532,22 +536,19 @@ float nparam_CalcSelfTM(PNNParams nparm, char* seq, int len)
thedH += nparm->dH[c3][c4][c1][c2];//nparam_GetEnthalpy(nparm, c3,c4,c1,c2);
thedS += nparam_GetEntropy(nparm, c3,c4,c1,c2);
}
// printf("------------------\n");
//printf("------------------\n");
mtemp = nparam_CalcTM(thedS,thedH);
//if (mtemp == 0)
//{
// fprintf(stderr,"Enthalpy: %f, entropy: %f, seq: %s\n", thedH, thedS, useq);
//fprintf(stderr,"Enthalpy: %f, entropy: %f, seq: %s rloc=%f\n", thedH, thedS, useq, nparm->rlogc);
//exit (0);
//}
return mtemp;
}
float nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len)
double nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len)
{
float thedH = 0;
//float thedS = nparam_GetInitialEntropy(nparm);
float thedS = -5.9f+nparm->rlogc;
float mtemp;
double thedH = 0;
//double thedS = nparam_GetInitialEntropy(nparm);
double thedS = -5.9f+nparm->rlogc;
double mtemp;
char c1;
char c2;
char c3;
......@@ -587,9 +588,9 @@ float nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len)
return mtemp;
}
float calculateMeltingTemperatureBasic (char * seq) {
double calculateMeltingTemperatureBasic (char * seq) {
int gccount;
float temp;
double temp;
int seqlen;
seqlen = strlen (seq);
......
......@@ -31,7 +31,7 @@
#define GETREVCODE(a) 5-bpencoder[a - 'A']
extern float forbidden_entropy;
extern double forbidden_entropy;
static char bpencoder[] = { 1, // A
0, // b
......@@ -45,28 +45,28 @@ static char bpencoder[] = { 1, // A
typedef struct CNNParams_st
{
float Ct1;
float Ct2;
float rlogc;
float kplus;
float kfac;
double Ct1;
double Ct2;
double rlogc;
double kplus;
double kfac;
int saltMethod;
float gcContent;
float new_TM;
float dH[6][6][6][6]; // A-C-G-T + gap + initiation (dangling end, $ sign)
float dS[6][6][6][6];
double gcContent;
double new_TM;
double dH[6][6][6][6]; // A-C-G-T + gap + initiation (dangling end, $ sign)
double dS[6][6][6][6];
}CNNParams, * PNNParams;
void nparam_InitParams(PNNParams nparm, float c1, float c2, float kp, int sm);
void nparam_InitParams(PNNParams nparm, double c1, double c2, double kp, int sm);
int nparam_CountGCContent(char * seq );
float nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1);
float nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1);
float nparam_CalcTM(float entropy,float enthalpy);
float nparam_CalcSelfTM(PNNParams nparm, char* seq, int len);
float nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len);
double nparam_GetEntropy(PNNParams nparm, char x0, char x1, char y0, char y1);
double nparam_GetEnthalpy(PNNParams nparm, char x0, char x1, char y0, char y1);
double nparam_CalcTM(double entropy,double enthalpy);
double nparam_CalcSelfTM(PNNParams nparm, char* seq, int len);
double nparam_CalcTwoTM(PNNParams nparm, char* seq1, char* seq2, int len);
float nparam_GetInitialEntropy(PNNParams nparm) ;
float calculateMeltingTemperatureBasic (char * seq);
double nparam_GetInitialEntropy(PNNParams nparm) ;
double calculateMeltingTemperatureBasic (char * seq);
//void getThermoProperties (ppair_t* pairs, size_t count, poptions_t options);
#endif
......@@ -26,7 +26,7 @@ word_t extractSite(char* sequence, size_t begin, size_t length, bool_t strand)
return site;
}
/*void getThermoProperties (ppair_t* pairs, size_t count, poptions_t options)
void getThermoProperties (ppair_t* pairs, size_t count, poptions_t options)
{
size_t i, j,k,l;
uint32_t bp1,bp2;
......@@ -39,7 +39,7 @@ word_t extractSite(char* sequence, size_t begin, size_t length, bool_t strand)
char prmrd[50];
char prmrr[50];
char sqsite[50];
float mtemp;
double mtemp;
for (i = 0; i < count; i++)
{
......@@ -112,71 +112,4 @@ word_t extractSite(char* sequence, size_t begin, size_t length, bool_t strand)
}
}
}*/
void getProbeThermoProperties (pecodnadb_t seqdb,uint32_t seqdbsize, pprobecount_t pprobs, poptions_t options)
{
size_t i, j,k;
uint32_t bp1,bp2;
word_t w;
//word_t wtmp;
bool_t strand;
char *sq;
char prmr[50];
float mtemp;
for (i = 0; i < pprobs->size; i++)
{
w = pprobs->probes[i].primer->word;
//wtmp = ecoComplementWord(w1,options->primer_length);
//if (wtmp > w) w = wtmp;
strncpy(prmr,ecoUnhashWord(w, options->primer_length),options->primer_length);
prmr[options->primer_length]=0;
pprobs->probes[i].ptemp = nparam_CalcSelfTM (options->pnparm, prmr, options->primer_length) - 273.0;
pprobs->probes[i].pmintemp = 100;
for (j = 0; j < seqdbsize; j++)
{
if (!seqdb[j]->isexample) continue;
sq = seqdb[j]->SQ;
if (pprobs->probes[i].primer->directCount[j] > 0)
{
strand = TRUE;
for (k = 0; k < pprobs->probes[i].primer->directCount[j]; k++)
{
bp1 = (pprobs->probes[i].primer->directCount[j] > 1)? pprobs->probes[i].primer->directPos[j].pointer[k] : pprobs->probes[i].primer->directPos[j].value;
mtemp = nparam_CalcTwoTM(options->pnparm,
prmr,
ecoUnhashWord(extractSite(sq,bp1,options->primer_length,strand),options->primer_length),
options->primer_length) - 273.0;
if (mtemp < pprobs->probes[i].pmintemp)
pprobs->probes[i].pmintemp = mtemp;
}
}
if (pprobs->probes[i].primer->reverseCount[j] > 0)
{
strand = FALSE;
for (k = 0; k < pprobs->probes[i].primer->directCount[j]; k++)
{
bp1 = (pprobs->probes[i].primer->reverseCount[j] > 1)? pprobs->probes[i].primer->reversePos[j].pointer[k] : pprobs->probes[i].primer->reversePos[j].value;
mtemp = nparam_CalcTwoTM(options->pnparm,
prmr,
ecoUnhashWord(extractSite(sq,bp1,options->primer_length,strand),options->primer_length),
options->primer_length) - 273.0;
if (mtemp < pprobs->probes[i].pmintemp)
pprobs->probes[i].pmintemp = mtemp;
}
}
}
}
}
#ifndef THERMOSTATS_H_
#define THERMOSTATS_H_
#include "../libecoprobe/ecoprobe.h"
#include "../libecoprimer/ecoprimer.h"
//void getThermoProperties (ppair_t* pairs, size_t count, poptions_t options);
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);
void getProbeThermoProperties (pecodnadb_t seqdb,uint32_t seqdbsize, pprobecount_t pprobs, poptions_t options);
#endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment