File: pmain.c

package info (click to toggle)
glam2 1064-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 956 kB
  • sloc: ansic: 6,925; xml: 757; asm: 74; makefile: 54; sh: 11
file content (42 lines) | stat: -rw-r--r-- 1,398 bytes parent folder | download | duplicates (4)
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
#include "purge.h"

int	main(int argc,char *argv[])
{ 
	int	i,cutoff_score = 200,minimum=0,arg;
	char	score[100],*DBS_NAME,c=' ';
	ss_type	P = NULL;
	a_type	A;
	Boolean	success=FALSE,DNA=FALSE,xnu=FALSE,query=FALSE;

	if(argc < 3) print_error(PURGE_USAGE);
	DBS_NAME = argv[1];
	if(sscanf(argv[2],"%d",&i)!=1) print_error(PURGE_USAGE);
	cutoff_score = tMAX(int,1,i);
	sprintf(score,".%c%d",c,cutoff_score);
        for(arg = 3; arg < argc; arg++){
           if(argv[arg][0] != '-') print_error(PURGE_USAGE);
           switch(argv[arg][1]) {
                case 'b': c = 'b'; break;
                case 'e': c = 'e'; break;
                case 'f': c = 'f'; break;
                case 'q': query=TRUE; break;
                case 'x': xnu=TRUE; break;
                case 'n': DNA=TRUE; xnu=FALSE; break;
                default: print_error(PURGE_USAGE);
            }
        }
	if(c=='b' && DNA == TRUE)
		print_error("-b option is not allowed with -n option");
	if(xnu==TRUE && DNA == TRUE)
		print_error("-x option is not allowed with -n option");
	if(DNA) A = MkAlpha("NACGT",DNA_MTRX);
	else A = MkAlpha(AMINO_ACIDS,PROT_BLOSUM62);
	if(xnu) P = MkXnuSeqSet(DBS_NAME,A);
	else P = SeqSet(DBS_NAME,A);
        if (c==' ') { if (DNA) c = 'e'; else c = 'b'; }
	success = RmHomologs(cutoff_score, c, minimum, query, P);
	NilAlpha(A); NilSeqSet(P);
	if(success) return 0;
	else return 1;
}