dexom_python package
Subpackages
Submodules
dexom_python.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) –
dexom_python.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(expression_file, column_idx=- 1, percentage=25, method='keep', save=True, outpath='geneweights')[source]
- Parameters
expression_file (str) – path to file containing gene IDs in the first column and gene expression values in a later column
column_idx (int) – column indexes containing gene expression values to be transformed. If -1, all columns will be transformed
percentage (float) – percentage 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
dexom_python.imat module
- dexom_python.imat.create_new_partial_variables(model, reaction_weights, epsilon, threshold)[source]
- dexom_python.imat.imat(model, reaction_weights={}, epsilon=0.01, threshold=1e-05, full=False)[source]
Integrative Metabolic Analysis Tool
- Parameters
model (cobra.Model) – A constraint-based model
reaction_weights (dict) – keys are reaction ids, values are int weights
epsilon (float) – activation threshold for highly expressed reactions
threshold (float) – activation threshold for all reactions
timelimit (int) – time limit (in seconds) for the model.optimize() call
feasibility (float) – feasibility tolerance of the solver
mipgaptol (float) – MIP Gap tolerance of the solver
full (bool) – if True, apply constraints on all reactions. if False, only on reactions with non-zero weights
dexom_python.main module
dexom_python.model_functions module
- dexom_python.model_functions.check_model_options(model, timelimit=None, feasibility=None, mipgaptol=None, verbosity=None)[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) –
- 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
dexom_python.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_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_name (str) – name of the file to save
Returns – 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)