Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary tables for all samples #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.nextflow*
out_*
work
.Rhistory
Empty file modified .travis.yml
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
################################
# #
# DOCKERFILE #
# Hybrid Assembly Pipeline #
# plasmIDent Pipeline #
# #
################################
FROM continuumio/miniconda3
MAINTAINER Caspar Gross <[email protected]>
LABEL author="Caspar Gross <[email protected]>"
LABEL description="contains all the dependencies for plasmid Identification pipeline at github.com/caspargross/plasmidIdentification"

SHELL ["/bin/bash", "-c"]
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
Binary file added bin/.DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion bin/04_summary_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ getID <- function(s) {
return(contig)
}

dt_ar <- dt_rgi[, .(contig = sapply(Contig, getID), ar_genes = sapply(Best_Hit_ARO, toString)),]
dt_ar <- dt_rgi[, .(contig = sapply(Contig, getID),
ar_genes = sapply(Best_Hit_ARO, toString),
aro = sapply(ARO, toString)),]

# Put it all together
dt <- dt_gc[,.(gc = mean(gc)), by = contig]
Expand Down
42 changes: 42 additions & 0 deletions bin/06_summary_samples.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env Rscript

########################
# Create summary table #

########################

require(data.table)
require(stringr)
require(knitr)

args <- commandArgs(trailingOnly=TRUE)

if (length(args) >= 1) {
df.list <- lapply(args, fread)
names(df.list) <- str_remove(basename(args), "_summary.csv")

# tsv table
df <- data.table::rbindlist(df.list, idcol = "sample_name")
fwrite(df, sep = "\t", file = "rgi_summary_samples.tsv")

# html table, use aro_index.tsv from the card db to match aro accession to ID
#<a href="https://www.thesitewizard.com/" target="_blank">thesitewizard.com</a>
# https://card.mcmaster.ca/ontology/43314
aro <- fread("/aro_index.csv")
aro_dt <- data.table(aro = str_remove(aro$`ARO Accession`, "^ARO:"),
id = aro$`CVTERM ID`)

df$aro <- as.character(df$aro)
dfm <- merge(df, aro_dt, by = "aro")
dfm$id <- paste0("<a href='https://card.mcmaster.ca/ontology/", dfm$id, "'", " target='_blank'>", dfm$id, "</a>")

cat(knitr::kable(dfm[, !c("aro")],
format = "html",
escape = FALSE,
align = "r",
caption = "Summary table of all replicons with resistance genes"),
file = "rgi_summary_samples.html")

} else {
stop("No arguments provided")
}
Empty file modified conf/app.config
100644 → 100755
Empty file.
Empty file modified conf/base.config
100644 → 100755
Empty file.
Empty file modified conf/circos/circos.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/cov.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/gc.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/gcskew.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/gcskewsum.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/genes.conf
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion conf/circos/housekeeping.conf
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ offsets = 0,0
max_ticks = 5000
max_ideograms = 200
max_links = 25000
max_points_per_track = 55000
max_points_per_track = 255000

# What to do when data is found for an ideogram that does not appear in the karyotype file.
# Set to 'skip' or 'exit'
Expand Down
Empty file modified conf/circos/reads.conf
100644 → 100755
Empty file.
Empty file modified conf/circos/ticks.conf
100644 → 100755
Empty file.
Empty file modified conf/test.config
100644 → 100755
Empty file.
Binary file added data/.DS_Store
Binary file not shown.
3,134 changes: 3,134 additions & 0 deletions data/aro_index.tsv

Large diffs are not rendered by default.

Empty file modified data/test_assembly.fasta
100644 → 100755
Empty file.
Empty file modified data/test_assembly.fasta.fai
100644 → 100755
Empty file.
Empty file modified data/test_file_list.tsv
100644 → 100755
Empty file.
Empty file modified data/test_reads.fastq.gz
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion doc/alternative_installation.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The conda environment containing all the dependencies for this pipeline can be i
You need [miniconda](https://conda.io/miniconda.html) installed on you machine. You can then create the new environment with:

```
conda create -f /env/PI_env.yml
conda env create -f env/PI_env.yml
```

Additionally you need to run the following commands:
Expand Down
Empty file modified doc/example_output.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/profiles.md
100644 → 100755
Empty file.
Binary file added env/.DS_Store
Binary file not shown.
Empty file modified env/PI_env.yml
100644 → 100755
Empty file.
29 changes: 28 additions & 1 deletion main.nf
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ process format_data_rgi {

output:
set id, file("rgi.txt"), file("rgi_span.txt") into circos_data_rgi
//set id, file("rgi_summary.txt") into rgi_summary_ch

script:
"""
Expand Down Expand Up @@ -302,6 +303,7 @@ process calcGC {
// Calculate gc conten
publishDir "${params.outDir}/${id}/gc", mode: 'copy'
tag{id}
errorStrategy 'ignore'

input:
set id, assembly, lr, type from gc_padded
Expand Down Expand Up @@ -398,12 +400,13 @@ process table{
// Create table with contig informations
publishDir "${params.outDir}/${id}/", mode: 'copy'
tag{id}
errorStrategy 'ignore'

input:
set id, gc, assembly, cov, type, rgi from table_data

output:
file("${id}_summary.csv")
file("${id}_summary.csv") into summary_tsvs

script:
"""
Expand All @@ -413,6 +416,30 @@ process table{
"""
}

aro_index = Channel.fromPath("${baseDir}/data/aro_index.csv")

process summary_samples {
// Create summary table with all samples
publishDir "${params.outDir}", mode: 'copy'

input:
path tsvs from summary_tsvs
file 'aro_index'
// aro_index.csv is in the docker image

output:
path "rgi_summary_samples.tsv"
path "rgi_summary_samples.html"
// out files produced by R script

script:
"""
${env}
06_summary_samples.R ${tsvs}
"""

}
//summary_data.view()

/*
================================================================================
Expand Down
Empty file modified nextflow.config
100644 → 100755
Empty file.