2 * fastafilt, filter fasta files based on its protein complexes
4 * Copyright (C) 2012 Ali Gholami Rudi <ali at rudi dot ir>
6 * This program is released under the modified BSD license.
11 #define NPROTS (1 << 12)
14 static char prots
[NPROTS
][NLEN
];
17 static int prot_find(char *name
)
20 for (i
= 0; i
< nprots
; i
++)
21 if (!strcmp(name
, prots
[i
]))
26 static void prot_add(char *name
)
28 if (prot_find(name
) >= 0)
30 strcpy(prots
[nprots
++], name
);
33 static void prot_read(FILE *fin
)
36 while (fscanf(fin
, "%s", name
) == 1)
40 static void fasta_filt(FILE *fin
)
45 while (fgets(line
, sizeof(line
), fin
)) {
51 sscanf(line
+ 1, "%s", name
);
52 matched
= prot_find(name
) >= 0;
58 int main(int argc
, char *argv
[])
60 FILE *fin
= argc
> 1 ? fopen(argv
[1], "r") : NULL
;
62 printf("usage: %s in.fasta <complexes >out.fasta\n", argv
[0]);