|
TestgpSeqConverter.cppGo to the documentation of this file.00001 #include "gn/gnSequence.h" 00002 #include "gn/gnFASSource.h" 00003 #include "gn/gnGBKSource.h" 00004 #include <iostream> 00005 #include <string> 00006 #include "gn/gnTranslator.h" 00007 #include "gn/gnDebug.h" 00008 #include "gn/gnDNASequence.h" 00009 #include "gn/gnDebug.h" 00010 00011 void runTests(gnSequence& seq); 00012 void runTests(gnSequence& seq){ 00013 cout << "Testing with sequence:\n"; 00014 cout << seq << endl; 00015 00016 seq.setReverseComplement(true); 00017 cout << "Reverse Complement:\n"; 00018 cout << seq << endl; 00019 00020 seq.setReverseComplement(false); 00021 cout << "Forward sequence:\n"; 00022 cout << seq << endl; 00023 00024 seq.setFilter(gnTranslator::DNAProteinTranslator); 00025 cout << "Translated to protein sequence:\n"; 00026 cout << seq << endl; 00027 00028 seq.setReverseComplement(true); 00029 cout << "Reverse complement translated to protein sequence:\n"; 00030 cout << seq << endl; 00031 00032 list<const gnBaseFilter*> filter_list; 00033 filter_list.push_back(gnTranslator::DNAProteinTranslator); 00034 filter_list.push_back(gnTranslator::ProteinDNATranslator); 00035 seq.setFilterList(filter_list); 00036 cout << "Reverse Comp translated to protein sequence and back to dna:\n"; 00037 cout << seq << endl; 00038 }; 00039 00040 int main(int argc, char* argv[]){ 00041 00042 gnDNASequence seq = "ACGTTAGCGTAT"; 00043 gnDNASequence seq2 = "A"; 00044 seq2 += "CG"; 00045 seq2 += "TTA"; 00046 seq2 += "GCGT"; 00047 seq2 += "AT"; 00048 string blah; 00049 DebugMsg("Hello World.\n"); 00050 runTests(seq); 00051 cout << "And now for the same thing with the same sequence.\n"; 00052 cin >> blah; 00053 runTests(seq2); 00054 cin >> blah; 00055 00056 do{ 00057 cout << "Finally, enter a sequence file to play with: "; 00058 cin >> blah; 00059 }while(!seq.LoadSource(blah)); 00060 seq.setFilter(NULL); 00061 gnFASSource::Write(seq, "test_rc.fas"); 00062 gnGBKSource::Write(seq, "test_rc.gbk"); 00063 00064 return 0; 00065 } Generated at Fri Nov 30 15:36:52 2001 for libGenome by 1.2.8.1 written by Dimitri van Heesch, © 1997-2001 |