Commit 7a20f509 authored by Valentina Galata's avatar Valentina Galata
Browse files

figures: added diamond/db fig

parent 77681d95
......@@ -30,6 +30,7 @@ rule all:
fig_quast="figures/fig_quast.pdf",
fig_mash="figures/fig_mash.pdf",
fig_prodigal="figures/fig_prodigal.pdf",
fig_diamond_db="figures/fig_diamond_db.pdf",
fig_mmseqs2="figures/fig_mmseqs2.pdf",
fig_gdb_rgi_aro3004454_flye="figures/fig_gdb_rgi_aro3004454_flye.pdf"
......@@ -107,6 +108,25 @@ rule fig_prodigal:
script:
os.path.join(SRC_DIR, "fig_prodigal.R")
rule fig_diamond_db:
input:
zymo=os.path.join(config["samples"]["zymo"], "analysis/diamond/summary.db.tsv"),
nwc=os.path.join(config["samples"]["nwc"], "analysis/diamond/summary.db.tsv"),
gdb=os.path.join(config["samples"]["gdb"], "analysis/diamond/summary.db.tsv"),
rumen=os.path.join(config["samples"]["rumen"], "analysis/diamond/summary.db.tsv")
output:
pdf="figures/fig_diamond_db.pdf"
log:
"figures/fig_diamond_db.log"
params:
const=os.path.join(SRC_DIR, "const.R"),
utils=os.path.join(SRC_DIR, "utils.R")
conda:
os.path.join(ENV_DIR, "r.yaml")
script:
os.path.join(SRC_DIR, "fig_diamond_db.R")
rule fig_mmseqs2:
input:
zymo=os.path.join(config["samples"]["zymo"], "analysis/mmseqs2/summary.tsv"),
......
#!/usr/bin/Rscript
# Figure: QUAST statistics
############################## LOG
sink(file=file(snakemake@log[[1]], open="wt"), type=c("output", "message"))
############################## LIBS
suppressMessages(library(testit)) # assertions
suppressMessages(library(dplyr)) # tables
suppressMessages(library(patchwork)) # combine plots
# custom
source(snakemake@params$const)
source(snakemake@params$utils)
############################## CONFIG
# assemblers
ASM_NAMES_CONFIG <- c(
snakemake@config$assemblers$lr,
snakemake@config$assemblers$sr,
snakemake@config$assemblers$hy
)
ASM_TOOL_NAMES <- ASM_TOOL_NAMES[ASM_NAMES_CONFIG]
ASM_TOOL_COLORS <- ASM_TOOL_COLORS[ASM_NAMES_CONFIG]; names(ASM_TOOL_COLORS) <- ASM_TOOL_NAMES[names(ASM_TOOL_COLORS)]
ASM_TOOL_SHAPES <- ASM_TOOL_SHAPES[ASM_NAMES_CONFIG]; names(ASM_TOOL_SHAPES) <- ASM_TOOL_NAMES[names(ASM_TOOL_SHAPES)]
############################## DATA
# individual tables
TABS <- list()
for(sname in names(snakemake@config$samples)){
testit::assert(sname %in% names(snakemake@input))
TABS[[sname]] <- read_diamondDB(snakemake@input[[sname]])
}
############################## PLOT
# individual plots
FIGS <- list()
for(sname in names(snakemake@config$samples)){
xlim <- NULL
FIGS[[sname]] <- plot_diamondDB_density(TABS[[sname]], col="qs_len_ratio", xlim=c(0, 3)) +
labs(
title=LETTERS[which(names(TABS) == sname)],
subtitle=SAMPLE_NAMES[sname]
)
}
# combine plots
FIGS_ALL <- Reduce("+", FIGS) + plot_layout(ncol=2)
# PDF
pdf(snakemake@output$pdf, width=20, height=20)
print(FIGS_ALL)
dev.off()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment