src/test-o-matic.cpp

Go to the documentation of this file.
00001 #include "gn/gnFASSource.h" 00002 #include "gn/gnSequence.h" 00003 #include "gn/gnTranslator.h" 00004 #include "gn/gnStringSpec.h" 00005 #include <fstream> 00006 int main( int argc, char* argv[] ) 00007 { 00008 gnSequence seq_a, seq_b; 00009 string seq_a_name="styphi.fas"; 00010 string seq_b_name="typhi.gbk"; 00011 try{ 00012 seq_a.LoadSource( seq_a_name ); 00013 cout << seq_a_name << '\t' << seq_a.length() << " bp\n"; 00014 seq_b.LoadSource( seq_b_name ); 00015 cout << seq_b_name << '\t' << seq_b.length() << " bp\n"; 00016 }catch(gnException& gne){ 00017 cout << gne << "\n"; 00018 } 00019 00020 uint len = 50; 00021 uint increment = 1027; 00022 const gnCompare* dna_comp = gnCompare::DNASeqCompare(); 00023 for( uint seqI = 1; seqI <= 200000; seqI+= increment ){ 00024 string str_a, str_b; 00025 str_a = seq_a.ToString( len, seqI ); 00026 str_b = seq_b.ToString( len, seqI ); 00027 if( !dna_comp->Contains( str_a, str_b ) ){ 00028 cout << str_a << endl << str_b << endl; 00029 seqI -= increment; 00030 } 00031 } 00032 00033 gnSequence seq_in; 00034 string seq_name = "sequin.gbk"; 00035 string out_seq = "seqout.gbk"; 00036 try{ 00037 seq_in.LoadSource( seq_name ); 00038 cout << seq_name << '\t' << seq_in.length() << " bp\n"; 00039 gnFASSource::Write( seq_in, out_seq ); 00040 }catch(gnException& gne){ 00041 cout << gne << "\n"; 00042 } 00043 /* 00044 gnSequence erwinia_junk; 00045 gnSequence pruned_bush; 00046 string sequence_name = "mouse_small.fas"; 00047 string output_sequence = "mouse_filt.fas"; 00048 // cout << "Enter the name of the sequence file you want contig info on.\n"; 00049 // cin >> sequence_name; 00050 try{ 00051 erwinia_junk.LoadSource( sequence_name ); 00052 for(uint32 contigI = 0; contigI < erwinia_junk.contigListSize(); contigI++){ 00053 cout << erwinia_junk.contigName( contigI ) << '\t' << erwinia_junk.contigLength( contigI ) << '\n'; 00054 if( erwinia_junk.contigLength( contigI ) > 1000 ) 00055 pruned_bush += erwinia_junk.contig( contigI ); 00056 } 00057 gnFASSource::Write(pruned_bush, output_sequence); 00058 }catch(gnException& gne){ 00059 cout << gne << "\n"; 00060 } 00061 */ 00062 /* 00063 ifstream gbk1("cpneuJ.gbk"); 00064 ifstream gbk2("test_rc.gbk"); 00065 00066 uint32 badline = 0; 00067 char buf[30000]; 00068 char buf2[30000]; 00069 while(gbk1.good() && gbk2.good()){ 00070 gbk1.getline(buf, 30000); 00071 gbk2.getline(buf2, 30000); 00072 if(strcmp(buf, buf2)){ 00073 cout << "mismatched line: " << badline << "\n"; 00074 cout << buf << endl << buf2 << endl; 00075 cout << "Length 1: " << strlen(buf) << " Length 2: " << strlen(buf2) << endl; 00076 cin >> buf; 00077 } 00078 badline++; 00079 } 00080 */ 00081 /* gnStringSpec s(""); 00082 cout <<s.GetLength()<<endl; 00083 00084 gnSequence t = "ACTATATA"; 00085 if(t == string("TATATA")){ 00086 cout << "ASDFASDFSADF"; 00087 }*/ 00088 } 00089 /* // define a string to store the sequence file name 00090 00091 string filename; 00092 string nseq,pseq; 00093 // define a gnSequence to store the sequence 00094 gnSequence file_sequence; 00095 gnSequence prot_trans; 00096 00097 //nseq = "BXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXXBXX"; 00098 //nseq = "WSTYYYBBB"; 00099 //nseq="ATGCUXGCNGGGTATGAATEQILPFP"; 00100 //nseq="ATGGTXAGCGGNTAR"; 00101 cout<<nseq<<" (original)----> \n"; 00102 gnSequence aSeq(nseq); 00103 cout<<aSeq<<" (gnSequence)----> \n"; 00104 00105 gnTranslator::ProteinDNAConverter->ToProtein(nseq); 00106 00107 cout << nseq << '\n';; 00108 00109 00110 00111 00112 // prot_trans.append(nseq); 00113 // output the first ten bases of the sequence 00114 // cout << prot_trans.subseq(1,10); 00115 00116 return 0; 00117 00118 } 00119 00120 /*#include "gn/gnSequence.h" 00121 #include <iostream> 00122 #include <string> 00123 #include "gn/gnTranslator.h" 00124 #include "gn/gnFASSource.h" 00125 00126 int main(int argc, char* argv[]){ 00127 gnSequence gps; 00128 string seq_filename; 00129 string out_filename; 00130 00131 /* Get the name of the dnx file to convert to FastA / 00132 cout << "Debug-o-matic!\n"; 00133 cout << "Please give the name of the fof to test: "; 00134 cin >> seq_filename; 00135 00136 gps.LoadSource(seq_filename); 00137 00138 cout << "Output filename: "; 00139 cin >> out_filename; 00140 gnFASSource::Write(gps, out_filename); 00141 00142 return 0; 00143 00144 }*/

Generated on Mon Feb 14 19:28:21 2005 for libGenome by doxygen 1.3.8