microbetag.seed_complementarity¶

Classes¶

ExportSeedComplementarities

Computes seed and non-seed sets and then exports complementarities.

Functions¶

kegg_module_related_intersect(intersect, modules_ms_cpd)

Check if KEGG MODULE related

get_kegg_module_related(seed_ko_mo)

Load map file with KEGG modules and their terms and return a set with all the KOs there

progress_tracker(queue, total)

Progress bar updater.

generate_fixed_pairwise_comparisons(fixed_item, ...)

Generate and return two lists: one with the fixed item in the first position and one with it in the second.

bigg_to_seed_mapping_df(metanetx_compounds)

load_seed_complement_files(path_to_kegg_seed_mappings)

Loads mapping files to be used for the building of the cx2 network.

build_url_with_seed_complements(seed_complements, ...)

load_confidence(confidence[, remove_suffix])

load_nonseeds(nonseeds[, remove_suffix])

Module Contents¶

class microbetag.seed_complementarity.ExportSeedComplementarities(config: microbetag.config.Config)[source]¶

Computes seed and non-seed sets and then exports complementarities.

It saves corresponding sets to json files.

Invokes edited version PhyloMInt modules as edited from microbetag team to support parallel calculation of the seed and non seed sets, and to consider reaction reversibility.

Cite:

Lam TJ, Stamboulian M, Han W, Ye Y. Model-based and phylogenetically adjusted quantification of metabolic interaction between microbial species. PLoS computational biology. 2020 Oct 30;16(10):e1007951.

Note

Thanks to the prev_conf and the prev_nonseeds attributes of the Config class, ExportSeedComplementarities is able to use pre-calculated seed and non-seed sets. This is how the on-the-fly version of microbetag runs the seed complementarity step.

get_sets()[source]¶

Get seed and non-seed sets for each model

get_scores_and_compls() Tuple[pandas.DataFrame, dict] | None[source]¶

Based on the seed and non-seed sets calculated, get all pairwise competition and cooperation scores, and the seed complementarities between the models under study.

Returns the a dictionary in case of the API or builds the the seed_complements.pckl file in the stand-alone.

species_scores_compls(species: str) Tuple[set, dict] | Dict[source]¶

Get scores and complements for a specific model (species). In the stand-alone version, it writes the seed scores file.

Note

Since, we get all pairwise combinations, we do not care of using the as_donor case for a species, since it’s gonna be calculated when the other species is the beneficiary

process_sbml(sbml_path: str, maxcc: int = 2)[source]¶

For each SBML model file (.xml) extract seeds, non-seeds and confidence scores using the PhyloMint adapted/refined approach of ours, i.e. building a directed graph with only the cytosol reactions, considering for the reversibility of a reaction.

Check if KEGG MODULE related

Load map file with KEGG modules and their terms and return a set with all the KOs there

microbetag.seed_complementarity.progress_tracker(queue, total)[source]¶

Progress bar updater.

microbetag.seed_complementarity.generate_fixed_pairwise_comparisons(fixed_item, reconstruction_filenames)[source]¶

Generate and return two lists: one with the fixed item in the first position and one with it in the second.

microbetag.seed_complementarity.bigg_to_seed_mapping_df(metanetx_compounds)[source]¶
microbetag.seed_complementarity.load_seed_complement_files(path_to_kegg_seed_mappings)[source]¶

Loads mapping files to be used for the building of the cx2 network.

microbetag.seed_complementarity.build_url_with_seed_complements(seed_complements, nonseeds, kmap, shortener=None)[source]¶
microbetag.seed_complementarity.load_confidence(confidence, remove_suffix=False)[source]¶
microbetag.seed_complementarity.load_nonseeds(nonseeds, remove_suffix=False)[source]¶