]> git.donarmstrong.com Git - mothur.git/blob - deconvolutecommand.cpp
fixed memory leak in parsimony calculator and added progress bars to parsimony and...
[mothur.git] / deconvolutecommand.cpp
1 /*
2  *  deconvolute.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 1/21/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "deconvolutecommand.h"
11
12 /**************************************************************************************/
13 int DeconvoluteCommand::execute() {     
14         try {
15                 globaldata = GlobalData::getInstance();
16         
17                 //prepare filenames and open files
18                 filename = globaldata->getFastaFile();
19                 outputFileName = (getRootName(filename) + "names");
20                 outFastafile = (getRootName(filename) + "unique.fasta");
21                 
22                 openInputFile(filename, in);
23                 openOutputFile(outputFileName, out);
24                 openOutputFile(outFastafile, outFasta);
25         
26                 //constructor reads in file and store internally
27                 fastamap = new FastaMap();
28         
29                 //two columns separated by tabs sequence name and then sequence
30                 fastamap->readFastaFile(in);
31                 
32                 //print out new names file 
33                 //file contains 2 columns separated by tabs.  the first column is the groupname(name of first sequence found.
34                 //the second column is the list of names of identical sequences separated by ','.
35                 fastamap->printNamesFile(out);
36                 fastamap->printCondensedFasta(outFasta);
37         
38                 return 0;
39         }
40         catch(exception& e) {
41                 cout << "Standard Error: " << e.what() << " has occurred in the DeconvoluteCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
42                 exit(1);
43         }
44         catch(...) {
45                 cout << "An unknown error has occurred in the DeconvoluteCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
46                 exit(1);
47         }
48 }
49 /**************************************************************************************/