/* * This program takes in one or more .ms2 files and writes .mgf files * The TITLE line conforms to TPP expected format */ #include #include #include void WRITE_SPECTRUM(FILE *fp, FILE *fpout, char *szTitle, char *szMZ, int iCharge) { char szBuf[4096]; fprintf(fpout, "BEGIN IONS\n"); fprintf(fpout, "PEPMASS=%s\n", szMZ); fprintf(fpout, "CHARGE=%d+\n", iCharge); fprintf(fpout, "%s\n", szTitle); /* write out mz/int pairs */ while (fgets(szBuf, 4096, fp)) { if (szBuf[0]=='S') break; else if (!isalpha(szBuf[0])) fprintf(fpout, "%s", szBuf); } fprintf(fpout, "END IONS\n"); } int main(int argc, char *argv[]) { int i; if (argc<2) { printf("\n"); printf(" USAGE: %s *.ms2\n", argv[0]); printf(" This program converts .ms2 files to .mgf files\n"); printf("\n"); } /* loop through all input files */ for (i=1; i