Skip to content

Instantly share code, notes, and snippets.

@hmartiniano
Last active January 16, 2024 22:59
Show Gist options
  • Save hmartiniano/00aabc83f0f20a9f7f803a7aae9b17e3 to your computer and use it in GitHub Desktop.
Save hmartiniano/00aabc83f0f20a9f7f803a7aae9b17e3 to your computer and use it in GitHub Desktop.
import subprocess
from goatools.semantic import get_info_content
from goatools.base import get_godag
from goatools.semantic import TermCounts
from goatools.anno.factory import get_objanno
godag = get_godag("go-basic.obo")
return_code = subprocess.call("wget https://ftp.ebi.ac.uk/pub/databases/GO/goa/HUMAN/goa_human.gpa.gz && gunzip goa_human.gpa.gz", shell=True)
anno = get_objanno('goa_human.gpa', 'gpad', godag=godag)
cnt = TermCounts(godag, anno.get_id2gos_nss())
tinf = {t: get_info_content(t, cnt) for t in godag.keys()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment