-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New source: BiGG Models Metabolite Database #124
base: main
Are you sure you want to change the base?
Changes from 11 commits
b26ca98
c9cac99
5376fc1
4615e74
94eb365
4a7662f
e1a2e5a
5e0f9fb
d5895b7
e89f33c
02a0b8d
be366cf
9a1ff3e
42674b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,63 @@ | ||||||
# -*- coding: utf-8 -*- | ||||||
|
||||||
"""Converter for bigg.""" | ||||||
|
||||||
from typing import Iterable, Optional | ||||||
|
||||||
import bioversions | ||||||
|
||||||
from pyobo.struct import Obo, Reference, SynonymTypeDef, Term, TypeDef | ||||||
|
||||||
from ..utils.path import ensure_df | ||||||
|
||||||
HEADER = ["bigg_id", "universal_bigg_id", "name", "model_list", "database_links", "old_bigg_ids"] | ||||||
PREFIX = "bigg.metabolite" | ||||||
|
||||||
URL = "http://bigg.ucsd.edu/static/namespace/bigg_models_metabolites.txt" | ||||||
|
||||||
alias_type = SynonymTypeDef(id="alias", name="alias") | ||||||
has_role = TypeDef(reference=Reference(prefix="bigg", identifier="has_role")) | ||||||
|
||||||
|
||||||
def get_obo(force: bool = False) -> Obo: | ||||||
"""Get bigg as OBO.""" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stylization |
||||||
version = bioversions.get_version("bigg") | ||||||
# version = '1.2' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove dead code |
||||||
return Obo( | ||||||
ontology=PREFIX, | ||||||
name="bigg models metabolites database", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. title case + stylization |
||||||
iter_terms=get_terms, | ||||||
iter_terms_kwargs=dict(force=force, version=version), | ||||||
typedefs=[has_role], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this included? |
||||||
synonym_typedefs=[alias_type], | ||||||
auto_generated_by=f"bio2obo:{PREFIX}", | ||||||
data_version=version, | ||||||
) | ||||||
|
||||||
|
||||||
def get_terms(force: bool = False, version: Optional[str] = None) -> Iterable[Term]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check CI - this needs a docstring |
||||||
bigg_df = ensure_df( | ||||||
prefix=PREFIX, | ||||||
url=URL, | ||||||
sep="\t", | ||||||
skiprows=18, | ||||||
header=None, | ||||||
names=HEADER, | ||||||
usecols=["bigg_id", "name"], | ||||||
force=force, | ||||||
version=version, | ||||||
) | ||||||
|
||||||
for v in bigg_df.values: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
bigg_id = v[0] | ||||||
name = v[1] | ||||||
synonyms = [] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why include this blank list? |
||||||
term = Term( | ||||||
reference=Reference(prefix=PREFIX, identifier=bigg_id, name=name), | ||||||
synonyms=synonyms, | ||||||
) | ||||||
yield term | ||||||
|
||||||
|
||||||
if __name__ == "__main__": | ||||||
get_obo(force=True).cli() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix stylization of BiGG