Skip to content

Instantly share code, notes, and snippets.

@elipapa
Created August 6, 2018 13:00
Show Gist options
  • Save elipapa/ad0d02ac7f50dc308d31cf0d0262d939 to your computer and use it in GitHub Desktop.
Save elipapa/ad0d02ac7f50dc308d31cf0d0262d939 to your computer and use it in GitHub Desktop.
create a EFO code <=> labels mapping file
# pip install ontoma
from ontoma.interface import OnToma
ot = OnToma()
# the following will download the latest EFO OBO file from github
# and output a tab separated files of labels <=> codes to a file
for k,v in ot.efo_to_name.items():
print(k,v,file=open('efolabel.txt','a'),sep="\t")
# you can replace the colon with an underscore:
for k,v in ot.efo_to_name.items():
print(k.replace(':',"_"),v,file=open('efolabel.underscore.txt','a'),sep="\t")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment