This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I construct the adjacency matrix for gene ontology between genes

Hi, I've been trying construct the adjacency matrix by counting the matched GO terms between two genes.

For example, when I insert three genes, the result should be like this:

Genes: {7038, 7157, 472}

GO: Biological Function (BF)

enter image description here

Each number represents the matched number of gene ontology term between two genes.

Unfortunately, there are huge number of genes, I need the tool that calculate it automatically.

Which tool or python package can do this job?

geneontology python go

1 answer

Networkx has a function called adjacency_matrix. Here is an example with obonet and networkx.

Thank you for your answer! Can I ask one more question?

I guess that obonet represents the network containing nodes (=GO term) and edges (=hierarchical relation).

But I need gene-gene adjacency matrix. If two genes have a common GO term, the value of them is set to 1 in the matrix.

Can obonet and networkx make this matrix?

I don't know really. GO has annotation files with the gene symbols. Maybe something can be written from that file if you can't find a tool that already does this.

Log in to answer this question.