]> git.donarmstrong.com Git - mothur.git/blob - chimeraslayercommand.h
2c6fec8d8d1082ea270f5e2c2a8832a7b57033a4
[mothur.git] / chimeraslayercommand.h
1 #ifndef CHIMERASLAYERCOMMAND_H
2 #define CHIMERASLAYERCOMMAND_H
3
4 /*
5  *  chimeraslayercommand.h
6  *  Mothur
7  *
8  *  Created by westcott on 3/31/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14 #include "command.hpp"
15 #include "chimera.h"
16 #include "chimeraslayer.h"
17 #include "sequenceparser.h"
18
19 /***********************************************************/
20
21 class ChimeraSlayerCommand : public Command {
22 public:
23         ChimeraSlayerCommand(string);
24         ChimeraSlayerCommand();
25         ~ChimeraSlayerCommand() {}
26         
27         vector<string> setParameters();
28         string getCommandName()                 { return "chimera.slayer";              }
29         string getCommandCategory()             { return "Sequence Processing"; }
30         string getHelpString(); 
31         string getCitation() { return "Haas BJ, Gevers D, Earl A, Feldgarden M, Ward DV, Giannokous G, Ciulla D, Tabbaa D, Highlander SK, Sodergren E, Methe B, Desantis TZ, Petrosino JF, Knight R, Birren BW (2011). Chimeric 16S rRNA sequence formation and detection in Sanger and 454-pyrosequenced PCR amplicons. Genome Res. \nhttp://www.mothur.org/wiki/Chimera.slayer"; }
32         string getDescription()         { return "detect chimeric sequences"; }
33         
34         int execute(); 
35         void help() { m->mothurOut(getHelpString()); }          
36         
37 private:
38
39         struct linePair {
40                 unsigned long long start;
41                 unsigned long long end;
42                 linePair(unsigned long long i, unsigned long long j) : start(i), end(j) {}
43         };
44
45         vector<int> processIDS;   //processid
46         vector<linePair> lines;
47         
48         int driver(linePair, string, string, string, string, map<string, int>&);
49         int createProcesses(string, string, string, string, map<string, int>&);
50         int divideInHalf(Sequence, string&, string&);
51         map<string, int> sortFastaFile(string, string);
52         map<string, int> sortFastaFile(vector<Sequence>&, map<string, string>&, string newFile);
53         string getNamesFile(string&);
54         //int setupChimera(string,);
55         int MPIExecute(string, string, string, string, map<string, int>&);
56         int deconvoluteResults(SequenceParser*, string, string, string);
57         map<string, int> priority;
58         int setUpForSelfReference(SequenceParser*&, map<string, string>&, map<string, map<string, int> >&, int);
59         int driverGroups(string, string, string, map<string, map<string, int> >&, map<string, string>&);
60         int createProcessesGroups(string, string, string, map<string, map<string, int> >&, map<string, string>&);
61         int MPIExecuteGroups(string, string, string, map<string, map<string, int> >&, map<string, string>&);
62
63                 
64         #ifdef USE_MPI
65         int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, MPI_File&, vector<unsigned long long>&, string, map<string, int>&, bool);
66         #endif
67
68         bool abort, realign, trim, trimera, save;
69         string fastafile, groupfile, templatefile, outputDir, search, namefile, blastlocation;
70         int processors, window, iters, increment, numwanted, ksize, match, mismatch, parents, minSimilarity, minCoverage, minBS, minSNP, numSeqs, templateSeqsLength;
71         float divR;
72         
73         vector<string> outputNames;
74         vector<string> fastaFileNames;
75         vector<string> nameFileNames;
76         vector<string> groupFileNames;
77         
78 };
79
80 /***********************************************************/
81
82 //custom data structure for threads to use.
83 // This is passed by void pointer so it can be any data type
84 // that can be passed using a single void pointer (LPVOID).
85 struct slayerData {
86         string outputFName; 
87         string fasta; 
88         string accnos;
89         string filename;
90         string templatefile;
91         string search;
92         string blastlocation;
93         bool trimera;
94         bool trim, realign;
95         unsigned long long start;
96         unsigned long long end;
97         int ksize, match, mismatch, window, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted;
98         MothurOut* m;
99         float divR;
100         map<string, int> priority;
101         int count;
102         int numNoParents;
103         int threadId;
104         map<string, map<string, int> > fileToPriority;
105         map<string, string> fileGroup;
106         
107         slayerData(){}
108         slayerData(string o, string fa, string ac, string f, string te, string se, string bl, bool tri, bool trm, bool re, MothurOut* mout, unsigned long long st, unsigned long long en, int ks, int ma, int mis, int win, int minS, int minC, int miBS, int minSN, int par, int it, int inc, int numw, float div, map<string, int> prior, int tid) {
109                 outputFName = o;
110                 fasta = fa;
111                 accnos = ac;
112                 filename = f;
113                 templatefile = te;
114                 search = se;
115                 blastlocation = bl;
116                 trimera = tri;
117                 trim = trm;
118                 realign = re;
119                 m = mout;
120                 start = st;
121                 end = en;
122                 ksize = ks;
123                 match = ma; 
124                 mismatch = mis;
125                 window = win;
126                 minSimilarity = minS;
127                 minCoverage = minC;
128                 minBS = miBS;
129                 minSNP = minSN;
130                 parents = par;
131                 iters = it;
132                 increment = inc;
133                 numwanted = numw;
134                 divR = div;
135                 priority = prior;
136                 threadId = tid;
137                 count = 0;
138                 numNoParents = 0;
139         }
140         slayerData(string o, string fa, string ac, string te, string se, string bl, bool tri, bool trm, bool re, MothurOut* mout, map<string, map<string, int> >& fPriority, map<string, string>& fileG, int ks, int ma, int mis, int win, int minS, int minC, int miBS, int minSN, int par, int it, int inc, int numw, float div, map<string, int> prior, int tid) {
141                 outputFName = o;
142                 fasta = fa;
143                 accnos = ac;
144                 templatefile = te;
145                 search = se;
146                 blastlocation = bl;
147                 trimera = tri;
148                 trim = trm;
149                 realign = re;
150                 m = mout;
151                 fileGroup = fileG;
152                 fileToPriority = fPriority;
153                 ksize = ks;
154                 match = ma; 
155                 mismatch = mis;
156                 window = win;
157                 minSimilarity = minS;
158                 minCoverage = minC;
159                 minBS = miBS;
160                 minSNP = minSN;
161                 parents = par;
162                 iters = it;
163                 increment = inc;
164                 numwanted = numw;
165                 divR = div;
166                 priority = prior;
167                 threadId = tid;
168                 count = 0;
169                 numNoParents = 0;
170         }
171         
172 };
173
174 /**************************************************************************************************/
175 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
176 #else
177 static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){ 
178         slayerData* pDataArray;
179         pDataArray = (slayerData*)lpParam;
180         
181         try {
182                 ofstream out;
183                 pDataArray->m->openOutputFile(pDataArray->outputFName, out);
184                 
185                 ofstream out2;
186                 pDataArray->m->openOutputFile(pDataArray->accnos, out2);
187                 
188                 ofstream out3;
189                 if (pDataArray->trim) {  pDataArray->m->openOutputFile(pDataArray->fasta, out3); }
190                 
191                 ifstream inFASTA;
192                 pDataArray->m->openInputFile(pDataArray->filename, inFASTA);
193                 
194                 
195                 
196                 Chimera* chimera;
197                 if (pDataArray->templatefile != "self") { //you want to run slayer with a reference template
198                         chimera = new ChimeraSlayer(pDataArray->filename, pDataArray->templatefile, pDataArray->trim, pDataArray->search, pDataArray->ksize, pDataArray->match, pDataArray->mismatch, pDataArray->window, pDataArray->divR, pDataArray->minSimilarity, pDataArray->minCoverage, pDataArray->minBS, pDataArray->minSNP, pDataArray->parents, pDataArray->iters, pDataArray->increment, pDataArray->numwanted, pDataArray->realign, pDataArray->blastlocation, pDataArray->threadId);     
199                 }else {
200                         chimera = new ChimeraSlayer(pDataArray->filename, pDataArray->templatefile, pDataArray->trim, pDataArray->priority, pDataArray->search, pDataArray->ksize, pDataArray->match, pDataArray->mismatch, pDataArray->window, pDataArray->divR, pDataArray->minSimilarity, pDataArray->minCoverage, pDataArray->minBS, pDataArray->minSNP, pDataArray->parents, pDataArray->iters, pDataArray->increment, pDataArray->numwanted, pDataArray->realign, pDataArray->blastlocation, pDataArray->threadId);       
201                 }
202                 
203                 //print header if you are process 0
204                 if ((pDataArray->start == 0) || (pDataArray->start == 1)) {
205                         chimera->printHeader(out); 
206                         inFASTA.seekg(0);
207                 }else { //this accounts for the difference in line endings. 
208                         inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); 
209                 }
210                 
211                 pDataArray->count = pDataArray->end;
212                 
213                 if (pDataArray->m->control_pressed) { out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera;  return 0;    }
214                 
215                 if (chimera->getUnaligned()) { 
216                         pDataArray->m->mothurOut("Your template sequences are different lengths, please correct."); pDataArray->m->mothurOutEndLine(); 
217                         out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close();
218                         delete chimera;
219                         return 0; 
220                 }
221                 int templateSeqsLength = chimera->getLength();
222                 
223                 if (pDataArray->start == 0) { chimera->printHeader(out); }
224                 
225                 int count = 0;
226                 for(int i = 0; i < pDataArray->end; i++){
227                         
228                         if (pDataArray->m->control_pressed) {   out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera; return 1;   }
229                         
230                         Sequence* candidateSeq = new Sequence(inFASTA);  pDataArray->m->gobble(inFASTA);
231                         string candidateAligned = candidateSeq->getAligned();
232                         
233                         if (candidateSeq->getName() != "") { //incase there is a commented sequence at the end of a file
234                                 if (candidateSeq->getAligned().length() != templateSeqsLength) {  
235                                         pDataArray->m->mothurOut(candidateSeq->getName() + " is not the same length as the template sequences. Skipping."); pDataArray->m->mothurOutEndLine();
236                                 }else{
237                                         //find chimeras
238                                         chimera->getChimeras(candidateSeq);
239                                         
240                                         if (pDataArray->m->control_pressed) {   delete candidateSeq; delete chimera; return 1;  }
241                                         
242                                         //if you are not chimeric, then check each half
243                                         data_results wholeResults = chimera->getResults();
244                                         
245                                         //determine if we need to split
246                                         bool isChimeric = false;
247                                         
248                                         if (wholeResults.flag == "yes") {
249                                                 string chimeraFlag = "no";
250                                                 if(  (wholeResults.results[0].bsa >= pDataArray->minBS && wholeResults.results[0].divr_qla_qrb >= pDataArray->divR)
251                                                    ||
252                                                    (wholeResults.results[0].bsb >= pDataArray->minBS && wholeResults.results[0].divr_qlb_qra >= pDataArray->divR) ) { chimeraFlag = "yes"; }
253                                                 
254                                                 
255                                                 if (chimeraFlag == "yes") {     
256                                                         if ((wholeResults.results[0].bsa >= pDataArray->minBS) || (wholeResults.results[0].bsb >= pDataArray->minBS)) { isChimeric = true; }
257                                                 }
258                                         }
259                                         
260                                         if ((!isChimeric) && pDataArray->trimera) {
261                                                 
262                                                 //split sequence in half by bases
263                                                 string leftQuery, rightQuery;
264                                                 Sequence tempSeq(candidateSeq->getName(), candidateAligned);
265                                                 //divideInHalf(tempSeq, leftQuery, rightQuery);
266                                                 string queryUnAligned = tempSeq.getUnaligned();
267                                                 int numBases = int(queryUnAligned.length() * 0.5);
268                                                 
269                                                 string queryAligned = tempSeq.getAligned();
270                                                 leftQuery = tempSeq.getAligned();
271                                                 rightQuery = tempSeq.getAligned();
272                                                 
273                                                 int baseCount = 0;
274                                                 int leftSpot = 0;
275                                                 for (int i = 0; i < queryAligned.length(); i++) {
276                                                         //if you are a base
277                                                         if (isalpha(queryAligned[i])) {         
278                                                                 baseCount++; 
279                                                         }
280                                                         
281                                                         //if you have half
282                                                         if (baseCount >= numBases) {  leftSpot = i; break; } //first half
283                                                 }
284                                                 
285                                                 //blank out right side
286                                                 for (int i = leftSpot; i < leftQuery.length(); i++) { leftQuery[i] = '.'; }
287                                                 
288                                                 //blank out left side
289                                                 for (int i = 0; i < leftSpot; i++) { rightQuery[i] = '.'; }
290                                                 
291                                                 //run chimeraSlayer on each piece
292                                                 Sequence* left = new Sequence(candidateSeq->getName(), leftQuery);
293                                                 Sequence* right = new Sequence(candidateSeq->getName(), rightQuery);
294                                                 
295                                                 //find chimeras
296                                                 chimera->getChimeras(left);
297                                                 data_results leftResults = chimera->getResults();
298                                                 
299                                                 chimera->getChimeras(right);
300                                                 data_results rightResults = chimera->getResults();
301                                                 
302                                                 //if either piece is chimeric then report
303                                                 Sequence trimmed = chimera->print(out, out2, leftResults, rightResults);
304                                                 if (pDataArray->trim) { trimmed.printSequence(out3);  }
305                                                 
306                                                 delete left; delete right;
307                                                 
308                                         }else { //already chimeric
309                                                 //print results
310                                                 Sequence trimmed = chimera->print(out, out2);
311                                                 if (pDataArray->trim) { trimmed.printSequence(out3);  }
312                                         }
313                                         
314                                         
315                                 }
316                                 count++;
317                         }
318                         
319                         delete candidateSeq;
320                         //report progress
321                         if((count) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
322                 }
323                 //report progress
324                 if((count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
325                 
326                 pDataArray->numNoParents = chimera->getNumNoParents();
327                 if (pDataArray->numNoParents == count) {        pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); }
328
329                 out.close();
330                 out2.close();
331                 if (pDataArray->trim) { out3.close(); }
332                 inFASTA.close();
333                 delete chimera;
334                 
335                 return 0;
336                 
337         }
338         catch(exception& e) {
339                 pDataArray->m->errorOut(e, "ChimeraSlayerCommand", "MySlayerThreadFunction");
340                 exit(1);
341         }
342
343
344 /**************************************************************************************************/
345
346 static DWORD WINAPI MySlayerGroupThreadFunction(LPVOID lpParam){ 
347         slayerData* pDataArray;
348         pDataArray = (slayerData*)lpParam;
349         
350         try {
351                 
352                 int totalSeqs = 0;
353                 
354                 for (map<string, map<string, int> >::iterator itFile = pDataArray->fileToPriority.begin(); itFile != pDataArray->fileToPriority.end(); itFile++) {
355                         
356                         if (pDataArray->m->control_pressed) {  return 0;  }
357                         
358                         int start = time(NULL);
359                         string thisFastaName = itFile->first;
360                         map<string, int> thisPriority = itFile->second;
361                         string thisoutputFileName = pDataArray->m->getRootName(pDataArray->m->getSimpleName(thisFastaName)) + pDataArray->fileGroup[thisFastaName] + "slayer.chimera";
362                         string thisaccnosFileName = pDataArray->m->getRootName(pDataArray->m->getSimpleName(thisFastaName)) + pDataArray->fileGroup[thisFastaName] + "slayer.accnos";
363                         string thistrimFastaFileName = pDataArray->m->getRootName(pDataArray->m->getSimpleName(thisFastaName)) + pDataArray->fileGroup[thisFastaName] + "slayer.fasta";
364                         
365                         pDataArray->m->mothurOutEndLine(); pDataArray->m->mothurOut("Checking sequences from group: " + pDataArray->fileGroup[thisFastaName] + "."); pDataArray->m->mothurOutEndLine(); 
366                 
367                         //int numSeqs = driver(lines[0], thisoutputFileName, thisFastaName, thisaccnosFileName, thistrimFastaFileName, thisPriority);
368                         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
369                         
370                         ofstream out;
371                         pDataArray->m->openOutputFile(thisoutputFileName, out);
372                         
373                         ofstream out2;
374                         pDataArray->m->openOutputFile(thisaccnosFileName, out2);
375                         
376                         ofstream out3;
377                         if (pDataArray->trim) {  pDataArray->m->openOutputFile(thistrimFastaFileName, out3); }
378                         
379                         ifstream inFASTA;
380                         pDataArray->m->openInputFile(thisFastaName, inFASTA);
381                         
382                         Chimera* chimera;
383                         chimera = new ChimeraSlayer(thisFastaName, pDataArray->templatefile, pDataArray->trim, thisPriority, pDataArray->search, pDataArray->ksize, pDataArray->match, pDataArray->mismatch, pDataArray->window, pDataArray->divR, pDataArray->minSimilarity, pDataArray->minCoverage, pDataArray->minBS, pDataArray->minSNP, pDataArray->parents, pDataArray->iters, pDataArray->increment, pDataArray->numwanted, pDataArray->realign, pDataArray->blastlocation, pDataArray->threadId);      
384                         chimera->printHeader(out); 
385                         
386                         int numSeqs = 0;
387                         
388                         if (pDataArray->m->control_pressed) { out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera;  return 0;    }
389                         
390                         if (chimera->getUnaligned()) { 
391                                 pDataArray->m->mothurOut("Your template sequences are different lengths, please correct."); pDataArray->m->mothurOutEndLine(); 
392                                 out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close();
393                                 delete chimera;
394                                 return 0; 
395                         }
396                         int templateSeqsLength = chimera->getLength();
397                         
398                         bool done = false;
399                         while (!done) {
400                                 
401                                 if (pDataArray->m->control_pressed) {   out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera; return 1;   }
402                                 
403                                 Sequence* candidateSeq = new Sequence(inFASTA);  pDataArray->m->gobble(inFASTA);
404                                 string candidateAligned = candidateSeq->getAligned();
405                                 
406                                 if (candidateSeq->getName() != "") { //incase there is a commented sequence at the end of a file
407                                         if (candidateSeq->getAligned().length() != templateSeqsLength) {  
408                                                 pDataArray->m->mothurOut(candidateSeq->getName() + " is not the same length as the template sequences. Skipping."); pDataArray->m->mothurOutEndLine();
409                                         }else{
410                                                 //find chimeras
411                                                 chimera->getChimeras(candidateSeq);
412                                                 
413                                                 if (pDataArray->m->control_pressed) {   out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete candidateSeq; delete chimera; return 1;      }
414                                                 
415                                                 //if you are not chimeric, then check each half
416                                                 data_results wholeResults = chimera->getResults();
417                                                 
418                                                 //determine if we need to split
419                                                 bool isChimeric = false;
420                                                 
421                                                 if (wholeResults.flag == "yes") {
422                                                         string chimeraFlag = "no";
423                                                         if(  (wholeResults.results[0].bsa >= pDataArray->minBS && wholeResults.results[0].divr_qla_qrb >= pDataArray->divR)
424                                                            ||
425                                                            (wholeResults.results[0].bsb >= pDataArray->minBS && wholeResults.results[0].divr_qlb_qra >= pDataArray->divR) ) { chimeraFlag = "yes"; }
426                                                         
427                                                         
428                                                         if (chimeraFlag == "yes") {     
429                                                                 if ((wholeResults.results[0].bsa >= pDataArray->minBS) || (wholeResults.results[0].bsb >= pDataArray->minBS)) { isChimeric = true; }
430                                                         }
431                                                 }
432                                                 
433                                                 if ((!isChimeric) && pDataArray->trimera) {
434                                                         
435                                                         //split sequence in half by bases
436                                                         string leftQuery, rightQuery;
437                                                         Sequence tempSeq(candidateSeq->getName(), candidateAligned);
438                                                         //divideInHalf(tempSeq, leftQuery, rightQuery);
439                                                         string queryUnAligned = tempSeq.getUnaligned();
440                                                         int numBases = int(queryUnAligned.length() * 0.5);
441                                                         
442                                                         string queryAligned = tempSeq.getAligned();
443                                                         leftQuery = tempSeq.getAligned();
444                                                         rightQuery = tempSeq.getAligned();
445                                                         
446                                                         int baseCount = 0;
447                                                         int leftSpot = 0;
448                                                         for (int i = 0; i < queryAligned.length(); i++) {
449                                                                 //if you are a base
450                                                                 if (isalpha(queryAligned[i])) {         
451                                                                         baseCount++; 
452                                                                 }
453                                                                 
454                                                                 //if you have half
455                                                                 if (baseCount >= numBases) {  leftSpot = i; break; } //first half
456                                                         }
457                                                         
458                                                         //blank out right side
459                                                         for (int i = leftSpot; i < leftQuery.length(); i++) { leftQuery[i] = '.'; }
460                                                         
461                                                         //blank out left side
462                                                         for (int i = 0; i < leftSpot; i++) { rightQuery[i] = '.'; }
463                                                         
464                                                         //run chimeraSlayer on each piece
465                                                         Sequence* left = new Sequence(candidateSeq->getName(), leftQuery);
466                                                         Sequence* right = new Sequence(candidateSeq->getName(), rightQuery);
467                                                         
468                                                         //find chimeras
469                                                         chimera->getChimeras(left);
470                                                         data_results leftResults = chimera->getResults();
471                                                         
472                                                         chimera->getChimeras(right);
473                                                         data_results rightResults = chimera->getResults();
474                                                         
475                                                         //if either piece is chimeric then report
476                                                         Sequence trimmed = chimera->print(out, out2, leftResults, rightResults);
477                                                         if (pDataArray->trim) { trimmed.printSequence(out3);  }
478                                                         
479                                                         delete left; delete right;
480                                                         
481                                                 }else { //already chimeric
482                                                         //print results
483                                                         Sequence trimmed = chimera->print(out, out2);
484                                                         if (pDataArray->trim) { trimmed.printSequence(out3);  }
485                                                 }
486                                                 
487                                                 
488                                         }
489                                         numSeqs++;
490                                 }
491                                 
492                                 delete candidateSeq;
493                                 
494                                 if (inFASTA.eof()) { break; }
495                                 
496                                 //report progress
497                                 if((numSeqs) % 100 == 0){       pDataArray->m->mothurOut("Processing sequence: " + toString(numSeqs)); pDataArray->m->mothurOutEndLine();               }
498                         }
499                         //report progress
500                         if((numSeqs) % 100 != 0){       pDataArray->m->mothurOut("Processing sequence: " + toString(numSeqs)); pDataArray->m->mothurOutEndLine();               }
501                         
502                         pDataArray->numNoParents = chimera->getNumNoParents();
503                         if (pDataArray->numNoParents == numSeqs) {      pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); }
504                         
505                         out.close();
506                         out2.close();
507                         if (pDataArray->trim) { out3.close(); }
508                         inFASTA.close();
509                         delete chimera;
510                         
511                         
512                         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
513                         
514                         //append files
515                         pDataArray->m->appendFiles(thisoutputFileName, pDataArray->outputFName); pDataArray->m->mothurRemove(thisoutputFileName); 
516                         pDataArray->m->appendFiles(thisaccnosFileName, pDataArray->accnos); pDataArray->m->mothurRemove(thisaccnosFileName);
517                         if (pDataArray->trim) { pDataArray->m->appendFiles(thistrimFastaFileName, pDataArray->fasta); pDataArray->m->mothurRemove(thistrimFastaFileName); }
518                         pDataArray->m->mothurRemove(thisFastaName);
519                         
520                         totalSeqs += numSeqs;
521                         
522                         pDataArray->m->mothurOutEndLine(); pDataArray->m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences from group " + pDataArray->fileGroup[thisFastaName] + "."); pDataArray->m->mothurOutEndLine();
523                 }
524                 
525                 pDataArray->count = totalSeqs;
526                 
527                 return 0;
528                 
529         }
530         catch(exception& e) {
531                 pDataArray->m->errorOut(e, "ChimeraSlayerCommand", "MySlayerGroupThreadFunction");
532                 exit(1);
533         }
534
535
536 #endif
537
538 /**************************************************************************************************/
539
540
541 #endif
542
543