56 nsymbols = strlen(alphabet);
59 t->
i2c = gk_cmalloc(256,
"gk_i2c_create_common");
60 t->
c2i = gk_imalloc(256,
"gk_i2c_create_common");
63 gk_cset(256, -1, t->
i2c);
64 gk_iset(256, -1, t->
c2i);
66 for(i=0;i<nsymbols;i++){
67 t->
i2c[
i] = alphabet[
i];
68 t->
c2i[(
int)alphabet[i]] = i;
87 size_t ntokens, nbytes,
len;
92 static char *AAORDER =
"ARNDCQEGHILKMFPSTWYVBZX*";
93 static int PSSMWIDTH = 20;
97 header = gk_cmalloc(PSSMWIDTH,
"gk_seq_ReadGKMODPSSM: header");
108 seq->
sequence = gk_imalloc(len,
"gk_seq_ReadGKMODPSSM");
109 seq->
pssm = gk_iAllocMatrix(len, PSSMWIDTH, 0,
"gk_seq_ReadGKMODPSSM");
110 seq->
psfm = gk_iAllocMatrix(len, PSSMWIDTH, 0,
"gk_seq_ReadGKMODPSSM");
115 fpin =
gk_fopen(filename,
"r",
"gk_seq_ReadGKMODPSSM");
120 errexit(
"Unexpected end of file: %s\n", filename);
124 for (i=0; i<PSSMWIDTH; i++)
125 header[i] = tokens.
list[i][0];
131 for (i=0, ii=0; ii<
len; ii++) {
133 errexit(
"Unexpected end of file: %s\n", filename);
139 for (j=0; j<PSSMWIDTH; j++) {
141 seq->
psfm[
i][converter->
c2i[(
int)header[j]]] = atoi(tokens.
list[2+PSSMWIDTH+j]);
void gk_getfilestats(char *fname, size_t *r_nlines, size_t *r_ntokens, size_t *r_max_nlntokens, size_t *r_nbytes)
FILE * gk_fopen(char *, char *, const char *)
void errexit(char *f_str,...)
void gk_strtokenize(char *line, char *delim, gk_Tokens_t *tokens)
for(size_t i=1;i< poses.size();++i)
void gk_seq_free(gk_seq_t *seq)
This function frees the memory allocated to the seq structure.
char * gk_strtoupper(char *)
Converts a string to upper case.
char * gk_getbasename(char *path)
void gk_freetokenslist(gk_Tokens_t *tokens)
gk_seq_t * gk_seq_ReadGKMODPSSM(char *filename)
This function reads a pssm in the format of gkmod pssm.
void * gk_malloc(size_t nbytes, char *msg)
void gk_free(void **ptr1,...)
void gk_seq_init(gk_seq_t *seq)
gk_i2cc2i_t * gk_i2cc2i_create_common(char *alphabet)
This function creates the localizations for the various sequences.