48 static const char kNCBIstdaa[] =
"-ABCDEFGHIKLMNPQRSTVWXYZU*OJ";
58 }
else if (
islower((
unsigned char) aa)) {
59 aa =
toupper((
unsigned char) aa);
73 if (i1 >=0 && i2 >= 0) {
74 return sm->
scores[(size_t)i1 * strlen(sm->
symbols) + (size_t)i2];
85 int dim,
i, j, aa1, aa2;
88 dim = (
int)strlen(sym);
96 for (
i = 0;
i < dim; ++
i) {
99 for (j = 0; j < dim; ++j) {
101 fsm->
s[aa1][aa2] = psm->
scores[
i * dim + j];
104 for (aa2 = 0; aa2 <
sizeof(
kNCBIstdaa); ++aa2) {
107 for (aa2 =
'a'; aa2 <=
'z'; ++aa2) {
108 fsm->
s[aa1][aa2] = fsm->
s[aa1][
toupper((
unsigned char) aa2)];
112 for (aa1 = 0; aa1 <
sizeof(
kNCBIstdaa); ++aa1) {
115 for (aa1 =
'a'; aa1 <=
'z'; ++aa1) {
123 for ( ; *pfx; ++
str, ++pfx) {
144 default:
return NULL;
static const char * str(char *buf, int n)
unsigned int
A callback function used to compare two keys in a database.
int strcmp(const char *str1, const char *str2)
static int s_NCBISM_StartsWith(const char *str, const char *pfx)
int NCBISM_GetIndex(const SNCBIPackedScoreMatrix *sm, int aa)
Map a standard residue code into an index suitable for a particular packed score matrix.
const SNCBIPackedScoreMatrix * NCBISM_GetStandardMatrix(const char *name)
TNCBIScore NCBISM_GetScore(const SNCBIPackedScoreMatrix *sm, int aa1, int aa2)
Look up an entry in a packed score matrix.
void NCBISM_Unpack(const SNCBIPackedScoreMatrix *psm, SNCBIFullScoreMatrix *fsm)
Expand a packed score matrix into an unpacked one, which callers can proceed to index directly by sta...
static const char kNCBIstdaa[]
const SNCBIPackedScoreMatrix NCBISM_Pam30
const SNCBIPackedScoreMatrix NCBISM_Blosum62
const SNCBIPackedScoreMatrix NCBISM_Pam250
const SNCBIPackedScoreMatrix NCBISM_Blosum50
#define NCBI_FSM_DIM
Recommended approach: unpack and index directly.
const SNCBIPackedScoreMatrix NCBISM_Blosum80
const SNCBIPackedScoreMatrix NCBISM_Pam70
const SNCBIPackedScoreMatrix NCBISM_Blosum45
The standard matrices.
const SNCBIPackedScoreMatrix NCBISM_Identity
const SNCBIPackedScoreMatrix NCBISM_Blosum90
const TNCBIScore * scores
strlen(symbols) x strlen(symbols)
TNCBIScore defscore
score for unknown residues
const char * symbols
order of residues