Google

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

testgpSequence.cpp

Go to the documentation of this file.
00001 #include "gn/gnSourceFactory.h"
00002 #include "gn/gnFASSource.h"
00003 #include "gn/gnSequence.h"
00004 
00005 #include <iostream>
00006 
00007 #include "gn/gnFilter.h"
00008 #include "gn/gnStringTools.h"
00009 #include "gn/gnFastTranslator.h"
00010 
00011 int main( int32 argc, char* argv[])
00012 {
00013         argc; argv;
00014 try{
00015         string filename;
00016         cout << "Enter a filename to read bases from.\n";
00017         cin >> filename;
00018         cout << "Opening " + filename + "\n";
00019         gnSequence gpseq, gnsubseq;
00020         
00021 //      string pathname = filename;
00022 //      standarizePathString( pathname );
00023 //      pathname = getPathString( pathname );
00024 //      gnSourceFactory * msf = gnSourceFactory::GetSourceFactory();
00025 //      msf->AddPath( pathname );
00026         gpseq.LoadSource(filename);
00027         cout << "Length " << gpseq.length() << " in " << gpseq.contigListSize() << " contigs\n";
00028 
00029         string pretrans, posttrans, posttrans2;
00030         const gnTranslator*  dna2pro_good = gnTranslator::DNAProteinTranslator();
00031         const gnFastTranslator*  dna2pro_fast = gnFastTranslator::DNAProteinTranslator();
00032         pretrans = gpseq.ToString();
00033 
00034         posttrans = pretrans;
00035         posttrans2 = pretrans;
00036         cout << "Doing correct translation:\n";
00037         dna2pro_good->Filter(posttrans);
00038         cout << "done\n";
00039         gnsubseq = posttrans;
00040         gnFASSource::Write(gnsubseq, "profile_good.fas");
00041         
00042 //      posttrans = pretrans;
00043         cout << "Doing fast translation:\n";
00044         dna2pro_fast->Filter(posttrans2);
00045         cout << "done\n";
00046         gnsubseq = posttrans2;
00047         gnFASSource::Write(gnsubseq, "profile_fast.fas");
00048 
00049 
00050         cout << "base pairs 8 thru 68 are: \n";
00051         cout << gpseq.subseq(8, 60) << "\n";
00052 
00053         for(uint32 i=0; i < 15; i++){
00054                 try{
00055                         cout << "Contig " << i << " length " << gpseq.contig(i).length() << "\n";
00056                 }catch(gnException& gne){
00057                         cout << gne;
00058                 }
00059         }
00060         cout << gpseq.subseq(1000000, 10);
00061         cin >> filename;
00062 
00063         gnSeqI midpoint = gpseq.length() / 2;
00064         gnSequence seqA = gpseq.subseq(1, midpoint);
00065         gnSequence seqB = gpseq.subseq(1 + midpoint, gpseq.length() - midpoint);
00066         cout << "Splitting " << gpseq.length() << " to " << seqA.length() << " and " << seqB.length() << "\n";
00067         cin >> filename;
00068 
00069         gnsubseq = gpseq.subseq(5, 10);
00070         cout << "subseq len: " << gnsubseq.length() << "\n";
00071         cout << "subseq: " << gnsubseq << "\n";
00072         gnSeqC* buf = new gnSeqC[gpseq.length()];
00073         gpseq.ToArray(buf, gpseq.length());
00074 
00075         cout << "Give a file name to output data: ";
00076         string outfilename;
00077         cin >> outfilename;
00078         gnFASSource::Write(gpseq, outfilename);
00079         
00080 /*      gnSequence new_seq = gpseq.contig(3);
00081         cout << new_seq;
00082         new_seq += gpseq.contig(3);
00083         new_seq += gpseq.contig(2);
00084         new_seq += gpseq.contig(1);
00085         cout << new_seq;
00086         gnFASSource::Write(new_seq, outfilename);
00087         
00088 */      cout << "All done.  Contigs 3, 2, 1 are in " << outfilename << "\n";
00089         char bubba[50];
00090         cin >> bubba;
00091 }catch(gnException& gne){
00092         cout << gne;
00093         string reality_bites;
00094         cin >> reality_bites;
00095 }
00096 }

Generated at Fri Nov 30 15:36:52 2001 for libGenome by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001