main () { t_text cmds; /* Unix shell commands file */ t_text fof; /* file of file names file */ FILE *fopen (); /* file open function */ int index; char name [ MAX_LINE ]; /* list file name */ char name2 [ MAX_LINE ]; /* file name suffix */ printf ( "This is the Script program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &fof, "What is the name of the list of file names?" ); d_strcpy ( cmds.name, "cmds" ); cmds.data = fopen ( "cmds", "w" ); /* Process the names. */ while ( fof.eof != TRUE ) { d_strcpy ( name, fof.line ); if ( name [ d_stridx ( name, "\n" ) ] == '\n' ) name [ d_stridx ( name, "\n" ) ] = '\0'; fprintf ( cmds.data, "gb2fasta %s > %s.fasta\n", name, name ); /* Get the next name. */ get_line ( &fof ); } /* while */ fclose ( cmds.data ); fclose ( fof.data ); } /* main */
main () { long end; /* end of DNA sequence segment */ char header [ MAX_LINE ]; /* FASTA file format header line */ t_text in; /* input DNA sequence file */ int index; /* commands files index */ t_text library; /* library of DNA sequences */ t_text names; /* file of sequence names file */ t_seq seq; /* DNA sequence */ long start; /* start of DNA sequence segment */ int version; /* DNA segment number */ char version_str [ MAX_LINE ]; /* ascii version number */ FILE *fopen (); /* file open function */ printf ( "This is the Sequence files --> Fasta format program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &names, "What is the list of sequences file name?" ); /* Open the DNA library output file. */ d_strcpy ( library.name, names.name ); library.name [ d_stridx ( library.name, "\n" ) ] = '\0'; library.name [ d_stridx ( library.name, "." ) ] = '\0'; d_strcat ( library.name, ".Library" ); library.data = fopen ( library.name, "w" ); /* Process the sequences. */ while ( names.eof != TRUE ) { /* Open the sequence output file. */ d_strcpy ( in.name, names.line ); in.name [ d_stridx ( in.name, "\n" ) ] = '\0'; /* Open the DNA sequence file for reading. */ open_text_file ( &in ); /* Read in the DNA sequence. */ read_DNA_seq ( &in, &seq ); fclose ( in.data ); /* Set up the name of the DNA sequence file. */ names.line [ d_stridx ( names.line, "\n" ) ] = '\0'; d_strcpy ( seq.name, names.line ); seq.name [ d_stridx ( seq.name, "." ) ] = '\0'; /* Write out the library name line. */ write_fasta_name ( &library, seq.name, 1, seq.total, seq.total ); /* Write out the library DNA sequence. */ write_DNA_seq ( &seq, 0, seq.total - 1, &library ); /* Get the next name. */ get_line ( &names ); } /* while */ fclose ( library.data ); printf ( "\nEnd of DNA Sequences -> Fasta format program.\n" ); } /* main */
main () { t_text fof; /* file of filenames */ t_text in; /* input DNA sequence file */ t_text repeat; /* repeat list for FATAL: errors */ t_text results; /* Summary of Blast results */ t_text trace; /* trace report */ FILE *fopen (); /* file open function */ printf ( "This is the Blast e-mail response output parsing program.\n\n" ); /* Open the commands file. */ results.data = fopen ( "results", "w" ); /* Open the repeat list for FATAL: errors. */ repeat.data = fopen ( "repeat", "w" ); /* Open debug trace file. */ trace.data = fopen ( "trace", "w" ); /* Prompt for the input file name. */ prompt_file ( &fof, "What is the list of sequences file name?" ); /* Process the sequences. */ while ( fof.eof != TRUE ) { /* Open the sequence output file. */ strcpy ( in.name, fof.line ); in.name [ stridx ( in.name, "\n" ) ] = '\0'; /* Open the DNA sequence file for reading. */ open_text_file ( &in ); /* Process the BLAST results file. */ if ( fof.eof != TRUE ) process_blast ( &in, &results, &repeat, &trace ); /* Get the next file name. */ get_line ( &fof ); /* Close the BLAST results file. */ fclose ( in.data ); } /* while */ /* Close the commands file. */ fclose ( fof.data ); fclose ( results.data ); fclose ( repeat.data ); fclose ( trace.data ); printf ( "\nEnd of program.\n" ); } /* main */
main () { t_text retrieve; /* NCBI retrieve mail file */ t_text sequence; /* retrieved sequence */ FILE *fopen (); /* file open function */ printf ( "This is the SWISS SPLIT program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &retrieve, "What is the retrieve file name?" ); /* Process the retrieved sequences. */ while ( retrieve.eof != TRUE ) { /* Find the document line. */ while ( ( retrieve.line [ 0 ] != '>' ) && ( retrieve.eof != TRUE ) ) get_line ( &retrieve ); /* Get the first line of the document. */ get_line ( &retrieve ); /* Get the LOCUS name. */ get_token ( &retrieve ); /* Open the sequence output file. */ strcpy ( sequence.name, retrieve.token ); sequence.data = fopen ( sequence.name, "w" ); if ( retrieve.eof != TRUE ) printf ( "Writing '%s'\n", sequence.name ); /* Copy the sequence file. */ while ( ( sequence.data != NULL ) && ( retrieve.eof != TRUE ) && ( retrieve.line [ 0 ] != '>' ) ) { fprintf ( sequence.data, "%s", retrieve.line ); get_line ( &retrieve ); } /* while */ fclose ( sequence.data ); } /* while */ printf ( "\nEnd of SWISS SPLIT program.\n" ); } /* main */
bool MenuInstanceData::Open() { Close(); // Open up the main data file unique_ptr<File> menu_file(new File(create_menu_filename("mnu"))); if (!menu_file->Open(File::modeBinary | File::modeReadOnly, File::shareDenyNone)) { // Unable to open menu MenuSysopLog("Unable to open Menu"); return false; } // Read the header (control) record into memory menu_file->Seek(0L, File::seekBegin); menu_file->Read(&header, sizeof(MenuHeader)); // Version numbers can be checked here. if (!CreateMenuMap(menu_file.get())) { MenuSysopLog("Unable to create menu index."); return false; } if (!CheckMenuSecurity(&header, true)) { MenuSysopLog("< Menu Sec"); return false; } // Open/Rease/Close Prompt file. We use binary mode since we want the // \r to remain on windows (and linux). TextFile prompt_file(create_menu_filename("pro"), "rb"); if (prompt_file.IsOpen()) { string tmp = prompt_file.ReadFileIntoString(); string::size_type end = tmp.find(".end."); if (end != string::npos) { prompt = tmp.substr(0, end); } else { prompt = tmp; } } // Execute command to use on entering the menu (if any). if (header.szScript[0]) { InterpretCommand(this, header.szScript); } return true; }
main () { t_text cmds; /* Unix shell commands file */ t_text fof; /* file of file names file */ FILE *fopen (); /* file open function */ int index; char name [ MAX_LINE ]; /* list file name */ char name2 [ MAX_LINE ]; /* file name suffix */ printf ( "This is the Script program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &fof, "What is the name of the list of file names?" ); d_strcpy ( cmds.name, "cmds" ); cmds.data = fopen ( "cmds", "w" ); fprintf ( cmds.data, "mkdir fsts\n" ); fprintf ( cmds.data, "echo Making directory fsts for results\n" ); /* Process the names. */ while ( fof.eof != TRUE ) { d_strcpy ( name, fof.line ); if ( name [ d_stridx ( name, "\n" ) ] == '\n' ) name [ d_stridx ( name, "\n" ) ] = '\0'; fprintf ( cmds.data, "dc_template_rt -priority 9 -query %s -template ", name ); fprintf ( cmds.data, "fst_aa_na -mach hermes > fsts/%s.fst\n", name ); /* Get the next name. */ get_line ( &fof ); } /* while */ fclose ( cmds.data ); fclose ( fof.data ); } /* main */
main () { t_text cmds; /* Unix shell commands file */ t_text fof; /* file of file names file */ FILE *fopen (); /* file open function */ int index; char name [ MAX_LINE ]; /* list file name */ char name2 [ MAX_LINE ]; /* file name suffix */ printf ( "This is the GENSCAN mail Script program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &fof, "What is the name of the list of file names?" ); strcpy ( cmds.name, "cmds" ); cmds.data = fopen ( "cmds", "w" ); /* Process the names. */ while ( fof.eof != TRUE ) { strcpy ( name, fof.line ); name [ stridx ( name, "\n" ) ] = '\0'; if ( ( fof.eof != TRUE ) && ( cmds.data != NULL ) ) { fprintf ( cmds.data, "mail [email protected] < %s\n", name ); fprintf ( cmds.data, "echo Sending %s\n", name ); fprintf ( cmds.data, "sleep 300\n" ); fprintf ( cmds.data, "\n" ); } /* if */ /* Get the next name. */ get_line ( &fof ); } /* while */ fclose ( cmds.data ); } /* main */
main () { long end; /* end of DNA sequence segment */ t_text in; /* input DNA sequence file */ long index; /* line index */ t_text trapped; /* trapped exons sequence file */ t_seq seq; /* DNA sequence */ t_text sequence; /* trapped exon sequence */ long start; /* start of DNA sequence segment */ int version; /* DNA segment number */ char version_str [ MAX_LINE ]; /* ascii version number */ FILE *fopen (); /* file open function */ printf ( "This is the Sequence files --> DNA sequence program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &trapped, "What is the list of sequences file name?" ); /* Process the sequences. */ while ( trapped.eof != TRUE ) { /* Open the sequence output file. */ strcpy ( in.name, trapped.line ); in.name [ stridx ( in.name, "\n" ) ] = '\0'; /* Open the DNA sequence file for reading. */ open_text_file ( &in ); /* Read in the DNA sequence. */ read_DNA_seq ( &in, &seq ); fclose ( in.data ); /* printf ( "DNA length = %d\n", seq.total ); */ version = 0; start = 0; end = 999; trapped.line [ stridx ( trapped.line, "\n" ) ] = '\0'; /* Segment the DNA sequence in blocks of 1000 bp. */ while ( start + MIN_SEQ < seq.total ) { /* Truncate source name at first period. */ strcpy ( sequence.name, trapped.line ); sequence.name [ stridx ( sequence.name, "." ) ] = '\0'; strcat ( sequence.name, "." ); itoa ( version, version_str ); strcat ( sequence.name, version_str ); sequence.data = fopen ( sequence.name, "w" ); if ( ( trapped.eof != TRUE ) && ( sequence.data != NULL ) ) { /* Check for end of sequence. */ if ( end > seq.total ) end = seq.total; /* Write out the DNA sequence. */ write_DNA_seq ( &seq, start, end, &sequence ); fclose ( sequence.data ); version++; start += 1000; end += 1000; } /* if */ } /* while */ /* Get the trapped exon name and sequence. */ get_line ( &trapped ); } /* while */ } /* main */
main () { int count; /* bases printed */ long index; /* line index */ t_text trapped; /* trapped exons sequence file */ t_text sequence; /* trapped exon sequence */ FILE *fopen (); /* file open function */ printf ( "This is the Trapped_Exons->files program.\n\n" ); /* Prompt for the input file name. */ prompt_file ( &trapped, "What is the Trapped Exons file name?" ); /* Process the sequences. */ while ( trapped.eof != TRUE ) { /* Open the sequence output file. */ strcpy ( sequence.name, trapped.token ); if ( strlen ( sequence.name ) < 2 ) sequence.data = NULL; else sequence.data = fopen ( sequence.name, "w" ); if ( ( trapped.eof != TRUE ) && ( sequence.data != NULL ) ) { printf ( "%s\n", sequence.name ); /* Check for newline separator. */ if ( strlen ( trapped.line ) <= 10 ) get_line ( &trapped ); get_line ( &trapped ); /* Copy the sequence file. */ count = 0; for ( index = 0; (index < MAX_LINE) && (trapped.line [ index ] != '\0'); index++ ) { if ( ( trapped.line [ index ] != '\t' ) && ( trapped.line [ index ] != ' ' ) ) { fprintf ( sequence.data, "%c", trapped.line [ index ] ); count++; } /* if */ if ( ( ( count % 50 ) == 0 ) && ( count > 1 ) ) { fprintf ( sequence.data, "\n" ); count = 0; } /* if */ } /* for */ fprintf ( sequence.data, "\n" ); fclose ( sequence.data ); } /* if */ /* Get the trapped exon name and sequence. */ get_line ( &trapped ); } /* while */ printf ( "\nEnd of Trapped Exons->files program.\n" ); } /* main */