string nextCommand = "";
mout->mothurOut("mothur > ");
- m->getline(cin, nextCommand);
+ getline(cin, nextCommand);
mout->mothurOutJustToLog(toString(nextCommand));
return nextCommand;
if (m->control_pressed) { return 1; }
#else
- numFastaSeqs = driverRunFilter(filter, filteredFasta, fastafileNames[s], lines[0]);
+ int numFastaSeqs = driverRunFilter(filter, filteredFasta, fastafileNames[s], lines[0]);
numSeqs += numFastaSeqs;
if (m->control_pressed) { return 1; }
if (m->control_pressed) { return filterString; }
#else
- numFastaSeqs = driverCreateFilter(F, fastafileNames[s], lines[0]);
+ int numFastaSeqs = driverCreateFilter(F, fastafileNames[s], lines[0]);
numSeqs += numFastaSeqs;
if (m->control_pressed) { return filterString; }
#endif
//**********************************************************************************************************************
int GetSeqsCommand::readFasta(){
try {
- if (outputDir == "") { outputDir += m->hasPath(fastafile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(fastafile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int GetSeqsCommand::readList(){
try {
- if (outputDir == "") { outputDir += m->hasPath(listfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(listfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int GetSeqsCommand::readName(){
try {
- if (outputDir == "") { outputDir += m->hasPath(namefile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(namefile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int GetSeqsCommand::readGroup(){
try {
- if (outputDir == "") { outputDir += m->hasPath(groupfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(groupfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int GetSeqsCommand::readTax(){
try {
- if (outputDir == "") { outputDir += m->hasPath(taxfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(taxfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
ofstream out;
m->openOutputFile(outputFileName, out);
//alignreport file has a column header line then all other lines contain 16 columns. we just want the first column since that contains the name
int GetSeqsCommand::readAlign(){
try {
- if (outputDir == "") { outputDir += m->hasPath(alignfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(alignfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
ofstream out;
m->openOutputFile(outputFileName, out);
gTreemap = NULL;
gSequenceDB = NULL;
nameMap = NULL;
+ saveNextLabel = "";
}
/*******************************************************/
sharedfile = "";
relAbundfile = "";
format = "";
+ saveNextLabel = "";
}
set<string> labels; //holds labels to be used
vector<string> Treenames;
map<string, string> names;
+ string saveNextLabel;
string getPhylipFile();
void Nast::regapSequences(){ //This is essentially part B in Fig 2. of DeSantis et al.
try {
-
+ //cout << candidateSeq->getName() << endl;
string candPair = candidateSeq->getPairwise();
string candAln = "";
string lastLoop = "";
while(pairwiseAlignIndex<pairwiseLength){
+ //cout << pairwiseAlignIndex << '\t' << fullAlignIndex << '\t' << pairwiseLength << endl;
if(isalpha(tempPair[pairwiseAlignIndex]) && isalpha(tempAln[fullAlignIndex])
&& isalpha(candPair[pairwiseAlignIndex])){
// the template and candidate pairwise and template aligned have characters
} // 2 of Desantis et al.
candidateSeq->setAligned(candAln);
+ //cout << "here" << endl;
}
catch(exception& e) {
m->errorOut(e, "Nast", "regapSequences");
m->mothurOut("Getting conservation... "); cout.flush();
if (consfile == "") {
m->mothurOut("Calculating probability of conservation for your template sequences. This can take a while... I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command. Providing the .freq file will improve speed. "); cout.flush();
- probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + m->getSimpleName(templateFileName));
+ probabilityProfile = decalc->calcFreq(templateSeqs, templateFileName);
if (m->control_pressed) { return 0; }
m->mothurOut("Done."); m->mothurOutEndLine();
}else { probabilityProfile = readFreq(); m->mothurOut("Done."); }
string noOutliers, outliers;
if ((!filter) && (seqMask == "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.quan";
+ noOutliers = templateFileName + "pintail.quan";
}else if ((!filter) && (seqMask != "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.masked.quan";
+ noOutliers =templateFileName + "pintail.masked.quan";
}else if ((filter) && (seqMask != "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
+ noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
}else if ((filter) && (seqMask == "")) {
- noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
+ noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
}
decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
//**********************************************************************************************************************
int RemoveSeqsCommand::readFasta(){
try {
- if (outputDir == "") { outputDir += m->hasPath(fastafile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(fastafile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
+
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int RemoveSeqsCommand::readList(){
try {
- if (outputDir == "") { outputDir += m->hasPath(listfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(listfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
+
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int RemoveSeqsCommand::readName(){
try {
- if (outputDir == "") { outputDir += m->hasPath(namefile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(namefile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int RemoveSeqsCommand::readGroup(){
try {
- if (outputDir == "") { outputDir += m->hasPath(groupfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(groupfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+
ofstream out;
m->openOutputFile(outputFileName, out);
//**********************************************************************************************************************
int RemoveSeqsCommand::readTax(){
try {
- if (outputDir == "") { outputDir += m->hasPath(taxfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(taxfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
ofstream out;
m->openOutputFile(outputFileName, out);
//alignreport file has a column header line then all other lines contain 16 columns. we just want the first column since that contains the name
int RemoveSeqsCommand::readAlign(){
try {
- if (outputDir == "") { outputDir += m->hasPath(alignfile); }
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(alignfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+
ofstream out;
m->openOutputFile(outputFileName, out);
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
lookup.clear();
+ if (globaldata->saveNextLabel == "") { f >> label; }
+ else { label = globaldata->saveNextLabel; }
+
//read in first row since you know there is at least 1 group.
- f >> label >> groupN >> num;
+ f >> groupN >> num;
+
holdLabel = label;
//add new vector to lookup
if (f.eof() != true) { f >> nextLabel; }
}
- //put file pointer back since you are now at a new distance label
- for (int i = 0; i < nextLabel.length(); i++) { f.unget(); }
+ globaldata->saveNextLabel = nextLabel;
if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
lookup.clear();
+ if (globaldata->saveNextLabel == "") { f >> label; }
+ else { label = globaldata->saveNextLabel; }
+
//read in first row since you know there is at least 1 group.
- f >> label >> groupN >> num;
+ f >> groupN >> num;
+
holdLabel = label;
//add new vector to lookup
//numSeqs += inputData;
//numBins++;
if (inputData > maxRank) { maxRank = inputData; }
-
}
m->gobble(f);
- if (f.eof() != true) { f >> nextLabel; }
-
+ if (!(f.eof())) { f >> nextLabel; }
+
//read the rest of the groups info in
while ((nextLabel == holdLabel) && (f.eof() != true)) {
f >> groupN >> num;
if (f.eof() != true) { f >> nextLabel; }
}
-
- //put file pointer back since you are now at a new distance label
- for (int i = 0; i < nextLabel.length(); i++) { f.unget(); }
+
+ globaldata->saveNextLabel = nextLabel;
if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
int n = 1;
vector<SharedRAbundVector*> subset;
- for (int k = 0; k < (thisLookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+ for (int k = 0; k < (thisLookup.size() - 1); k++) { // pass cdd each set of groups to compare
+
for (int l = n; l < thisLookup.size(); l++) {
outputFileHandle << thisLookup[0]->getLabel() << '\t';
if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
}
+ globaldata->newRead();
+
//if the user changes the input directory command factory will send this info to us in the output parameter
string inputDir = validParameter.validFile(parameters, "inputdir", false);
if (inputDir == "not found"){ inputDir = ""; }
if (m->control_pressed) { return 0; }
#else
- driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qlines[0]);
+ driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qLines[0]);
for (int j = 0; j < fastaFileNames.size(); j++) {
rename((fastaFileNames[j] + toString(j) + ".temp").c_str(), fastaFileNames[j].c_str());