00001 #include "gnSequence.h" 00002 #include "gnFASSource.h" 00003 #include <string> 00004 #include <iostream> 00005 00006 const uint32 SURROUND_BASES = 100; 00007 00008 int main(int argc, char* argv[]){ 00009 00010 gnSequence sequence("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); 00011 sequence.append("GGGGGGGGGGG"); 00012 00013 cout << sequence; 00014 char* dumbo; 00015 cin >> dumbo; 00016 00017 00018 /* gnSequence sequence, output_seq; 00019 string seq_filename; 00020 string restriction_filename; 00021 string output_filename; 00022 fstream restriction_file; 00023 fstream output_file; 00024 00025 do{ 00026 cout << "Enter the name of the restriction site list:\n"; 00027 cin >> restriction_filename; 00028 restriction_file.open(restriction_filename.c_str(), ios::in); 00029 if(!restriction_file.is_open()) 00030 cout << "Error opening file! Try again.\n"; 00031 }while(!restriction_file.is_open()); 00032 00033 do{ 00034 cout << "Enter the name of the sequence data FastA file:\n"; 00035 cin >> seq_filename; 00036 }while(!sequence.LoadSource(seq_filename)); 00037 00038 do{ 00039 cout << "Enter the name of an output file:\n"; 00040 cin >> output_filename; 00041 output_file.open(output_filename.c_str(), ios::out); 00042 if(!output_file.is_open()) 00043 cout << "Error creating file! Try again.\n"; 00044 }while(!output_file.is_open()); 00045 output_file.close(); 00046 00047 00048 while(restriction_file.good()){ 00049 string bubba; 00050 restriction_file >> bubba; //first four are junk 00051 restriction_file >> bubba; 00052 restriction_file >> bubba; 00053 restriction_file >> bubba; 00054 restriction_file >> bubba; //this contains contig name 00055 00056 gnSequence contig_seq = sequence.contigByName(bubba); 00057 00058 gnSeqI siteI = 0; 00059 restriction_file >> siteI; 00060 00061 char dummy[1000]; 00062 restriction_file.getline(dummy, 999); 00063 00064 //if the restriction site is too close to the beginning, set the start to 0 00065 gnSeqI start_loc = siteI < SURROUND_BASES ? 0 : siteI - SURROUND_BASES; 00066 output_seq += contig_seq.subseq(start_loc, SURROUND_BASES*2); 00067 } 00068 00069 if(gnFASSource::Write(output_seq, output_filename)) 00070 cout << "All done, results are in " << output_filename << "\n"; 00071 else 00072 cout << "An error occurred while writing " << output_filename << "\n"; 00073 */ 00074 }