void GeneOntology::writeTrees(){ populateRecursiveValues(); // compute depths computeDepths(m_cellularComponentHandle,0); computeDepths(m_molecularFunctionHandle,0); computeDepths(m_biologicalProcessHandle,0); int withoutDepth=0; for(map<GeneOntologyIdentifier,GeneOntologyDomain>::iterator i=m_termDomains.begin(); i!=m_termDomains.end();i++){ GeneOntologyIdentifier handle=i->first; if(m_depths.count(handle)==0){ withoutDepth++; } } cout<<"Gene ontology terms without depth information: "<<withoutDepth<<endl; writeOntologyProfile(GENE_ONTOLOGY_DOMAIN_biological_process); writeOntologyProfile(GENE_ONTOLOGY_DOMAIN_cellular_component); writeOntologyProfile(GENE_ONTOLOGY_DOMAIN_molecular_function); }
void GeneOntology::computeDepths(GeneOntologyIdentifier handle,int depth){ if(m_depths.count(depth)==1){ return; } m_depths[handle]=depth; bool skipDifferentDomain=true; vector<GeneOntologyIdentifier> children; getChildren(handle,&children); for(int i=0;i<(int)children.size();i++){ GeneOntologyIdentifier child=children[i]; if(skipDifferentDomain && getDomain(child)!=getDomain(handle)){ continue; } computeDepths(child,depth+1); } }
/*public*/ void BufferSubgraph::computeDepth(int outsideDepth) { clearVisitedEdges(); // find an outside edge to assign depth to DirectedEdge *de=finder.getEdge(); #if GEOS_DEBUG cerr<<"outside depth: "<<outsideDepth<<endl; #endif //Node *n=de->getNode(); //Label *label=de->getLabel(); // right side of line returned by finder is on the outside de->setEdgeDepths(Position::RIGHT, outsideDepth); copySymDepths(de); //computeNodeDepth(n, de); computeDepths(de); }