本文整理汇总了C++中GroupMap::getNamesSeqs方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupMap::getNamesSeqs方法的具体用法?C++ GroupMap::getNamesSeqs怎么用?C++ GroupMap::getNamesSeqs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupMap
的用法示例。
在下文中一共展示了GroupMap::getNamesSeqs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSharedFromListGroup
//**********************************************************************************************************************
int SharedCommand::createSharedFromListGroup() {
try {
GroupMap* groupMap = NULL;
CountTable* countTable = NULL;
pickedGroups = false;
if (groupfile != "") {
groupMap = new GroupMap(groupfile);
int groupError = groupMap->readMap();
if (groupError == 1) { delete groupMap; return 0; }
vector<string> allGroups = groupMap->getNamesOfGroups();
if (Groups.size() == 0) { Groups = allGroups; }
else { pickedGroups = true; }
}else{
countTable = new CountTable();
countTable->readTable(countfile, true, false);
vector<string> allGroups = countTable->getNamesOfGroups();
if (Groups.size() == 0) { Groups = allGroups; }
else { pickedGroups = true; }
}
int numGroups = Groups.size();
if (m->getControl_pressed()) { return 0; }
ofstream out;
string filename = "";
if (!pickedGroups) {
string filename = listfile;
if (outputDir == "") { outputDir += util.hasPath(filename); }
map<string, string> variables;
variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(filename));
filename = getOutputFileName("shared",variables);
outputNames.push_back(filename); outputTypes["shared"].push_back(filename);
util.openOutputFile(filename, out);
}
//set fileroot
fileroot = outputDir + util.getRootName(util.getSimpleName(listfile));
map<string, string> variables;
variables["[filename]"] = fileroot;
string errorOff = "no error";
InputData input(listfile, "shared", Groups);
SharedListVector* SharedList = input.getSharedListVector();
string lastLabel = SharedList->getLabel();
SharedRAbundVectors* lookup;
if (m->getControl_pressed()) {
delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
out.close(); if (!pickedGroups) { util.mothurRemove(filename); }
return 0;
}
//sanity check
vector<string> namesSeqs;
int numGroupNames = 0;
if (current->getGroupMode() == "group") { namesSeqs = groupMap->getNamesSeqs(); numGroupNames = groupMap->getNumSeqs(); }
else { namesSeqs = countTable->getNamesOfSeqs(); numGroupNames = countTable->getNumUniqueSeqs(); }
int error = ListGroupSameSeqs(namesSeqs, SharedList);
if ((!pickedGroups) && (SharedList->getNumSeqs() != numGroupNames)) { //if the user has not specified any groups and their files don't match exit with error
m->mothurOut("Your group file contains " + toString(numGroupNames) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct.\n"); m->setControl_pressed(true);
out.close(); if (!pickedGroups) { util.mothurRemove(filename); } //remove blank shared file you made
//delete memory
delete SharedList; if (groupMap != NULL) { delete groupMap; } if (countTable != NULL) { delete countTable; }
return 0;
}
if (error == 1) { m->setControl_pressed(true); }
//if user has specified groups make new groupfile for them
if ((pickedGroups) && (current->getGroupMode() == "group")) { //make new group file
string groups = "";
if (numGroups < 4) {
for (int i = 0; i < numGroups-1; i++) {
groups += Groups[i] + ".";
}
groups+=Groups[numGroups-1];
}else { groups = "merge"; }
map<string, string> variables;
variables["[filename]"] = outputDir + util.getRootName(util.getSimpleName(listfile));
variables["[group]"] = groups;
string newGroupFile = getOutputFileName("group",variables);
outputTypes["group"].push_back(newGroupFile);
outputNames.push_back(newGroupFile);
ofstream outGroups;
util.openOutputFile(newGroupFile, outGroups);
vector<string> names = groupMap->getNamesSeqs();
string groupName;
for (int i = 0; i < names.size(); i++) {
groupName = groupMap->getGroup(names[i]);
if (isValidGroup(groupName, Groups)) {
outGroups << names[i] << '\t' << groupName << endl;
}
}
//.........这里部分代码省略.........