diff --git a/docs/focal.qzv b/docs/focal.qzv new file mode 100644 index 0000000..61e82ae Binary files /dev/null and b/docs/focal.qzv differ diff --git a/docs/mes.qzv b/docs/mes.qzv new file mode 100644 index 0000000..d421fd5 Binary files /dev/null and b/docs/mes.qzv differ diff --git a/q2_micom/__init__.py b/q2_micom/__init__.py index 4282155..3d36015 100644 --- a/q2_micom/__init__.py +++ b/q2_micom/__init__.py @@ -13,6 +13,8 @@ exchanges_per_taxon, plot_tradeoff, association, + focal_interactions, + mes ) __version__ = "0.15.0" @@ -56,6 +58,8 @@ def read_results(path): "exchanges_per_taxon", "plot_tradeoff", "association", + "focal_interactions", + "mes", "read_results", "filter_models", "filter_results", diff --git a/q2_micom/_viz.py b/q2_micom/_viz.py index 19486ab..731a72f 100644 --- a/q2_micom/_viz.py +++ b/q2_micom/_viz.py @@ -70,3 +70,34 @@ def association( fdr_threshold, atol=1e-6, ) + + +def focal_interactions( + output_dir: str, + results: GrowthResults, + taxon: str, + kind:str = "mass", +): + """Plot for interactions.""" + viz.plot_focal_interactions( + results, + filename=join(output_dir, "index.html"), + taxon=taxon, + kind=kind + ) + + +def mes( + output_dir: str, + results: GrowthResults, + metadata: MetadataColumn = None, + prevalence:float = 0.5, +): + """Test for differential metabolite production.""" + meta = None if metadata is None else metadata.to_series() + viz.plot_mes( + results, + groups=meta, + filename=join(output_dir, "index.html"), + prevalence=prevalence + ) \ No newline at end of file diff --git a/q2_micom/citations.bib b/q2_micom/citations.bib index f8463a7..017dbc3 100644 --- a/q2_micom/citations.bib +++ b/q2_micom/citations.bib @@ -55,3 +55,14 @@ @article{gapseq year={2021}, publisher={BioMed Central} } + +@article{marcelino, + title={Disease-specific loss of microbial cross-feeding interactions in the human gut}, + author={Marcelino, Vanessa R and Welsh, Caitlin and Diener, Christian and Gulliver, Emily L and Rutten, Emily L and Young, Remy B and Giles, Edward M and Gibbons, Sean M and Greening, Chris and Forster, Samuel C}, + journal={Nature Communications}, + volume={14}, + number={1}, + pages={6546}, + year={2023}, + publisher={Nature Publishing Group UK London} +} diff --git a/q2_micom/plugin_setup.py b/q2_micom/plugin_setup.py index 09c1136..cd17069 100644 --- a/q2_micom/plugin_setup.py +++ b/q2_micom/plugin_setup.py @@ -530,4 +530,65 @@ citations=[citations["micom"]], ) +plugin.visualizers.register_function( + function=q2_micom.focal_interactions, + inputs={"results": MicomResults}, + parameters={ + "taxon": Str, + "kind": Str, + }, + input_descriptions={ + "results": ( + "A set of MICOM analysis results. " + "Contains predicted growth rates and exchange fluxes." + ), + }, + parameter_descriptions={ + "taxon": ( + "The focal taxon to use as a reference. You can use `plot-growth` to " + "check for valid taxa names." + ), + "kind": ( + "Which kind of flux to use. Either - 'flux': molar flux of a " + "metabolite - 'mass' (default): the mass flux (flux normalized by " + "molecular weight) - 'C': carbon flux - 'N': nitrogen flux." + ) + }, + name="Interactions for a taxon", + description=( + "Quantifies all metabolic interactions between a taxon of interest " + "(focal taxon) and all other taxa in all samples." + ), + citations=[citations["micom"]], +) + +plugin.visualizers.register_function( + function=q2_micom.mes, + inputs={"results": MicomResults}, + parameters={ + "metadata": MetadataColumn[Categorical], + "prevalence": Float % Range(0, 1), + }, + input_descriptions={ + "results": ( + "A set of MICOM analysis results. " + "Contains predicted growth rates and exchange fluxes." + ), + }, + parameter_descriptions={ + "metadata": "The metadata variable to use.", + "prevalence": ( + "In what proportion of samples the metabolite has to have a " + "non-zero MES to be shown on the plots. Can be used to show only " + "very commonly exchanged metabolites." + ), + }, + name="Metabolic exchange scores", + description=( + "Calculates the metabolic exchange score (MES) for all metabolites " + "in all samples." + ), + citations=[citations["micom"], citations["marcelino"]], +) + importlib.import_module("q2_micom._transform")