nsStar.c
1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
nsStar.c
Functions for computing n(s*) and p(s*) using partition function
algorithms. Written by Robert Dirks.
Modified by Justin Bois, 13 January 2007.
Modified to include salt correction by JSB Feb 2009.
*/
#include "nsStar.h"
/* ******************** */
DBL_TYPE nsStarPairsOrParensFull( int seqlength, int seq[], int *pairs,
char *parens, int complexity, int naType, int dangles,
DBL_TYPE temperature, DBL_TYPE sodiumconc,
DBL_TYPE magnesiumconc, int uselongsalt) {
DBL_TYPE explIncorrect;
DBL_TYPE pf;
int *thepairs;
pf = pfuncFull( seq, complexity, naType, dangles, temperature, 1, sodiumconc,
magnesiumconc, uselongsalt);
if( pairs == NULL) {
thepairs = (int*) malloc( (seqlength+1)*sizeof( int));
getStructureFromParens( parens, thepairs, seqlength);
}
else
thepairs = pairs;
explIncorrect = seqlength - expectedCorrectBases( thepairs, seqlength);
if( pairs == NULL)
free( thepairs);
return explIncorrect;
}