/* Program From Progressive Alignment of Amino Acid Sequences and Construction of Phylogenetic Trees from Them, by D. F. Feng and R. F. Doolittle, Methods of Enzymology, v266, p368 (1996) 2/7/1996 Read "readme.doc" before using. */ #include main(ac,av) int ac; char *av[]; { FILE *fd,*fopen(); char code[6],seqt[110]; int i,c,ct,flag; /* Check for correct command line */ if(ac<2) { fprintf(stderr,"\nPurpose: Convert Sequences to \"Old Atlas\""); fprintf(stderr," format.\n"); fprintf(stderr,"Usage: "); fprintf(stderr,"%s rf [>wf]\n",av[0]); fprintf(stderr,"\trf: Sequence-any format.\n"); fprintf(stderr,"\twf: Sequence-Old Atlas format.\n\n"); exit(); } if( (fd = fopen( av[1],"r" )) == NULL ) exit(fprintf(stderr,"%s: can't open %s\n",av[1]) ); fprintf(stderr,"\tD(NA) or P(rotein)? "); c = getchar(); if( c== 'D' || c == 'd' ) ct = 0; else ct = 1; getchar(); fprintf(stderr,"\tType a title for the sequence (<101 characters)\n"); i = 0; while((c=getchar())!='\n') { if( c >= 'a' && c <= 'z' ) seqt[i++] = c + 'A' - 'a'; else seqt[i++] = c; } seqt[i++] = '\n'; seqt[i] = '\0'; fprintf(stderr,"\tType a 4-letter code for the sequence\n"); i = 0; while((c=getchar())!='\n') { if( c >= 'a' && c <= 'z' ) code[i++] = c + 'A' - 'a'; else code[i++] = c; if(i==4) break; } if(i==3) code[i++] = ' '; code[i] = '\0'; printf("T%s %s",code,seqt); if(ct==0) printf("D%s 1",code); else printf("P%s 1",code); flag = 0; for(i=0; (c=fgetc(fd))!=EOF; ) { if( c >= 'A' && c <= 'Z') { i++; flag = 1; printf("%2c",c); } else if( c >= 'a' && c <= 'z' ) { c = c + 'A' - 'a'; i++; flag = 1; printf("%2c",c); } if(i%30==0 && flag==1) { if(ct==0) printf("\nD%s%5d",code,i+1); else printf("\nP%s%5d",code,i+1); flag = 0; } } printf(" *\n"); }