Skip to content

Commit

Permalink
Fixes read of singleton file in cluster.split
Browse files Browse the repository at this point in the history
Caused by the change to sparse count table by default

#792
  • Loading branch information
mothur-westcott committed Jan 4, 2022
1 parent 31f557a commit 79902c0
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions source/commands/clustersplitcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,23 +494,21 @@ map<double, int> ClusterSplitCommand::completeListFile(vector<string> listNames,
//read in singletons
if (singleton != "none") {

ifstream in;
util.openInputFile(singleton, in);

string firstCol, secondCol;
listSingle = new ListVector();

if (type == "count") { util.getline(in); util.gobble(in); }

while (!in.eof()) {
in >> firstCol >> secondCol;
util.getline(in);
if (type == "name") { listSingle->push_back(secondCol); }
else { listSingle->push_back(firstCol); }
util.gobble(in);
}

in.close();
listSingle = new ListVector();
if (type == "count") {

CountTable ct; ct.readTable(singleton, false, false);

vector<string> singletonSeqNames = ct.getNamesOfSeqs();

for (int i = 0; i < singletonSeqNames.size(); i++) { listSingle->push_back(singletonSeqNames[i]); }

}else if (type == "name") {
map<string, string> singletonSeqNames; util.readNames(singleton, singletonSeqNames);

for (map<string, string>::iterator it = singletonSeqNames.begin(); it != singletonSeqNames.end(); it++) { listSingle->push_back(it->second); }
}

util.mothurRemove(singleton);

numSingleBins = listSingle->getNumBins();
Expand Down

0 comments on commit 79902c0

Please sign in to comment.