コード例 #1
0
ファイル: phylotree.cpp プロジェクト: mothur/mothur
PhyloTree::PhyloTree(string tfile){
	try {
		m = MothurOut::getInstance();
        current = CurrentFile::getInstance();
		numNodes = 1;
		numSeqs = 0;
		tree.push_back(TaxNode("Root"));
		tree[0].heirarchyID = "0";
        tree[0].level = 0;
		maxLevel = 0;
		calcTotals = true;
		string name, tax;
		
        map<string, string> temp;
        util.readTax(tfile, temp, true);
        
        for (map<string, string>::iterator itTemp = temp.begin(); itTemp != temp.end();) {
            addSeqToTree(itTemp->first, itTemp->second);
            temp.erase(itTemp++);
        }
        
        string unknownTax = "unknown;";
        //added last taxon until you get desired level
		for (int i = 1; i < maxLevel; i++) {
			unknownTax += "unknown_unclassfied;";
		}
        addSeqToTree("unknown", unknownTax);
        
        assignHeirarchyIDs(0);
        
		//create file for summary if needed
		setUp(tfile);
	}
	catch(exception& e) {
		m->errorOut(e, "PhyloTree", "PhyloTree");
		exit(1);
	}
}
コード例 #2
0
PhyloTree::PhyloTree(){
	try {
		m = MothurOut::getInstance();
		numNodes = 1;
		numSeqs = 0;
		tree.push_back(TaxNode("Root"));
		tree[0].heirarchyID = "0";
		maxLevel = 0;
		calcTotals = true;
		addSeqToTree("unknown", "unknown;");
	}
	catch(exception& e) {
		m->errorOut(e, "PhyloTree", "PhyloTree");
		exit(1);
	}
}
コード例 #3
0
ファイル: phylosummary.cpp プロジェクト: Cryomics-Lab/mothur
int PhyloSummary::summarize(string userTfile){
	try {
		map<string, string> temp;
        m->readTax(userTfile, temp, true);
        
        for (map<string, string>::iterator itTemp = temp.begin(); itTemp != temp.end();) {
            addSeqToTree(itTemp->first, itTemp->second);
            temp.erase(itTemp++);
        }
        
        return numSeqs;
	}
	catch(exception& e) {
		m->errorOut(e, "PhyloSummary", "summarize");
		exit(1);
	}
}