KBase Workspace

[1]:
import cobrakbase
cobrakbase 0.2.8

Initialize KBase client with a valid token

[2]:
kbase = cobrakbase.KBaseAPI() # or kbase = cobrakbase.KBaseAPI(YOUR_LOGIN_TOKEN)
[ ]:
ws = "filipeliu:narrative_1561151919387"

Get Object

get_object returns raw dict object

[3]:
data = kbase.get_object('GramNegModelTemplateV2', 'NewKBaseModelTemplates')
for k in data:
    print(k, type(data[k]))
__VERSION__ <class 'int'>
biochemistry_ref <class 'str'>
biomasses <class 'list'>
compartments <class 'list'>
compcompounds <class 'list'>
complexes <class 'list'>
compounds <class 'list'>
domain <class 'str'>
id <class 'str'>
name <class 'str'>
pathways <class 'list'>
reactions <class 'list'>
roles <class 'list'>
subsystems <class 'list'>
type <class 'str'>

get_from_ws returns ModelSEEDpy datatypes (e.g., Model, Genome, Media, Template)

[5]:
template = kbase.get_from_ws('GramNegModelTemplateV2', 'NewKBaseModelTemplates')
[6]:
template
[6]:
ID GramNegative.modeltemplate
Memory address 0x07f8e8fb4c730
Number of metabolites 6359
Number of species 6884
Number of reactions 8656
Number of roles 20572
Number of complexes 9764
[7]:
template.reactions.rxn00001_c
[7]:
Reaction identifierrxn00001_c
Namediphosphate phosphohydrolase
Memory address 0x07f8e84198820
Stoichiometry

cpd00001_c + cpd00012_c --> 2 cpd00009_c + cpd00067_c

H2O + PPi --> 2 Phosphate + H+

GPRcpx01835 or cpx01834 or cpx34574 or cpx52693 or cpx01833
Lower bound0
Upper bound1000
[ ]: