]> git.donarmstrong.com Git - mothur.git/blobdiff - listseqscommand.cpp
changed tags on temp blast db to include template name
[mothur.git] / listseqscommand.cpp
index b977304c9ce54493e5f34dc20705ea1855b21bc4..21cb4c7f622e95bc4a44689ce8ef605703444ec2 100644 (file)
@@ -41,7 +41,7 @@ string ListSeqsCommand::getHelpString(){
                helpString += "The list.seqs command parameters are fasta, name, group, list, taxonomy and alignreport.  You must provide one of these parameters.\n";
                helpString += "The list.seqs command should be in the following format: list.seqs(fasta=yourFasta).\n";
                helpString += "Example list.seqs(fasta=amazon.fasta).\n";
-               helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n";
+               helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -257,18 +257,32 @@ int ListSeqsCommand::readFasta(){
                m->openInputFile(fastafile, in);
                string name;
                
+               ofstream out;
+               string newFastaName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "numsAdded.fasta";
+               m->openOutputFile(newFastaName, out);
+               int count = 1;
+               string lastName = "";
+               
                while(!in.eof()){
                        
                        if (m->control_pressed) { in.close(); return 0; }
                        
                        Sequence currSeq(in);
                        name = currSeq.getName();
+                       if (lastName == "") { lastName = name; }
+                       if (name != lastName) { count = 1; }
+                       lastName = name;
+                       
+                       Sequence newSeq(name+"_"+toString(count), currSeq.getAligned());
+                       newSeq.printSequence(out);
                        
                        if (name != "") {  names.push_back(name);  }
                        
                        m->gobble(in);
+                       count++;
                }
                in.close();     
+               out.close();
                
                return 0;