Skip to content

Commit

Permalink
Add EMPress plot (#20)
Browse files Browse the repository at this point in the history
* Add EMPress support

* update readme

* update rulegraph with empress

* update songbird env

* add iow to songbird

* add bioconda channel to songbird env
  • Loading branch information
gibsramen authored Jul 12, 2022
1 parent 48bea2a commit ce602e3
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ You should also change the model covariate, target, and reference category.

If you have other confounders, you can include them under the `confounders` heading.
Delete these if you are not including any additional confounders.
Note you should still leave the `counfounders` entry - just delete the entries in the list.

Qadabra can also output an [EMPress plot](https://journals.asm.org/doi/10.1128/mSystems.01216-20) of a phylogenetic tree annotated with each tool's differentials.
Change the `tree` entry to point to this file.
If you do not have a phylogenetic tree, change this entry to an empty string and EMPress will not be run.

Run `snakemake --use-conda <other options>` to start the workflow.
Please read the [Snakemake documentation](https://snakemake.readthedocs.io/en/stable/executing/cli.html) for how to run Snakemake best on your system.
Expand Down
1 change: 1 addition & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
table: "data/table.biom"
metadata: "data/metadata.tsv"
tree: "data/tree.nwk"
stylesheet: "config/qadabra.mplstyle"
model:
covariate: anemia
Expand Down
1 change: 1 addition & 0 deletions data/tree.nwk

Large diffs are not rendered by default.

Binary file modified imgs/rule_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include: "rules/common.smk"
include: "rules/diffab.smk"
include: "rules/visualization.smk"
include: "rules/ml.smk"
include: "rules/tree.smk"


report: "report/workflow.rst"
Expand Down
9 changes: 8 additions & 1 deletion workflow/envs/qadabra-songbird.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
channel:
channels:
- conda-forge
- bioconda
dependencies:
- iow
- cython
- songbird
- pandas>=0.18.0,<1
- qurro
- pip
- pip:
- empress

1 change: 1 addition & 0 deletions workflow/report/empress.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EMPress plot of phylogenetic tree. Tool differentials are included as feature metadata. For more information on EMPress, see `Cantrell and Fedarko et al., 2021 <https://journals.asm.org/doi/10.1128/mSystems.01216-20>`_.
2 changes: 1 addition & 1 deletion workflow/report/qurro.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Qurro visualization of differentials from all tools. For more information on Qurro, see `Fedarko 2020 <https://academic.oup.com/nargab/article/2/2/lqaa023/5826153>`_.
Qurro visualization of differentials from all tools. For more information on Qurro, see `Fedarko et al., 2020 <https://academic.oup.com/nargab/article/2/2/lqaa023/5826153>`_.
4 changes: 4 additions & 0 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ all_viz_files.extend(
all_viz_files.append("figures/rank_comparisons.html")
all_viz_files.append("figures/pca.svg")

if config["tree"]:
all_viz_files.append("results/empress")

all_input = all_viz_files.copy()
all_input.extend(["results/qurro", "results/differentials_table.html"])


covariate = config["model"]["covariate"]
reference = config["model"]["reference"]
target = config["model"]["target"]
Expand Down
Empty file added workflow/rules/tree.smk
Empty file.
24 changes: 24 additions & 0 deletions workflow/rules/visualization.smk
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,27 @@ rule create_table:
"../envs/qadabra-default.yaml"
script:
"../scripts/create_table.py"


rule empress:
input:
tree=config["tree"],
diff="results/concatenated_differentials.tsv",
output:
report(
directory("results/empress"),
caption="../report/empress.rst",
htmlindex="empress.html",
category="Tree",
),
log:
"log/empress.log",
conda:
"../envs/qadabra-songbird.yaml"
shell:
"""
empress tree-plot \
--tree {input.tree} \
--feature-metadata {input.diff} \
--output-dir {output} > {log} 2>&1
"""

0 comments on commit ce602e3

Please sign in to comment.