Skip to content

Commit

Permalink
Merge branch 'rna' into d1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Downie committed Jan 7, 2025
2 parents 9d3f933 + cb720e9 commit 59edad5
Show file tree
Hide file tree
Showing 30 changed files with 32,426 additions and 591 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ repos:
hooks:
- id: editorconfig-checker
alias: ec
exclude: .*\.hmm
exclude: .*(\.hmm$|.*\.cm$)
31,832 changes: 31,832 additions & 0 deletions assets/rRNA.cm

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions bin/bin_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,21 @@ parser <- add_option(

parser <- add_option(
object = parser,
opt_str = c("-r", "--rrnas"),
opt_str = c("-l", "--trnas"),
type = "character",
action = "store",
default = NULL,
help = "Comma-separated list of TSV files output by GAWK_PROKKA_SUMMARY.",
help = "Comma-separated list of TSV files output by GAWK_TRNASCAN_SUMMARY.",
metavar="filename"
)

parser <- add_option(
object = parser,
opt_str = c("-g", "--rrnas"),
type = "character",
action = "store",
default = NULL,
help = "Comma-separated list of TSV files output by BIN_RRNAS",
metavar="filename"
)

Expand Down Expand Up @@ -129,10 +139,8 @@ read_taxonomy <- function(file) {
return(df)
}

read_rrnas <- function(file) {
df <- read_tsv(file)
return(df)
}
read_trnas <- read_tsv
read_rrnas <- read_tsv

## Takes the arg input list and a defined input type
## Check if the arg has been passed, then split the string into
Expand All @@ -150,7 +158,7 @@ split_and_read <- function(input, input_type) {

## Map across all input types, read them, discard any that weren't provided
## and then bind them all together by bin
input_types <- c("stats", "checkm2", "taxonomy", "rrnas")
input_types <- c("stats", "checkm2", "taxonomy", "trnas", "rrnas")
summary <- map(input_types, \(x) split_and_read(input, x)) |>
discard(is.null) |>
reduce(\(x, y) left_join(x, y, by = "bin"))
Expand Down
34 changes: 0 additions & 34 deletions bin/prokka_summary.awk

This file was deleted.

24 changes: 24 additions & 0 deletions bin/trnascan_summary.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Summarise information about tRNA and rRNA contents
## given by Prokka for a genome bin
##
## Author: Jim Downie, 2024

BEGIN {
FS = "\t"
OFS = FS
print "bin", "total_trnas", "unique_trnas"
}
BEGINFILE {
bin = FILENAME
sub(".*/", "", bin)
sub(/\.[^\.]+$/, "", bin)
unique_trnas = 0
}
{
trna_arr[$5] = 1
}
ENDFILE {
for (i in trna_arr) { unique_trnas++ }
delete trna_arr
print bin, NR, unique_trnas
}
105 changes: 71 additions & 34 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_bin3c" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/bins_raw/bin3c/" },
path: { "${params.outdir}/bins/fasta/bin3c/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'BIN_RRNAS' {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/bins/qc/rrna" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -38,7 +48,7 @@ process {
withName: 'BIN_SUMMARY' {
ext.prefix = { "${meta.id}" }
publishDir = [
path: { "${params.outdir}/summary/" },
path: { "${params.outdir}/bins/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -60,17 +70,17 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/qc/checkm/" },
path: { "${params.outdir}/bins/qc/checkm/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'CONTIG2BINTOFASTA' {
ext.prefix = { "${meta.id}_${meta.assembler}_${binner}" }
tag = { "${meta.id}_${meta.assembler}_${binner}" }
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/bins_refined/${meta.binner}" },
path: { "${params.outdir}/bins/fasta/${meta.binner}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -81,7 +91,7 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_depth" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/mapping/pacbio/" },
path: { "${params.outdir}/${meta.assembler}/mapping/minimap2_pacbio/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -91,11 +101,6 @@ process {
ext.args = { "--write_bin_evals" }
ext.prefix = { "${meta.id}_${meta.assembler}_dastool" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/bins_refined/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'FASTATOCONTIG2BIN' {
Expand Down Expand Up @@ -133,12 +138,12 @@ process {
tag = { "${meta.id}_${meta.assembler}" }
}

withName: 'GAWK_PROKKA_SUMMARY' {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}.prokka_summary" }
withName: 'GAWK_TRNASCAN_SUMMARY' {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}.trnascan_summary" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
ext.suffix = { "tsv" }
publishDir = [
path: { "${params.outdir}/qc/prokka" },
path: { "${params.outdir}/bins/qc/trnascan" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -156,7 +161,7 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/taxonomy/gtdbtk" },
path: { "${params.outdir}/bins/taxonomy/gtdbtk" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -173,6 +178,17 @@ process {
tag = { "${meta.id}_${meta.assembler}_${hmmfile}" }
}

withName: 'INFERNAL_CMSEARCH' {
ext.args = { "--notrunc" }
ext.prefix = { "${meta.id}_${meta.assembler}" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/${meta.assembler}/qc/rrna" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'MAGSCOT_MAGSCOT' {
ext.prefix = { "${meta.id}_${meta.assembler}" }
tag = { "${meta.id}_${meta.assembler}" }
Expand All @@ -183,7 +199,7 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_maxbin2" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/bins_raw/maxbin2" },
path: { "${params.outdir}/bins/fasta/maxbin2" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -194,14 +210,24 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_metabat2" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/bins_raw/metabat2" },
path: { "${params.outdir}/bins/fasta/metabat2" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'METAMDBG_ASM' {
ext.args = { "" }
ext.prefix = { "${meta.id}_metamdbg" }
publishDir = [
path: { "${params.outdir}/metamdbg/fasta/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'METATOR_PROCESS_INPUT_BAM' {
ext.prefix = { "${meta.id}_${meta.assembler}" } // metator already appends "_metator" to files
ext.prefix = { "${meta.id}_${meta.assembler}" }
tag = { "${meta.id}_${meta.assembler}" }
}

Expand All @@ -210,7 +236,7 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}" } // metator already appends "_metator" to files
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/bins_raw/metator" },
path: { "${params.outdir}/bins/fasta/metator" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -222,40 +248,40 @@ process {
ext.prefix = { "${meta2.id}_${meta2.assembler}" }
tag = { "${meta2.id}_${meta2.assembler}" }
publishDir = [
path: { "${params.outdir}/mapping/pacbio/" },
path: { "${params.outdir}/${meta2.assembler}/mapping/minimap2_pacbio/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'PROKKA' {
ext.args = { "--force --metagenome --rfam --noanno --fast --rawproduct" }
ext.prefix = { "${meta.binid}" }
tag = { "${meta.binid}" }
withName: 'PYRODIGAL' {
ext.args = { "-p meta" }
ext.prefix = { "${meta.id}_${meta.assembler}" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/qc/prokka" },
path: { "${params.outdir}/${meta.assembler}/annotation/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'PYRODIGAL' {
ext.args = { "-p meta" }
ext.prefix = { "${meta.id}_${meta.assembler}" }
withName: 'SEQKIT_STATS_ASSEMBLIES' {
ext.args = { "-b -a" }
ext.prefix = { "${meta.id}_${meta.assembler}.stats" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/annotation/" },
path: { "${params.outdir}/${meta.assembler}/qc/stats/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'SEQKIT_STATS' {
withName: 'SEQKIT_STATS_BINS' {
ext.args = { "-b -a" }
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}.stats" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/qc/stats/" },
path: { "${params.outdir}/bins/qc/stats/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -266,7 +292,7 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}" }
tag = { "${meta.id}_${meta.assembler}" }
publishDir = [
path: { "${params.outdir}/mapping/hic" },
path: { "${params.outdir}/${meta.assembler}/mapping/bwamem2_hic/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand All @@ -277,7 +303,18 @@ process {
ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}.gtdb_to_ncbi" }
tag = { "${meta.id}_${meta.assembler}_${meta.binner}" }
publishDir = [
path: { "${params.outdir}/taxonomy/" },
path: { "${params.outdir}/bins/taxonomy/ncbi" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'TRNASCAN_SE' {
ext.args = { "-B -Q --brief" }
ext.prefix = { "${meta.binid}" }
tag = { "${meta.binid}" }
publishDir = [
path: { "${params.outdir}/bins/qc/trnascan_se" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
6 changes: 0 additions & 6 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@
"git_sha": "cf17ca47590cc578dfb47db1c2a44ef86f89976d",
"installed_by": ["modules"]
},
"prokka": {
"branch": "master",
"git_sha": "666652151335353eef2fcd58880bcef5bc2928e1",
"installed_by": ["modules"],
"patch": "modules/nf-core/prokka/prokka.diff"
},
"pyrodigal": {
"branch": "master",
"git_sha": "938e803109104e30773f76a7142442722498fef1",
Expand Down
7 changes: 7 additions & 0 deletions modules/local/bin_rrnas/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
channels:
- conda-forge
- bioconda
dependencies:
- conda-forge::r-base=4.4
- conda-forge::r-tidyverse=2.0.0
- conda-forge::r-optparse=1.7.5
Loading

0 comments on commit 59edad5

Please sign in to comment.