//set up groupmap for later.
groupmap = new GroupMap(globaldata->getGroupFile());
- groupmap->readMap();
+ groupmap->readMap();
int hold;
string inputData;
f >> label >> hold;
data.assign(hold, "");
-
+
for(int i=0;i<hold;i++){
f >> inputData;
set(i, inputData);
}
-
+
}
catch(exception& e) {
m->errorOut(e, "SharedListVector", "SharedListVector");
/***********************************************************************/
void SharedListVector::set(int binNumber, string seqNames){
try {
- int nNames_old = getNumNames(data[binNumber]);
+ int nNames_old = m->getNumNames(data[binNumber]);
data[binNumber] = seqNames;
- int nNames_new = getNumNames(seqNames);
+ int nNames_new = m->getNumNames(seqNames);
if(nNames_old == 0) { numBins++; }
if(nNames_new == 0) { numBins--; }
if(nNames_new > maxRank) { maxRank = nNames_new; }
numSeqs += (nNames_new - nNames_old);
+
+
}
catch(exception& e) {
m->errorOut(e, "SharedListVector", "set");
void SharedListVector::push_back(string seqNames){
try {
data.push_back(seqNames);
- int nNames = getNumNames(seqNames);
+ int nNames = m->getNumNames(seqNames);
numBins++;
RAbundVector rav;
for(int i=0;i<data.size();i++){
- int binSize = getNumNames(data[i]);
+ int binSize = m->getNumNames(data[i]);
rav.push_back(binSize);
}
SAbundVector sav(maxRank+1);
for(int i=0;i<data.size();i++){
- int binSize = getNumNames(data[i]);
+ int binSize = m->getNumNames(data[i]);
sav.set(binSize, sav.get(binSize) + 1);
}
sav.set(0, 0);
order->setLabel(label);
for(int i=0;i<numBins;i++){
- int binSize = getNumNames(get(i)); //find number of individual in given bin
+ int binSize = m->getNumNames(get(i)); //find number of individual in given bin
names = get(i);
while (names.find_first_of(',') != -1) {
name = names.substr(0,names.find_first_of(','));
finder[globaldata->gGroupmap->namesOfGroups[i]] = temp;
finder[globaldata->gGroupmap->namesOfGroups[i]]->setLabel(label);
finder[globaldata->gGroupmap->namesOfGroups[i]]->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
- if (inVector(globaldata->gGroupmap->namesOfGroups[i], globaldata->Groups)) { //if this group is in user groups
+ if (m->inUsersGroups(globaldata->gGroupmap->namesOfGroups[i], globaldata->Groups)) { //if this group is in user groups
lookup.push_back(finder[globaldata->gGroupmap->namesOfGroups[i]]);
}
}
//fill vectors
for(int i=0;i<numBins;i++){
names = get(i);
- while (names.find_first_of(',') != -1) {
- name = names.substr(0,names.find_first_of(','));
- names = names.substr(names.find_first_of(',')+1, names.length());
- group = groupmap->getGroup(name);
- if(group == "not found") { m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
- finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+ int nameLength = names.size();
+ string seqName = "";
+
+ for(int j=0;j<nameLength;j++){
+ if(names[j] == ','){
+ group = groupmap->getGroup(seqName);
+ if(group == "not found") { m->mothurOut("Error: Sequence '" + seqName + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
+ finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+
+ seqName = "";
+ }
+ else{
+ seqName += names[j];
+ }
}
+ group = groupmap->getGroup(seqName);
+ if(group == "not found") { m->mothurOut("Error: Sequence '" + seqName + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
+ finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+
+
+
+// while (names.find_first_of(',') != -1) {
+// name = names.substr(0,names.find_first_of(','));
+// names = names.substr(names.find_first_of(',')+1, names.length());
+// group = groupmap->getGroup(name);
+// if(group == "not found") { m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
+// finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+// }
//get last name
- group = groupmap->getGroup(names);
- if(group == "not found") { m->mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
- finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+// group = groupmap->getGroup(names);
+// if(group == "not found") { m->mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
+// finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
}
-
+
return lookup;
}
catch(exception& e) {
OrderVector ov;
for(int i=0;i<data.size();i++){
- int binSize = getNumNames(data[i]);
+ int binSize = m->getNumNames(data[i]);
for(int j=0;j<binSize;j++){
ov.push_back(i);
}