cafaeval.graph¶
- class cafaeval.graph.Graph(namespace, terms_dict, ia_dict=None, orphans=False)[source]¶
Bases:
objectOntology class. One ontology == one namespace DAG is the adjacence matrix (sparse) which represent a Directed Acyclic Graph where DAG(i,j) == 1 means that the go term i is_a (or is part_of) j Parents that are in a different namespace are discarded
- top_sort()[source]¶
Takes a sparse matrix representing a DAG and returns an array with nodes indexes in topological order https://en.wikipedia.org/wiki/Topological_sorting
- class cafaeval.graph.Prediction(ids, matrix, namespace=None)[source]¶
Bases:
objectThe score matrix contains the scores given by the predictor for every node of the ontology
- cafaeval.graph.propagate(matrix, ont, order, mode='max', parallel=0, chunk_rows=65536, _shm_name=None, _shape=None, _dtype_str=None, _row_start=None, _row_end=None, _deepest=None, _triples=None)[source]¶
Update inplace the score matrix (proteins x terms) propagating scores up to the root.
mode='max'takes the max of each term and its children;mode='fill'only updates rows where the current term is zero.When
parallel > 1and the estimated work is above the threshold the matrix is shared across processes viashared_memory(spawn context) and rows are partitioned among workers. Recursive calls re-enter this function through the_shm_namepath.