Documentation
io
Classes
HiddenPrints
Supress package print messages.
Functions
read_metabolic_model(file_name: str) -> Model
Read a metabolic model from sbml format with .xml extension
| Parameters: |
|
|---|
| Returns: |
|
|---|
load_metabolic_model(model_file: Union[str, cobra.core.model.Model]) -> Model
Reads in metabolic model, checking for appropriate type.
| Parameters: |
|
|---|
| Returns: |
|
|---|
read_psim(psim_file: str, h5_key: Optional[str] = None) -> DataFrame
Read the PSIM from .csv or .h5 format.
| Parameters: |
|
|---|
| Returns: |
|
|---|
load_psim(psim_file: Union[str, pandas.core.frame.DataFrame], **kwargs) -> DataFrame
Reads in PSIM, checking for appropriate type.
| Parameters: |
|
|---|
| Returns: |
|
|---|
read_pickled_object(file_name: str)
Read an object as a pickled file.
| Parameters: |
|
|---|
| Returns: |
|
|---|
read_pickled_me_model(file_name: str)
Loads a pickled me_model. Saved from me_model.pickle.
| Parameters: |
|
|---|
| Returns: |
|
|---|
load_ME_model(model_file)
Reads in ME model, checking for appropriate type.
| Parameters: |
|
|---|
| Returns: |
|
|---|
write_metabolic_model(m_model: Model, file_name: str, **kwargs) -> None
Write a metabolic model to smbl format with .xml extension.
| Parameters: |
|
|---|
write_pickled_object(object: Any, file_name: str) -> None
Save an object as a pickled file.
| Parameters: |
|
|---|
write_stoichiometric_matrix(me_model, file_name: str, mu_val: Union[int, float])
Writes the ME Model stoichiometric matrix as a scipy sparse array (.npz), replacing growth rate parameters
with a specific value. Column (reaction IDs) and row (metabolite IDs) are separately written to text files.
| Parameters: |
|
|---|
preprocess
special
Modules
correct_inputs
Functions
bool_metabolite(m_id: str, compartment: str, m_model: Model) -> Tuple[bool, cobra.core.metabolite.Metabolite]
Checks if a metabolite is in the model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
correct_model(model_file: Union[cobra.core.model.Model, str] = '/data3/hratch/me_analyses_1/inputs/recon2_2.xml', biomass_reaction_id: str = 'biomass_reaction', correct_biomass: bool = False) -> Tuple[cobra.core.model.Model]
Makes necessary changes to cobrapy model, largely based on issues encountered with Recon2.2.
Note that because the ME Model will create a new objective function, the input model's biomass objective function is removed. The returned models cm_1 and cm_2 allow the user to compare corrected metabolic models with intact biomass objective functions with the output ME Model from human_me.build.build_me_model.build_me. We recommend using cm_1 for comparisons.
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_non_machinery(non_machinery: Optional[Dict[str, List[str]]] = None) -> Dict[str, List[str]]
Runs checks on non-machinery input list. Non-machinery are categorized as any proteins to express in the ME-Model that are not catalyzed in the reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_status(psim_me: DataFrame) -> DataFrame
Checks sequence columns for validity.
correct_psim(me_input_model: Union[cobra.core.model.Model, str], psim_df: Union[pandas.core.frame.DataFrame, str] = '/data3/hratch/me_analyses_1/build/psim_gold.h5', fill_na: str = 'default', non_machinery: Optional[Dict[str, List[str]]] = None)
Makes sure PSIM has all necessary correct information to build ME Model.
Note, the default psim_file, build/psim_gold.h5, is a PSIM generated from MANE/RefSeq Select isoforms. We refer to this as the gold standard "psim_gold".
| Parameters: |
|
|---|
| Returns: |
|
|---|
format_exchanges(m_model)
Formats typical exchange reactions (transport across ECM) as those in recon2.2 (LPAREN_e_RPAREN_, transport across boundary)
for the input metabolic model.
| Parameters: |
|
|---|
parse_complex
Functions
eval_complex_recur_full(expr)
Recursive parsing of gprs into lists of complexes. Input expr is a cobra.parse_gpr(gpr_string),
output is a list of lists, each entry of which is a complex joined by 'AND'; netsted lists are joined with each other by 'OR'.
Inspired by corda source code.
eval_complex(expr: str) -> List[Union[str, List[str]]]
Parse reaction GPRs into separate complexes.
| Parameters: |
|
|---|
| Returns: |
|
|---|
core
special
Modules
biomass
Classes
Biomass (Metabolite)
An object of type Biomass inherited from cobra.Metabolite
Functions
create_total_protein_formation(unmodeled_protein_fraction: float = 0) -> BiomassReaction
Total protein biomass formed from the modeled and unmodeled protein biomass in proportional amounts.
| Parameters: |
|
|---|
| Returns: |
|
|---|
create_constant_component_formation(model_metabolites, mass_fraction: Dict[str, float] = {'DNA': 0.014, 'carbohydrate': 0.071, 'lipid': 0.097, 'other': 0.054}, biomass_coefficients: Dict = {'DNA': {'datp_n': -0.941642857142857, 'dctp_n': -0.674428571428572, 'dgtp_n': -0.707, 'dttp_n': -0.935071428571429, 'ppi_n': 3.2581428571428583}, 'carbohydrate': {'g6p_c': -3.87591549295775}, 'lipid': {'chsterol_c': -0.09580101814936463, 'clpn_hs_c': -0.05474478062767954, 'pail_hs_c': -0.10948486535720975, 'pchol_hs_c': -0.7253284281824849, 'pe_hs_c': -0.26003066413425396, 'pglyc_hs_c': -0.01368384720784515, 'sphmyln_hs_c': -0.08211247504336976, 'ps_hs_c': -0.02737239031383982}, 'other': None})
Generations formation of biomass components for components that have constant mass (i.e., DNA, lipids, carbohydrates, and other, but not RNA/protein).
| Parameters: |
|
|---|
| Returns: |
|
|---|
add_biomass_change(reaction: Reaction, inplace: bool = True) -> Union[NoneType, Dict[str, float]]
Calculate net biomass change in a reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_m_biomass(m_model: Model, biomass_reaction_id: str = 'biomass_reaction', tol: float = 10, *args, **kwargs)
Performs sanity checks on biomass objective of metabolic model.
If using Recon2.2 biomass formulation, this will give warnings. If warnings are given, we recommend using our correct_m_biomass function.
| Parameters: |
|
|---|
correct_m_biomass(m_model: Model)
Sets biomass objective to the default one that is used by ME Model.
Will correct any mass balance issues in the biomass objective (these mass balance issues are present in Recon2.2).
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_me_biomass(me_model) -> Dict[str, float]
Sanity chack that the ME Model biomass component formation reactions for DNA, lipid, and carbohydrate are formulated correctly.
This is done by checking mass balance -- that the metabolites sum(stoichiometric coefficient * metabolic weight) = mass fraction
| Parameters: |
|
|---|
| Returns: |
|
|---|
gene
Classes
ExpressedGene
Tracks all reactions and macromolecules associated with a ME Model gene.Designed to be used after building the full ME_Model.
add_reaction(self, r: Union[human_me.core.reaction.MetabolicReaction, human_me.core.reaction.ExpressionReaction])
Organizes ME_Model reaction into self.reactions attribute.
| Parameters: |
|
|---|
is_catalyzing(self, r) -> bool
Determines whether the gene is involved in catalysis of the reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
add_macromolecule(self, m)
Updates self.macromolecules with m.
| Parameters: |
|
|---|
check(self)
Checks for completeness of self.reactions and self.macromolecules after adding all associated objects.
macromolecules
special
Modules
RNA
RNA (Macromolecule)
get_base_counts_and_elements(self)
Updates RNA metabolite to have appropriate formula according to sequence.
synthesize(self, id_: str) -> ExpressionReaction
Generates a reaction for transcription of an RNA molecule (NTPs-->RNA).
| Parameters: |
|
|---|
| Returns: |
|
|---|
exonucleolytic_degradation(self, reaction_name: str, balanced: bool = True, update: bool = False) -> ExpressionReaction
Generates a reaction for exonucleolytic cleavage of an RNA molecule (RNA-->NMPs).
| Parameters: |
|
|---|
| Returns: |
|
|---|
update_metabolite(self, seq: str, append: bool = False, append_to: Optional[str] = None)
Updates the RNA metabolite information according to an input sequence string.
| Parameters: |
|
|---|
copy(self)
Overwrite cobra.Species.copy.
pre_mRNA (RNA)
premRNA macromolecule object representation.
mRNA (RNA)
mRNA macromolecule object representation.
make_proxy(self)
Makes a proxy metabolite for coupling mRNA degradation to protein synthesis.
tRNA (RNA)
tRNA macromolecule object representation.
rRNA (RNA)
rRNA macromolecule object representation.
RNA_fragment (RNA)
object representation of fragmented RNA such as lariats and other excised sequences.
complex
Complex (Macromolecule)
Complexes formed by non-covalent interactions between macromolecules.
update_id(self, new_id: Optional[str] = None)
In cases where complex id is too long (see build_me_model generate_complex_reactions method).
form_complex(self, reaction_id: Optional[str] = None, reversible: bool = False, synthesis: bool = True, synthesis_type: str = 'complex') -> ExpressionReaction
The reaction to generate the Complex object.
Note: assumes non-covalent complex formation (in terms of elemental balance)
| Parameters: |
|
|---|
| Returns: |
|
|---|
decompose_complex(self, decomposed_complex = None) -> OrderedDict
Recursive method to get the complex by its individual components, including nested complexes.
get_complex_biomass(self) -> Dict[str, float]
Returns a dictionary of the complex biomass by its individual component types.
change_compartment(self, new_compartment: str)
Returns a copy of the complex metabolite, but in new compartment.
make_proxy(self)
Make a proxy metabolite for coupling enzyme degradation to reaction catalysis.
copy(self, copy_metabolites = False)
Overwrite cobra.Species.copy.
| Parameters: |
|
|---|
| Returns: |
|
|---|
RibosomalComplex (Complex)
Complexes specifically associated with ribosome biogenesis, which has RNA-protein complexes and multiple compartments.
decompose_complex(self, decomposed_complex = None)
Recursive method to get the complex by its individual components, including nested complexes.
form_complex(self, reaction_id: Optional[str] = None, reversible: bool = False, synthesis: bool = False, synthesis_type: Optional[str] = None) -> ExpressionReaction
The reaction to generate the Complex object.
Note: assumes non-covalent complex formation (in terms of elemental balance)
| Parameters: |
|
|---|
| Returns: |
|
|---|
add_complex_metabolites(cplx: Complex, met_to_add: Dict[human_me.core.macromolecules.macromolecule.Macromolecule, int], complex_id: str) -> Complex
Add a metabolite to an existing complex object, returning it as a new complex.
| Parameters: |
|
|---|
| Returns: |
|
|---|
macromolecule
Macromolecule (Metabolite)
change_compartment(self, new_compartment: str)
Create a macromolecule the same as self, but in a different compartment.
| Parameters: |
|
|---|
| Returns: |
|
|---|
couple(self, type: str, value: SupportsFloat)
Stores coupling information for macromolecule.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Proxy (Macromolecule)
Proxy macromolecules for c2/c4 coupling of degradation.
couple(self, value: SupportsFloat)
Stores coupling information for proxy.
| Parameters: |
|
|---|
| Returns: |
|
|---|
protein
Protein (Macromolecule)
Protein macromolecule object representation.
make_proxy(self)
Make a proxy metabolite for coupling enzyme degradation to reaction catalysis.
copy(self)
Overwrite cobra.Species.copy.
model
Classes
ME_Model (Model)
ME_Model class analogous to cobrapy.model class
add_reactions(self, reaction_list: List[cobra.core.reaction.Reaction])
Add reactions to the model
| Parameters: |
|
|---|
remove_reactions(self, reactions: List[Union[cobra.core.reaction.Reaction, str]], remove_orphans: bool = True)
Remove reactions from the model.
| Parameters: |
|
|---|
create_stoichiometric_matrix(self, array_type: str = 'numpy', mu_val: Optional[SupportsFloat] = None, inplace: bool = True)
Generate a stoichiometric array representation of the model.
Adapted from cobra.util.array.create_stoichiometric_matrix to handle sympy.Expr objects.
| Parameters: |
|
|---|
| Returns: |
|
|---|
replace_mu(self, mu_val)
Replaces reaction bounds and stoichiometric coefficients that are a function of
growth rate with a specific growth rate value. Done inplace.
initialize_solver(self, solver_type: str = 'qminos')
Initialize the ME Model solver.
solver_type : str The solver to use for the linear programs (options ['qminos']), by default "qminos"
solve_lp(self, mu_val: SupportsFloat, objective: Optional[Dict[str, int]] = None, tolerance: SupportsFloat = 0, additional_equality_constraints: List[Dict[SupportsFloat, Dict[str, SupportsFloat]]] = None, **kwargs) -> Tuple[<built-in function array>, int]
Solves the linear program for a specified objective at a specified growth rate.
| Parameters: |
|
|---|
| Returns: |
|
|---|
maximize_growth(self, min_mu: SupportsFloat = 0, max_mu: SupportsFloat = 0.05, mu_accuracy: SupportsFloat = 1e-10, increment: SupportsFloat = 0.02, tolerance: SupportsFloat = 0, verbose: bool = True, additional_equality_constraints: List[Dict[SupportsFloat, Dict[str, SupportsFloat]]] = None, **kwargs)
Binary search to find the maximum feasible growth rate.
| Parameters: |
|
|---|
| Returns: |
|
|---|
optimize(self, objective: Dict[str, int], mu_max: SupportsFloat, n_points: Union[int, list] = 10, tolerance: SupportsFloat = 0, visualize: bool = True, fig_name: str = None, additional_equality_constraints: List[Dict[SupportsFloat, Dict[str, SupportsFloat]]] = None, **kwargs)
General optimization of any non-growth objective.
| Parameters: |
|
|---|
| Returns: |
|
|---|
format_solution(self, sln: List[float]) -> DataFrame
Fromats the LP output into a pandas DataFrame to map reaction IDs
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_me_mass_balance(self)
Check that all reactions in ME Model are mass balance. Use after self.add_reactions.
check(self)
Check ME Model built correctly.
create_expressed_gene(hgnc_id: str, relat_objects) -> ExpressedGene
staticmethod
Create the ExpressedGene objects associated with the reaction.
knock_out_gene(self, hgnc_id: str, inplace: bool = False)
Knocks out a gene by blocking flux through synthesis of the associated mRNA molecule
| Parameters: |
|
|---|
pickle(self, file_name: str = '/home/hratch/Projects/human_me/me_model.pickle')
Save ME_Model as a pickled object
| Parameters: |
|
|---|
load_pickled_model(file_name: str)
staticmethod
Loads a pickled me_model. Saved from me_model.pickle.
| Parameters: |
|
|---|
| Returns: |
|
|---|
copy(self)
Provides a partial 'deepcopy' of the Model. All of the Metabolite,
Gene, and Reaction objects are created anew but in a faster fashion than deepcopy
reaction
Classes
ME_Reaction (Reaction)
Allows stochiometric coefficient to be a function of mu.
reactants
property
readonly
Return a list of reactants for the reaction.
products
property
readonly
Return a list of products for the reaction.
copy(self)
Overwrite cobra.Species copy method.
| Returns: |
|
|---|
couple(self, metabolites, types: Union[List[str], str])
Add coupling coefficient and associated metadata to reaction for a coupled metabolite.
| Parameters: |
|
|---|
build_reaction_string(self, use_metabolite_names: bool = False)
Generate a human readable reaction string.
check_mass_balance(self, tol: SupportsFloat = 0, sympy_tol: SupportsFloat = 1e-15) -> Dict[str, float]
Compute mass and charge balance for the reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
replace_coefficient_mu(self, mu_val: SupportsFloat, inplace: bool = True)
Replace mu coefficients with an actual value.
| Parameters: |
|
|---|
MetabolicReaction (ME_Reaction)
Inherited from ME_Reaction, specifies the metabolic reactions in the model.
ExpressionReaction (ME_Reaction)
Inherited from ME_Reaction, specifies the expression reactions in the model.
ProteinExpressionReaction (ExpressionReaction)
Inherited from ExpressionReaction, specifies the protein expression reactions in the model.
ProteinDegradationReaction (ExpressionReaction)
copy(self)
Also couple ._macromolecules.
ComplexDegradationReaction (ExpressionReaction)
copy(self)
Also couple ._macromolecules.
BiomassReaction (Reaction)
Specifies biomass reactions in the model, allowing reaction bounds to be a function of mu.
reversibility: bool
property
readonly
Whether the reaction can proceed in both directions (reversible). This is computed from the current upper and lower bounds.
replace_bound_mu(self, mu_val: SupportsFloat = 1, values: Optional[List[sympy.core.expr.Expr]] = None, inplace: bool = False, _ub: bool = True)
Gives numeric values to bounds. Assums growth is always > 0.
| Parameters: |
|
|---|
build_reaction_string(self, use_metabolite_names: bool = False)
Generate a human readable reaction string.
Functions
to_metabolic_reaction(model_metabolites, reaction: Reaction, id: Optional[str] = None) -> MetabolicReaction
Convert a cobrapy Reaction to a ME_Model MetabolicReaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
expression
special
Modules
build_ribosome_biogenesis_reactions
Functions
set_ribosomal_psim(psim_me: DataFrame) -> DataFrame
Format psim information specifically for ribosomal biogenesis.
| Parameters: |
|
|---|
| Returns: |
|
|---|
cleave_ub(hgnc_id: str, model_metabolites, psim_rib, ub_args: Dict[str, Any], compress_mrna: bool, charged_trna_map, modified_trna_transcript_c, stochastic: bool, seeds: List[int])
Generates reactions specific for ubiquitin-protein fusions. RPL40 and RPS27A have ubiquitin fusions.
| Parameters: |
|
|---|
build_ribosome_protein_expression_reactions(model_metabolites, psim_rib, modified_trna_transcript_c, charged_trna_map, ub_args: Dict[str, Any], compress_mrna: bool, stochastic: bool, seeds: List[int])
Reactions associated with transcription and translation of ribosomal proteins.
| Parameters: |
|
|---|
build_ribosome(model_metabolites, psim_rib, modified_trna_transcript_c, charged_trna_map, ub_args: Dict[str, Any], compress_mrna: bool, reversible_complex_formation: bool, stochastic: bool, seed: int)
Generate all ribosome biogenesis reactions.
| Parameters: |
|
|---|
build_trna_expression_reactions
Classes
ExpressTrna
process_trna(self)
This reaction processes pre-tRNA into mature tRNA in the nucleus.
This includes: CCA synthesis, 5' leader and 3' trailer cleavage (and degradation as separate reactions), and splicing (and intron degradation as a separate reactions for each intron).
modify_trna_cytosolic(self)
This is for cytosolic modifications.
charge_trna(self)
tRNA charging reaction combines the activation and charging steps into one reaction.
Functions
trna_biogenesis(trna_info: TrnaInformation) -> Tuple[List[human_me.core.reaction.ExpressionReaction], List[human_me.core.macromolecules.RNA.tRNA]]
trna biogenesis reactions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
gene_expression
special
Modules
build_mrna_expression_reactions
ExpressMrna
Gene-specific mRNA expression.
transcribe_premrna(self) -> None
Elongation reaction.
process_mrna(self) -> None
Processing includes capping, splicing, and polyA tail.
export_mrna(self) -> None
Nuclear export of mRNA.
degrade_mrna(self, decapping: bool = True, three_to_five: bool = False) -> None
Currently, only one of the two degradation pathways is included. We assume the 5' to 3' pathway is present. This is simply to limit the total number of reactions
| Parameters: |
|
|---|
compress_mrna_module(self)
Condense elongation, processing, and nuclear export reactions into a single reaction.
get_mrna_expression_reactions(gene_info, model_metabolites, compress_mrna: bool = False)
Generates reactions and macromolecules associated with transcription of a gene.
| Parameters: |
|
|---|
| Returns: |
|
|---|
gene_information
GeneInformation
This class compiles all the necessary information for a given transcript/protein to be expressed in the
ME model.
Notes: 1) As of right now, machinery PTMs are not considered. Only non-machinery proteins processed via the secretory pathway can have PTMs.
get_final_locations(self, reactions: Optional[List[cobra.core.reaction.Reaction]] = None, nonmachinery_locations: Optional[List[str]] = None) -> None
Assigns a set of final compartments for the protein. For machinery, extracts this from the input cobrapy model. This method helps define necessary transport reactions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
check(self)
Run checks on GeneInformation methods.
format_final_locations(final_locations: List[str], sp: bool, hgnc_id: str) -> Dict[str, str]
Map a proteins location to the means of transport.
| Parameters: |
|
|---|
| Returns: |
|
|---|
generate_from_psim(hgnc_id: str, psim: DataFrame, machinery_list: List[str], reactions: Optional[List[cobra.core.reaction.Reaction]] = None, nonmachinery_locations: Optional[List[str]] = None, stochastic: bool = False, seed: int = None) -> GeneInformation
Generates gene information object from PSIM. Assumes the gene information object being generated is not for a non-machinery protein.
| Parameters: |
|
|---|
| Returns: |
|
|---|
protein_expression
special
build_protein_expression_reactions
fold_protein_cytosolic(gene_info, unfolded_protein_c: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Fold cytosolic proteins.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transport_nuclear_protein(gene_info, folded_protein_c: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Nucleocytoplasmic transport of proteins.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_nuclear_reactions(gene_info, folded_protein_c: Protein, ub_args: Dict[str, Any], model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
All associated nuclear protein formation reactions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transport_mitochondrial_matrix(gene_info, unfolded_protein_c: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Protein transport to mitochondrial matrix.
| Parameters: |
|
|---|
| Returns: |
|
|---|
mitochondrial_matrix_protein_processing(gene_info, pre_protein_m: Protein) -> Tuple[Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]], Dict[str, int], int]
Cleavage of MTS - unimplemented.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transport_mitochondrial_inter(gene_info, processed_protein_m: Protein) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Transport of protein to inter membrane space.
| Parameters: |
|
|---|
| Returns: |
|
|---|
mitochondrial_inter_protein_processing(gene_info, pre_protein_i: Protein) -> ProteinExpressionReaction
Processing of intermembrane mitochondrial protein.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_mitochondrial_reactions(gene_info, unfolded_protein_c: Protein, compartments: List[str], model_metabolites) -> Tuple[List[Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]]]
Generate all mitochondrial transport reactions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transport_peroxisome(gene_info, folded_protein_c: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Transport of proteins to peroxisome.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_peroxisomal_reactions(gene_info, folded_protein_c: Protein, model_metabolites)
All peroxisomal protein expression reactions.
| Parameters: |
|
|---|
post_translational_translocation(gene_info, unfolded_protein_c: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Post translational translocation to ER.
| Parameters: |
|
|---|
| Returns: |
|
|---|
form_disulfide_bond(gene_info, folded_protein_r: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Disulfide bond formation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
form_gpi(gene_info, modified_protein_r: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
GPI formation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
modify_protein_er(gene_info, folded_protein_r: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
All ER associated PTMs.
| Parameters: |
|
|---|
| Returns: |
|
|---|
import_golgi(gene_info, modified_protein_r: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Golgi transport.
| Parameters: |
|
|---|
| Returns: |
|
|---|
glycosylate_o_linked(gene_info, protein_g: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
O-linked glycosylation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
modify_protein_golgi(gene_info, protein_g: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
All PTM modifications in Golgi.
| Parameters: |
|
|---|
| Returns: |
|
|---|
secrete_protein(gene_info, modified_protein_g: Protein, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Reactions associated with lysosomal, ECM, and plasma membrane transport.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_protein_expression_reactions(gene_info, mrna_transcript_c, mrna_deg_proxy, ub_args: Dict[str, Any], modified_trna_transcript_c, charged_trna_map, model_metabolites) -> Tuple[Union[List[human_me.core.reaction.ProteinExpressionReaction], human_me.core.reaction.ProteinExpressionReaction, List[human_me.core.reaction.ProteinDegradationReaction], human_me.core.reaction.ProteinDegradationReaction], Union[List[human_me.core.macromolecules.protein.Protein], human_me.core.macromolecules.protein.Protein]]
Generate all translation, processing, transport, and degradation reactions for protein monomers.
| Parameters: |
|
|---|
| Returns: |
|
|---|
cytosolic_translation
translate_protein_cytosolic(gene_info, mrna_transcript_c, mrna_deg_proxy: Proxy, modified_trna_transcript_c, charged_trna_map, model_metabolites) -> Tuple[human_me.core.reaction.ProteinExpressionReaction, human_me.core.macromolecules.protein.Protein]
Generate cytosolic translation reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degradation
protein_polyubiquitination(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs) -> Tuple[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction], Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex]]
Adds 4 ubiquitins to the macromolecule.
| Parameters: |
|
|---|
| Returns: |
|
|---|
proteasomal_degradation(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Protoeasomal degradation of macromolecule.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degrade_cytosolic_nuclear_protein(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Degradation reactions for cytosolic or nuclear proteins.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degrade_mitochondrial_protein(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Degradation reactions for proteins localized to mitochondria.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degrade_peroxisomal_protein(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Degradation rof proteins localized to peroxisome.
| Parameters: |
|
|---|
| Returns: |
|
|---|
unfold_secretory_protein(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites) -> Tuple[Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex]]
Remove PTMs and unfold proteins for lysosomal and secretory compartments. For lysosomal degradation, only remove PTMs, there is no unfolding/misfolding as in ERAD.
| Parameters: |
|
|---|
| Returns: |
|
|---|
retrograde_er(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, retro_protein_r: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex] = None) -> Tuple[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction], Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex]]
ER retrograde transport.
| Parameters: |
|
|---|
| Returns: |
|
|---|
build_erad_reactions(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs)
Generate all ERAD reactions.
| Parameters: |
|
|---|
build_endocytosis_reactions(macromolecule_pm: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs) -> Tuple[List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]], Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex]]
Create the endocytosis reactions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
lysosomal_degradation(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Generate reactions and associated macromolecules for lysosomal degradation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degrade_lysosomal_pm_protein(macromolecule: Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction], model_metabolites, **kwargs) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Lysoomal degradation of membrane proteins.
| Parameters: |
|
|---|
| Returns: |
|
|---|
degrade(macromolecule: Union[human_me.core.macromolecules.protein.Protein, human_me.core.macromolecules.complex.Complex], model_metabolites, **kwargs) -> List[Union[human_me.core.reaction.ProteinDegradationReaction, human_me.core.reaction.ComplexDegradationReaction]]
Compartment-specific degradation reactions for proteins or protein-protein complexes.
| Parameters: |
|
|---|
| Returns: |
|
|---|
ubiquitin
express_ubiquitin(model_metabolites, psim_me: DataFrame, compress_mrna: bool, charged_trna_map, modified_trna_transcript_c) -> Dict[str, Any]
Reactions for formation of ubiquitin.
| Parameters: |
|
|---|
| Returns: |
|
|---|
utils
special
Modules
downstream_analyses
Functions
troubleshoot_me(me_model_file: str, mu_val: float = 1e-09, model_metabolite_ids: Optional[List[str]] = None, out_path: Optional[str] = None, *args, **kwargs)
Helps troubleshoot ME Model if solver finds infeasible solution at growth rate of "mu_val". Basic principle is to
iterate through the metabolites from the input metabolic model, add them as sinks, and see which are required as sinks to make the model feasible.
*Note, this results in identified metabolites required for feasability being dependent on the order they were iterated through. The metabolite list is run through _order_metabolites() to prioritize metabolites of certain types and in certain compartments.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_limiting_nutrients(me_model_file: str, max_feasible_mu: float, uptake_only: bool = False)
Identifies a list of limiting extracellular nutrients that prevent the ME Model from growing at 2.5% higher growth rate
| Parameters: |
|
|---|
correct_solution_precision(me_sln, me_model, min_precision_noise: float = 1e-20, use_bound_precision_floor: bool = False, precision_floor_thresh: float = 100, verbose: bool = True)
Correct fluxes that are out of bounds or below noise threshold due to solver feasibility tolerance (which is 1e-20 by default).
1) Resets flux values that violate bounds to the bound. 2) Resets flux values below minimum precision to 0. Either uses the optimizer tolerance value (by defaulte 1e-20) OR the maximum bound discrepancy, which may be > 1e-20.
| Parameters: |
|
|---|
| Returns: |
|
|---|
format_reaction_as_metabolic(reaction, expression_module: bool = False) -> Dict[str, Union[str, int]]
Returns a dictionary mapping a MEReaction to its respective metabolic model reaction, if it exists
| Parameters: |
|
|---|
| Returns: |
|
|---|
format_sln_as_metabolic(me_model, me_sln: DataFrame, neg_rev_flux = True)
For metabolic reactions, formats and aggregates (e.g. across reversibility or multiple reactions due to "OR" GPRs)
the ME Model solution to be comparable to the metabolic model solution. This should then be readily compared to the output of m_model.optimize().to_frame().
We recommend using the cm_2 output from preprocess.correct_inputs.correct_model as the comparable metabolic model. Though not necessary, a more fair comparison may be to set the growth rates (mu) of the metabolic and me model to be the same. In the cobra.Model metabolic model this can be done by setting the growth reaction bounds to be mu. In the me model, this can be specified with the "mu_val" parameter in the ME_Model.solve_lp method.
If comparing to cm_2, do not set neg_rev_flux to False.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_expression_fluxes(me_model, me_sln: DataFrame, molecule_type: str, group_by: str = 'sum', consider_degradation: bool = True, drop_ors: bool = False) -> float
Calculate the flux through gene expression for each gene in ME Model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_optimal_val(formatted_sln: DataFrame, objective: Dict[str, SupportsFloat]) -> float
Calculate the optimal value for the objective
| Parameters: |
|
|---|
| Returns: |
|
|---|
flux_variability_analysis(me_model, mu_val: float, reactions: List[str], primary_objective: Optional[Dict[str, SupportsFloat]] = None, optimal_val: float = None, tolerance: SupportsFloat = 0, n_cores: int = 0, **kwargs) -> DataFrame
Runs FVA on reactions of interest at a given growth rate.
| Parameters: |
|
|---|
| Returns: |
|
|---|
format_fva_as_metabolic(me_model, me_fva_df: DataFrame, concat_type: str = 'lenient')
Format the FVA to be comparable to the metabolic model reactions
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_enzyme_synthesis_reaction(reaction_id: str, me_model)
Given an enzyme-catalyzed reaction, identified the final expression reaction that forms the catalyzing enzyme.
| Parameters: |
|
|---|
functions
Functions
flatten_list(list1: List[List[Any]]) -> list
Create a single list from a list of lists.
| Parameters: |
|
|---|
| Returns: |
|
|---|
create_gene_reaction_map(reactions: List[cobra.core.reaction.Reaction]) -> Dict[str, List[cobra.core.reaction.Reaction]]
Maps each gene to all associated reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
convert_gi(gi, non_machinery: List[str])
[summary]
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_reaction_compartment(reaction: Reaction, stochastic: bool = False, seed: Optional[int] = None) -> str
Map reactions to a particular compartment according to some rules, informing the compartment the enzyme catalyzing the reaction should be transported to.
| Parameters: |
|
|---|
| Returns: |
|
|---|
hydrolyze_atp(metabolites_to_add: Dict[cobra.core.metabolite.Metabolite, Union[float, int]], n_atp: Union[float, int], compartment: str, model_metabolites) -> Dict[cobra.core.metabolite.Metabolite, Union[float, int]]
Create ATP hydrolysis reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_base_counts_and_elements(seq: Union[Bio.Seq.Seq, str], model_metabolites, triphosphate: bool = True) -> Tuple[Dict[str, int], Dict[str, int]]
Count the number of bases and atom elements in an RNA sequence.
| Parameters: |
|
|---|
| Returns: |
|
|---|
parse_me_reaction_id(x: str) -> str
Get HGNC ID associated with an expression module reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
SASA(mw: float) -> float
Estimate the protein solvent-accessible surface area from the molecular weight.
| Parameters: |
|
|---|
| Returns: |
|
|---|
average_protein_features(psim_me: DataFrame, hgnc_id: str, context_specific: bool = False, metabolic_machinery: Optional[List[str]] = None) -> DataFrame
Function to get the average protein features from the proteins used in a specific ME model being generated.
Note, we filter for metabolic enzymes only, because most orphan reactions come from the metabolic sector.
| Parameters: |
|
|---|
| Returns: |
|
|---|
determine_transport(r: Reaction) -> List[str]
Checks which metabolites are transported in a cobra reaction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
read_fasta_url(file_url: str)
Load a fasta format sequence from url.
| Parameters: |
|
|---|
| Returns: |
|
|---|
machinery
Functions
get_model_machinery(me_input_model) -> Tuple[List[str]]
Parse input metabolic model for metabolic machinery.
| Parameters: |
|
|---|
| Returns: |
|
|---|
metabolites
Classes
MetaboliteBin
Stores all metabolites used in model building
parameters
Classes
BiomassParameters
Stores Biomass reactions' asssociated coefficients and mass fractions in one object.
polyA_statistics
Functions
calculate_polyA_length(polyA_length: Union[int, float] = None, stochastic: bool = False, seed: Optional[int] = None) -> int
Calculates expected length of polyA tail based on input float and data distribution.
| Parameters: |
|
|---|
| Returns: |
|
|---|