dexom_python package
Submodules
dexom_cluster_results module
- dexom_python.dexom_cluster_results.analyze_dexom_cluster_results(in_folder, out_folder, approach=1, filenums=100)[source]
- Parameters
in_folder (folder containing dexom results) –
out_folder (folder in which output files will be saved) –
approach (which parallelization approach was used (1, 2, or 3, see enum_functions/enumeration for details)) –
filenums (number of parallel dexom threads that were run) –
gpr_rules module
- dexom_python.gpr_rules.apply_gpr(model, gene_weights, modelname, save=True, filename='reaction_weights')[source]
Applies the GPR rules from a given metabolic model for creating reaction weights
- Parameters
model (cobra.Model) – a cobrapy model
gene_weights (dict) – a dictionary containing gene IDs & weights
modelname (str) – the name of the model
save (bool) – if True, saves the reaction weights as a csv file
- Returns
reaction_weights
- Return type
dict where keys = reaction IDs and values = weights
- dexom_python.gpr_rules.expression2qualitative(genes, column_list=[], proportion=0.25, method='keep', save=True, outpath='geneweights')[source]
- Parameters
expression (pandas.DataFrame) – dataframe with gene IDs in the index and gene expression values in a later column
column_idx (list) – column indexes containing gene expression values to be transformed. If empty, all columns will be transformed
proportion (float) – proportion of genes to be used for determining high/low gene expression
method (str) – one of “max”, “mean” or “keep”. chooses how to deal with genes containing multiple conflicting expression values
save (bool) – if True, saves the resulting gene weights
outpath (str) – if save=True, the .csv file will be saved to this path
- Returns
gene_weights (a pandas DataFrame containing qualitative gene weights)
(-1 for low expression, 1 for high expression, 0 for in-between)
imat module
Integrative Metabolic Analysis Tool
- param model
A constraint-based model
- type model
cobra.Model
- param reaction_weights
keys are reaction ids, values are int weights
- type reaction_weights
dict
- param epsilon
activation threshold for highly expressed reactions
- type epsilon
float
- param threshold
activation threshold for all reactions
- type threshold
float
- param timelimit
time limit (in seconds) for the model.optimize() call
- type timelimit
int
- param feasibility
feasibility tolerance of the solver
- type feasibility
float
- param mipgaptol
MIP Gap tolerance of the solver
- type mipgaptol
float
- param full
if True, apply constraints on all reactions. if False, only on reactions with non-zero weights
- type full
bool
- returns
solution
- rtype
cobra.Solution
main module
model_functions module
- dexom_python.model_functions.check_model_options(model, timelimit=None, feasibility=1e-06, mipgaptol=0.001, verbosity=1)[source]
- dexom_python.model_functions.get_all_reactions_from_model(model, save=True, shuffle=True, out_path='')[source]
- Parameters
model (cobra.Model) –
save (bool) – by default, exports the reactions in a csv format
shuffle (bool) – set to True to shuffle the order of the reactions
out_path (str) – output path
- Returns
rxn_list
- Return type
A list of all reactions in the model
- dexom_python.model_functions.get_subsystems_from_model(model, save=True, out_path='')[source]
Creates a list of all subsystems of a model and their associated reactions
- Parameters
model (cobra.Model) –
save (bool) –
out_path (str) –
- Returns
rxn_sub (pandas.DataFrame) – a DataFrame with reaction names as index and subsystem name as column
sub_list (list) – a list of subsystems
- dexom_python.model_functions.load_reaction_weights(filename, rxn_names='reactions', weight_names='weights')[source]
loads reaction weights from a .csv file
- Parameters
filename (str) – the path + name of a .csv file containing reaction weights
rxn_names (str) – the name of the column containing the reaction names
weight_names (str) – the name of the column containing the weights
- Returns
reaction_weights
- Return type
dict
pathway_enrichment module
- dexom_python.pathway_enrichment.Fischer_groups(model, solpath, outpath='test')[source]
!!! This only works if the pathway name is stored in the model.groups property !!! For models where the pathways are stored in the model.reactions.subsystem property, use the Fischer_pathways function
Performs pathway over- and underrepresentation analysis
- Parameters
solpath (file containing DEXOM solutions) –
subframe (csv file associating reactions with subsystems) –
sublist (list of subsystems) –
outpath (path to which results are saved) –
- Returns
over, under
- Return type
pandas.DataFrames (saved as .csv files) containing -log10 BH-adjusted p-values
- dexom_python.pathway_enrichment.Fisher_pathways(solpath, subframe, sublist, outpath='')[source]
!!! This only works if the pathway name is stored in the model.reaction.subsystem property !!! For models where the pathways are stored in the model.groups property, use the new Fischer_groups function
Performs pathway over- and underrepresentation analysis
- Parameters
solpath (file containing DEXOM solutions) –
subframe (csv file associating reactions with subsystems) –
sublist (list of subsystems) –
outpath (path to which results are saved) –
- Returns
over, under
- Return type
pandas.DataFrames (saved as .csv files) containing -log10 BH-adjusted p-values
dexom_python.result_functions module
- dexom_python.result_functions.plot_pca(solution_path, rxn_enum_solutions=None, save=True, save_name='')[source]
Plots a 2-dimensional PCA of enumeration solutions
- Parameters
solution_path (str) – csv file of enumeration solutions
rxn_enum_solutions (str) – csv file of enumeration solutions. If specified, will plot these solutions in a different color
save (bool) – if True, the pca-plot will be saved
save_name (str) – name of the file to save
- Returns
pca
- Return type
sklearn.decomposition.PCA
- dexom_python.result_functions.write_solution(model, solution, threshold, filename='imat_sol.csv')[source]
Writes an optimize solution as a txt file. The solution is written in a column format :param solution: :type solution: cobra.Solution :param threshold: :type threshold: float :param filename: :type filename: str
dexom_python.toy_models module
- dexom_python.toy_models.create_reaction(model, rname, formula, gene_rule=None, fullname=None, lower_bound=0.0, upper_bound=1000.0)[source]
- dexom_python.toy_models.dagNet(num_layers, num_metabolites_per_layer, export=False, solver='cplex')[source]
Creates a dagNet model where the metabolites of successive layers are all interconnected :param num_layers: number of layers :type num_layers: int :param num_metabolites_per_layer: number of metabolites per layer :type num_metabolites_per_layer: int :param export: if True, exports the model as .json and the reaction weights as .csv :type export: bool :param solver: a valid cobrapy solver :type solver: str
- Returns
model (cobra.Model)
reaction_weights (dict)