From da2b0566ec9d5f17880c5802ef70a7560d90fee1 Mon Sep 17 00:00:00 2001 From: westcott Date: Tue, 24 Nov 2009 14:10:08 +0000 Subject: [PATCH] changed get.sharedotu to get.sharedseqs --- commandfactory.cpp | 4 ++-- getsharedotucommand.cpp | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/commandfactory.cpp b/commandfactory.cpp index ed1801a..c853268 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -113,7 +113,7 @@ CommandFactory::CommandFactory(){ commands["remove.seqs"] = "get.seqs"; commands["system"] = "system"; commands["align.check"] = "align.check"; - commands["get.sharedotu"] = "get.sharedotu"; + commands["get.sharedseqs"] = "get.sharedseqs"; commands["get.listcount"] = "get.listcount"; commands["quit"] = "quit"; commands["hcluster"] = "hcluster"; @@ -181,7 +181,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "merge.files") { command = new MergeFileCommand(optionString); } else if(commandName == "system") { command = new SystemCommand(optionString); } else if(commandName == "align.check") { command = new AlignCheckCommand(optionString); } - else if(commandName == "get.sharedotu") { command = new GetSharedOTUCommand(optionString); } + else if(commandName == "get.sharedseqs") { command = new GetSharedOTUCommand(optionString); } else if(commandName == "get.listcount") { command = new GetListCountCommand(optionString); } else if(commandName == "hcluster") { command = new HClusterCommand(optionString); } else if(commandName == "classify.seqs") { command = new ClassifySeqsCommand(optionString); } diff --git a/getsharedotucommand.cpp b/getsharedotucommand.cpp index 6d13472..76e5725 100644 --- a/getsharedotucommand.cpp +++ b/getsharedotucommand.cpp @@ -84,15 +84,15 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option){ void GetSharedOTUCommand::help(){ try { - mothurOut("The get.sharedotu command parameters are list, group, label, groups, output and fasta. The list and group parameters are required.\n"); + mothurOut("The get.sharedseqs command parameters are list, group, label, groups, output and fasta. The list and group parameters are required.\n"); mothurOut("The label parameter allows you to select what distance levels you would like output files for, and are separated by dashes.\n"); mothurOut("The groups parameter allows you to select groups you would like to know the shared info for, and are separated by dashes.\n"); mothurOut("The fasta parameter allows you to input a fasta file and outputs a fasta file for each distance level containing only the sequences that are in OTUs shared by the groups specified.\n"); mothurOut("The output parameter allows you to output the list of names without the group and bin number added. \n"); mothurOut("With this option you can use the names file as an input in get.seqs and remove.seqs commands. To do this enter output=accnos. \n"); - mothurOut("The get.sharedotu command outputs a .names file for each distance level containing a list of sequences in the OTUs shared by the groups specified.\n"); - mothurOut("The get.sharedotu command should be in the following format: get.sabund(label=yourLabels, groups=yourGroups, fasta=yourFastafile, output=yourOutput).\n"); - mothurOut("Example get.sharedotu(list=amazon.fn.list, label=unique-0.01, group=forest-pasture, fasta=amazon.fasta, output=accnos).\n"); + mothurOut("The get.sharedseqs command outputs a .names file for each distance level containing a list of sequences in the OTUs shared by the groups specified.\n"); + mothurOut("The get.sharedseqs command should be in the following format: get.sabund(label=yourLabels, groups=yourGroups, fasta=yourFastafile, output=yourOutput).\n"); + mothurOut("Example get.sharedseqs(list=amazon.fn.list, label=unique-0.01, group=forest-pasture, fasta=amazon.fasta, output=accnos).\n"); mothurOut("The output to the screen is the distance and the number of otus at that distance for the groups you specified.\n"); mothurOut("The default value for label is all labels in your inputfile. The default for groups is all groups in your file.\n"); mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n"); @@ -224,7 +224,12 @@ void GetSharedOTUCommand::process(ListVector* shared) { map fastaMap; ofstream outNames; - string outputFileNames = getRootName(listfile) + shared->getLabel() + ".names"; + string outputFileNames; + if (output != "accnos") { + outputFileNames = getRootName(listfile) + shared->getLabel() + ".shared.seqs"; + }else { + outputFileNames = getRootName(listfile) + shared->getLabel() + ".accnos"; + } openOutputFile(outputFileNames, outNames); bool wroteSomething = false; @@ -250,7 +255,7 @@ void GetSharedOTUCommand::process(ListVector* shared) { //find group string seqGroup = groupMap->getGroup(name); if (output != "accnos") { - namesOfSeqsInThisBin.push_back((name + "|" + seqGroup + "|" + toString(i+1))); + namesOfSeqsInThisBin.push_back((name + "\t" + seqGroup + "\t" + toString(i+1))); }else { namesOfSeqsInThisBin.push_back(name); } if (seqGroup == "not found") { mothurOut(name + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1); } @@ -266,7 +271,7 @@ void GetSharedOTUCommand::process(ListVector* shared) { if (sharedByAll) { string seqGroup = groupMap->getGroup(names); if (output != "accnos") { - namesOfSeqsInThisBin.push_back((names + "|" + seqGroup + "|" + toString(i+1))); + namesOfSeqsInThisBin.push_back((names + "\t" + seqGroup + "\t" + toString(i+1))); }else { namesOfSeqsInThisBin.push_back(names); } if (seqGroup == "not found") { mothurOut(names + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1); } @@ -295,8 +300,8 @@ void GetSharedOTUCommand::process(ListVector* shared) { if (fastafile != "") { if (output != "accnos") { - string seqName = namesOfSeqsInThisBin[j].substr(0,namesOfSeqsInThisBin[j].find_last_of('|')); - seqName = seqName.substr(0,seqName.find_last_of('|')); + string seqName = namesOfSeqsInThisBin[j].substr(0,namesOfSeqsInThisBin[j].find_last_of('\t')); + seqName = seqName.substr(0,seqName.find_last_of('\t')); fastaMap[seqName] = namesOfSeqsInThisBin[j]; //fastaMap needs to contain just the seq name for output later }else { fastaMap[namesOfSeqsInThisBin[j]] = namesOfSeqsInThisBin[j]; @@ -326,7 +331,7 @@ void GetSharedOTUCommand::process(ListVector* shared) { //if fasta file provided output new fasta file if ((fastafile != "") && wroteSomething) { - string outputFileFasta = getRootName(fastafile) + shared->getLabel() + ".fasta"; + string outputFileFasta = getRootName(fastafile) + shared->getLabel() + ".shared.fasta"; ofstream outFasta; openOutputFile(outputFileFasta, outFasta); -- 2.39.2