Commit 3c9b7b60 authored by Slaheddine Kastalli's avatar Slaheddine Kastalli
Browse files

Delete metrics.R

parent 9e76ea37
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