2 * filterseqscommand.cpp
5 * Created by Thomas Ryabin on 5/4/09.
6 * Copyright 2009 __MyCompanyName__. All rights reserved.
10 #include "filterseqscommand.h"
14 /**************************************************************************************/
15 void FilterSeqsCommand::doTrump() {
16 //trump = globaldata->getTrump();
18 // for(int i = 0; i < db->size(); i++) {
19 // Sequence cur = db->get(i);
20 // string curAligned = cur.getAligned();
22 // for(int j = 0; j < curAligned.length-1; j++) {
23 // string curChar = curAligned.substr(j, j+1);
25 // if(curChar.compare(trump) == 0)
26 // columnsToRemove[j] = true;
31 /**************************************************************************************/
32 void FilterSeqsCommand::doSoft() {
33 //soft = atoi(globaldata->getSoft().c_str());
34 // vector<vector<int> > columnSymbolSums;
35 // vector<vector<string> > columnSymbols;
36 // for(int i = 0; i < db->get(0).getLength(); i++) {
37 // vector<string> symbols;
39 // columnSymbols[i] = symbols;
40 // columnSymbolSums[i] = sums;
43 // for(int i = 0; i < db->size(); i++) {
44 // Sequence cur = db->get(i);
45 // string curAligned = cur.getAligned();
47 // for(int j = 0; j < curAligned.length-1; j++) {
48 // string curChar = curAligned.substr(j, j+1);
49 // vector<string> curColumnSymbols = columnSymbols[j];
51 // bool newSymbol = true;
53 // for(int k = 0; j < curColumnSymbols.size(); j++)
54 // if(curChar.compare(curColumnSymbols[k]) == 0) {
56 // columnSymbolSums[j][k]++;
60 // columnSymbols.push_back(curChar);
61 // columnSymbolSums[j].push_back(1);
66 // for(int i = 0; i < columnSymbolSums.size(); i++) {
69 // vector<int> curColumn = columnSymbolSums[i];
71 // for(int j = 0; j < curColumn.size(); j++) {
72 // int curSum = curColumn[j];
75 // totalSum += curSum;
78 // if((double)max/(double)totalSum * 100 < soft)
79 // columnsToRemove[i] = true;
82 void FilterSeqsCommand::doFilter() {}
83 /**************************************************************************************/
84 int FilterSeqsCommand::execute() {
86 globaldata = GlobalData::getInstance();
87 filename = globaldata->inputFileName;
89 if(globaldata->getFastaFile().compare("") != 0) {
90 readFasta = new ReadFasta(filename);
92 db = readFasta->getDB();
95 else if(globaldata->getNexusFile().compare("") != 0) {
96 readNexus = new ReadNexus(filename);
98 db = readNexus->getDB();
101 else if(globaldata->getClustalFile().compare("") != 0) {
102 readClustal = new ReadClustal(filename);
104 db = readClustal->getDB();
107 else if(globaldata->getPhylipFile().compare("") != 0) {
108 readPhylip = new ReadPhylip(filename);
110 db = readPhylip->getDB();
113 for(int i = 0; i < db->get(0).getLength(); i++)
114 columnsToRemove[i] = false;
117 if(globaldata->getTrump().compare("") != 0) {
123 if(globaldata->getSoft().compare("") != 0) {}
129 //if(globaldata->getFilter().compare("") != 0) {
131 // filter = globaldata->getFilter();
132 // ifstream filehandle;
133 // openInputFile(filter, filehandle);
137 // while(!filehandle.eof()) {
138 // c = filehandle.get();
140 // columnsToRemove[count] = true;
151 catch(exception& e) {
152 cout << "Standard Error: " << e.what() << " has occurred in the DeconvoluteCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
156 cout << "An unknown error has occurred in the DeconvoluteCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
160 /**************************************************************************************/