Permalink
Browse files

Adds numSeqs to return values in sequenceParser classes

  • Loading branch information...
1 parent 719e77e commit d10ca55a160321874e2c273ee7918ee8eefcfbce @mothur-westcott mothur-westcott committed Jan 10, 2017
@@ -204,7 +204,7 @@ vector<Sequence> SequenceCountParser::getSeqs(string g){
}
}
/************************************************************/
-int SequenceCountParser::getSeqs(string g, string filename, string tag, string tag2, bool uchimeFormat=false){
+int SequenceCountParser::getSeqs(string g, string filename, string tag, string tag2, long long& numSeqs, bool uchimeFormat=false){
try {
map<string, vector<Sequence> >::iterator it;
vector<Sequence> seqForThisGroup;
@@ -214,11 +214,13 @@ int SequenceCountParser::getSeqs(string g, string filename, string tag, string t
if(it == seqs.end()) {
m->mothurOut("[ERROR]: No sequences available for group " + g + ", please correct."); m->mothurOutEndLine();
}else {
-
+
ofstream out;
m->openOutputFile(filename, out);
seqForThisGroup = it->second;
+
+ numSeqs = seqForThisGroup.size();
if (uchimeFormat) {
// format should look like
@@ -38,7 +38,7 @@ class SequenceCountParser {
vector<Sequence> getSeqs(string); //returns unique sequences in a specific group
map<string, int> getCountTable(string); //returns seqName -> numberOfRedundantSeqs for a specific group - the count file format, but each line is parsed by group.
- int getSeqs(string, string, string, string, bool); //prints unique sequences in a specific group to a file - group, filename, uchimeFormat=false, tag (/ab= or ;size=), tag2(/ or ;)
+ int getSeqs(string, string, string, string, long long&, bool); //prints unique sequences in a specific group to a file - group, filename, uchimeFormat=false, tag (/ab= or ;size=), tag2(/ or ;)
int getCountTable(string, string); //print seqName -> numberRedundantSeqs for a specific group - group, filename
map<string, string> getAllSeqsMap(); //returns map where the key=sequenceName and the value=representativeSequence - helps us remove duplicates after group by group processing
@@ -219,7 +219,7 @@ vector<Sequence> SequenceParser::getSeqs(string g){
}
}
/************************************************************/
-int SequenceParser::getSeqs(string g, string filename, string tag, string tag2, bool uchimeFormat=false){
+int SequenceParser::getSeqs(string g, string filename, string tag, string tag2, long long& numSeqs, bool uchimeFormat=false){
try {
map<string, vector<Sequence> >::iterator it;
vector<Sequence> seqForThisGroup;
@@ -229,11 +229,14 @@ int SequenceParser::getSeqs(string g, string filename, string tag, string tag2,
if(it == seqs.end()) {
m->mothurOut("[ERROR]: No sequences available for group " + g + ", please correct."); m->mothurOutEndLine();
}else {
-
+
ofstream out;
m->openOutputFile(filename, out);
seqForThisGroup = it->second;
+
+ numSeqs = seqForThisGroup.size();
+
if (uchimeFormat) {
// format should look like
@@ -41,7 +41,7 @@ class SequenceParser {
vector<Sequence> getSeqs(string); //returns unique sequences in a specific group
map<string, string> getNameMap(string); //returns seqName -> namesOfRedundantSeqs separated by commas for a specific group - the name file format, but each line is parsed by group.
- int getSeqs(string, string, string, string, bool); //prints unique sequences in a specific group to a file - group, filename, uchimeFormat=false, tag(/ab= or ;size=), tag2(/ or ;)
+ int getSeqs(string, string, string, string, long long&, bool); //prints unique sequences in a specific group to a file - group, filename, uchimeFormat=false, tag(/ab= or ;size=), tag2(/ or ;)
int getNameMap(string, string); //print seqName -> namesOfRedundantSeqs separated by commas for a specific group - group, filename
map<string, string> getAllSeqsMap(){ return allSeqsMap; } //returns map where the key=sequenceName and the value=representativeSequence - helps us remove duplicates after group by group processing

0 comments on commit d10ca55

Please sign in to comment.