En raison du déménagement des baies serveurs, les services gitlab.irstea.fr et mattermost.irstea.fr seront interrompus le samedi 2 octobre 2021 au matin. Ils devraient revenir à la normale dans la journée.

Commit abf8242c authored by Midoux Cedric's avatar Midoux Cedric
Browse files

metrics

parent 4a18f66e
...@@ -64,11 +64,11 @@ rule tree: ...@@ -64,11 +64,11 @@ rule tree:
"&& " "&& "
"tree.py " "tree.py "
"--nb-cpus {threads} " "--nb-cpus {threads} "
"--input-otu {input.fasta} " "--input-sequences {input.fasta} "
"--biomfile {input.biom} " "--biom-file {input.biom} "
"--out-tree {output.nwk} " "--out-tree {output.nwk} "
"--html {output.html} " "--html {output.html} "
"--log-file {output.log}" "--log-file {output.log} "
"&& " "&& "
"conda deactivate" "conda deactivate"
......
...@@ -20,3 +20,12 @@ rule makeSequenceTable: ...@@ -20,3 +20,12 @@ rule makeSequenceTable:
config["THREADS"] config["THREADS"]
script: script:
"makeSequenceTable.R" "makeSequenceTable.R"
rule metrics:
input:
rds = "work/dada/seqtab.rds",
fastqc = expand("work/fastqc/{sample}_fastqc.zip", sample=SAMPLES)
output:
tsv = "work/dada/metrics.tsv"
script:
"metrics.R"
...@@ -11,12 +11,13 @@ rule all: ...@@ -11,12 +11,13 @@ rule all:
expand("work/dada/{sample}.rds", sample=SAMPLES), expand("work/dada/{sample}.rds", sample=SAMPLES),
"work/dada/seqtab.fasta", "work/dada/seqtab.fasta",
"work/dada/seqtab.tsv", "work/dada/seqtab.tsv",
"work/dada/metrics.tsv",
"work/FROGS/affiliation.biom", "work/FROGS/affiliation.biom",
"report/clusters_metrics.html", "report/clusters_metrics.html",
"report/affiliations_metrics.html", "report/affiliations_metrics.html",
"report/abundance.biom", "report/abundance.biom",
"report/abundance.tsv", "report/abundance.tsv",
"report/tree.nwk" # "report/tree.nwk"
include: "quality.smk" include: "quality.smk"
include: "preprocess.smk" include: "preprocess.smk"
......
library(dplyr)
library(tibble)
reads_input <- sapply(snakemake@config$SAMPLES, function(x) {
as.numeric(system(
sprintf(
"unzip -p work/fastqc/%s_fastqc.zip %s_fastqc/fastqc_data.txt | grep 'Total Sequences' | cut -f2",
x, x),
intern = TRUE
))
}) %>% as.data.frame() %>% rownames_to_column("Sample")
seqtab.nochim <- readRDS(snakemake@input$rds)
reads_output <- rowSums(seqtab.nochim) %>% as.data.frame() %>% rownames_to_column("Sample")
nb_asv <- rowSums(seqtab.nochim > 0) %>% as.data.frame() %>% rownames_to_column("Sample")
metrics <- dplyr::full_join(x = reads_input, y = reads_output, by = "Sample") %>%
dplyr::full_join(y = nb_asv, by = "Sample")
colnames(metrics) <- c('Sample', 'Input reads', 'Post-process reads', 'Nb ASV')
write.table(metrics, snakemake@output$tsv, sep = "\t", quote = FALSE, row.names = FALSE)
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