gempipe.interface.gaps
Module Contents
Functions
|
Initialize the gempipe.curate API with the outputs coming from |
|
Get the IDs of the current objective reactions. |
|
Get the ID of the solver associated to the model. |
|
Remove reactions from the model given a list of reaction IDs. |
|
Propose gap-filling solutions for the specified objective. |
|
Return a CarveMe universe. |
Return the Biolog mappings internally used by gempipe. |
|
|
Create a demand reaction, useful for debugging models. |
|
Check if the model can synthesize a given metabolite. |
|
Check which reactant of a given reaction cannot be synthesized. |
|
Perform a sensitivity analysis (or reduced costs analysis) focused on the EX_change reaction. |
|
Show clusters in the context of a PAM. |
|
Insert a new reaction taken from a universe model. |
|
Create a preview of a strain-specific model given its accession and the starting draft pan-GSMM. |
|
Get a preview of of the Biolog simulations for the provided model. |
|
Add a new reaction to the model. |
|
Add a new metabolite to the model. |
|
Search the PAM for gene clusters having functional annotation similar to that of gene clusters involved in the specified reaction of the pan-GSMM. |
Attributes
- gempipe.interface.gaps.__GAPSCACHE__
- gempipe.interface.gaps.initialize(outdir)[source]
Initialize the gempipe.curate API with the outputs coming from
gempipe recon.This function locates the draft pan-GSMM, PAM, and functional annotation table inside the gempipe recon` output folder (
-o/--outdir).- Parameters:
outdir (str) – path to the main output folder of
gempipe recon(-o/--outdir).- Returns:
draft pan-GSMM to start the manual curation.
- Return type:
cobra.Model
- gempipe.interface.gaps.get_objectives(model)[source]
Get the IDs of the current objective reactions.
- Parameters:
model (cobra.Model) – target model.
- Returns:
IDs of the reactions set as objective.
- Return type:
list
- gempipe.interface.gaps.get_solver(model)[source]
Get the ID of the solver associated to the model.
- Parameters:
model (cobra.Model) – target model.
- Returns:
ID of the solver (for example:
glpk_exact).- Return type:
str
- gempipe.interface.gaps.remove_rids(model, rids, inverse=False)[source]
Remove reactions from the model given a list of reaction IDs.
- Parameters:
model (cobra.Model) – target model.
rids (list) – reaction IDs.
inverse (bool) – if
True, reactions IDs contained in rids will be the ones to keep and not to remove.
- gempipe.interface.gaps.perform_gapfilling(model, universe, mid=None, slim=None, minflux=1.0, exr=False, nsol=3, penalties=None, verbose=True, timeout=None, logger=None, boost=False)[source]
Propose gap-filling solutions for the specified objective.
It’s possible to gap-fill also for the biosynthesis of a specific metabolite.
- Parameters:
model (cobra.Model) – target model to gap-fill.
universe (cobra.Model) – model from which to take new reactions.
mid (str) – gap-fill for the biosynthesis of a specific metabolite having ID mid. Will be ignored if
None.slim (str) – try to reduce the complexity of the universe, considering only its reactions carrying non-0 flux. Can be
FBAorFVA. Will be ignored ifNone.minflux (float) – minimal flux to grant through the objective reaction.
nsol (int) – number of alternative solutions.
exr (bool) – whether to allow the opening of new EX_change reactions.
penalties (dict) – dictionary keyed by reaction ID, containing reaction-specific penalties to apply during gap-filling.
verbose (bool) – if False, just return the lisr of reaction IDs without printing any further information.
timeout (int) – max seconds to wait for the gapfilling step. If
None, gap-filling won’t be temporized.logger (logging.Logger) – write exception on a logger instad of using print().
boost (bool) – if
True, consider the current nutritive sources as unlimited (for example, if LB ofEX_fe3_eis -0.0075, it will be raised to -1000).
- Returns:
IDs of reactions proposed during the 1st solution.
- Return type:
list
- gempipe.interface.gaps.get_universe(staining='neg')[source]
Return a CarveMe universe.
- Parameters:
staining (str) – ‘pos’ or ‘neg’.
- Returns:
the selected universe.
- Return type:
cobra.Model
- gempipe.interface.gaps.get_biolog_mappings()[source]
Return the Biolog mappings internally used by gempipe.
Plate information is taken from DuctApe (https://doi.org/10.1016/j.ygeno.2013.11.005).
- Returns:
the Biolog mappings.
- Return type:
pandas.DataFrame
- gempipe.interface.gaps.add_demand(model, mid)[source]
Create a demand reaction, useful for debugging models.
- Parameters:
model (cobra.Model) – target model.
mid (str) – metabolite ID (compartment included) for which to create the demand.
- Returns:
demand reaction ID.
- Return type:
str
- gempipe.interface.gaps.can_synth(model, mid)[source]
Check if the model can synthesize a given metabolite.
- Parameters:
model (cobra.Model) – target model.
mid (str) – metabolite ID (compartment included) for which to check the synthesis.
- Returns:
[0]
Trueif mid can be synthesized (optimalstatus and positive flux).[1] maximal theoretical synthesis flux.
[2] status of the optimizer.
- Return type:
(bool, float, str)
- gempipe.interface.gaps.check_reactants(model, rid, verbose=True)[source]
Check which reactant of a given reaction cannot be synthesized.
- Parameters:
model (cobra.Model) – target model.
rid (str) – reaction ID for which to check the synthesis of the reactants.
verbose (bool) – if False, just return the list of metabolite IDs without printing any further information.
- Returns:
IDs of blocked reactants.
- Return type:
list
- gempipe.interface.gaps.sensitivity_analysis(model, scaled=False, top=3, mid=None)[source]
Perform a sensitivity analysis (or reduced costs analysis) focused on the EX_change reaction.
It is based on the current model’s objective. The returned dictionary is sorted from most negative to most positive values.
- Parameters:
model (cobra.Model) – target model.
scaled (bool) – whether to scale to the current objective value.
top (int) – get just the first and last top EX_change reactions. If
None, all EX_change reactions will be returned.mid (str) – instead of optimizing for the current objective reaction, do the analysis on the biosynthesis of a specific metabolite having ID mid. If None it will be ignored.
- Returns:
reduced costs keyd by EX_change reaction ID.
- Return type:
dict
- gempipe.interface.gaps.query_pam(name=[], ko=[], kr=[], km=[], kt=[], ec=[], des=[], pfam=[], annot=False, model=None, rid=None)[source]
Show clusters in the context of a PAM.
Clusters can be selected based on thier functional annotation.
- Parameters:
name (list) – preferred names to search for, eg [‘fabB’, ‘fabG’].
ko (list) – KEGG Orthologs (KOs) to search for, eg [‘K00647’, ‘K00059’].
kr (list) – KEGG Reaction IDs to search for, eg [‘R03460’].
km (list) – KEGG Module IDs to search for, eg [‘M00846’].
kt (list) – KEGG Transport IDs to search for, eg [‘3.A.3.2’].
ec (list) – EC codes to search for, eg [‘2.5.1.19’].
des (list) – gene function descriptions to search for.
pfam (list) – PFAM domains to search for, eg [‘Pyridox_ox_2’].
annot (bool) – if
True, return the functional annotation table instead of the PAM.model (cobra.Model) – if not
None, create a new column modeled as first, revealing the presence of each cluster in the model.rid (list) – show clusters involved in the specified reactions (provided their IDs). Requires
model.
- Returns:
filtered PAM or annotation table.
- Return type:
pandas.DataFrame
- gempipe.interface.gaps.import_from_universe(model, universe, rid, bounds=None, gpr=None)[source]
Insert a new reaction taken from a universe model.
- Parameters:
model (cobra.Model) – target model to expand with new reactions.
universe (cobra.Model) – universe model, source of new reactions.
rid (str) – Id of the reaction to transfer.
bounds (tuple) – bounds to apply to the inserted reaction, eg (0, 1000). If
None, bounds from universe will be retained.gpr (str) – GPR to associate to the inserted reaction. If
None, no GPR will be associated.
- gempipe.interface.gaps.ss_preview(panmodel, accession)[source]
Create a preview of a strain-specific model given its accession and the starting draft pan-GSMM.
- Parameters:
panmodel (cobra.Model) – draft pan-GSMM (ideally undergoing manual curation) from which to derive the strain-specific model.
accession (str) – accession of the strain for which to derive the strain-specific model.
- Returns:
strain-specific metabolic model.
- Return type:
cobra.Model
- gempipe.interface.gaps.biolog_preview(model, starting_C=None, starting_N=None, starting_P=None, starting_S=None, seed=False)[source]
Get a preview of of the Biolog simulations for the provided model.
- Parameters:
model (cobra.Model) – target model.
starting_C (str) – starting C source; if None, will be assigned to EX_glc__D_e or EX_cpd00027_e0 depending on the selected database.
starting_N (str) – starting N source; if None, will be assigned to EX_nh4_e or EX_cpd00013_e0 depending on the selected database.
starting_P (str) – starting P source; if None, will be assigned to EX_pi_e or EX_cpd00009_e0 depending on the selected database.
starting_S (str) – starting S source; if None, will be assigned to EX_so4_e or EX_cpd00048_e0 depending on the selected database.
seed (bool) – if True, use the SEED notation instead of the BiGG notation.
- Returns:
Biolog simulations.
- Return type:
pandas.DataFrame
- gempipe.interface.gaps.add_reaction(model, rid, rstring, bounds=None, name='', gpr=None)[source]
Add a new reaction to the model.
Useful for example when the universe needs to be expanded.
- Parameters:
model (cobra.Model) – target model to expand with the new reaction.
rid (str) – ID for the new reaction.
rstring (str) – string describing the reaction.
bounds (set) – lower and upper bound for the new reaction.
name (str) – a name for the new reaction.
gpr (str) – string describing the GPR.
- gempipe.interface.gaps.add_metabolite(model, mid, formula=None, charge=None, name='')[source]
Add a new metabolite to the model.
Useful for example when the universe needs to be expanded.
- Parameters:
model (cobra.Model) – target model to expand with the new metabolite.
mid (str) – ID for the new metabolite.
formula (str) – string the chemical formula.
charge (int) – charge of the metabolite.
name (str) – a name for the new metabolite.
- gempipe.interface.gaps.search_similar(panmodel, rid, field='ko', unmod=False, species=None, showgpr=False, forceshow=False)[source]
Search the PAM for gene clusters having functional annotation similar to that of gene clusters involved in the specified reaction of the pan-GSMM.
First, the reaction rid is extracted from the panmodel. Then, gene clusters are extracted from its GPR. The PAM is finally searched for all the gene clusters having the same functional annotation in one of the following fields: ‘ko’, ‘pfam’, ‘kt’, and ‘ec’.
- Parameters:
panmodel (cobra.Model) – a pan-GSMM having the reaction rid.
rid (str) – ID of the reaction using the gene clusters on which to focus the search.
field (str) – functional annotation field to be used to extract similar gene clusters.
unmod (bool) – if
True, show only gene clusters that are not yet part of the panmodel (unmodeled).species (str) – show only columns (genomes) having this substring in thier name (useful to filter for particular species or strains).
showgpr (bool) – if
True, show the pan-GSMM GPR of the selected reaction rid.forceshow (bool) – if
True, display the results table with no limits on the number of displayable rows and columns.
- Returns:
PAM-derived results table, mixing presence/absence of gene clusters together with their functional annotation.
- Return type:
pandas.DataFrame