Skip to content

Commit

Permalink
Add ribotricer/detectorfs (nf-core#5112)
Browse files Browse the repository at this point in the history
* Add ribotricer/detectorfs

* Don't snapshot PDFs

* Complete meta.yml

* Add test for --report_all, address linting things

* Fix tag, add stub tests

* Appease eclint

* Add missing configs

* Make ribotricer versioning more reliable in conda

* Conda differs in floating point precision

* Update nf-test.config

* Apply suggestions from code review

Co-authored-by: Adam Talbot <[email protected]>

* Update modules/nf-core/ribotricer/detectorfs/main.nf

Co-authored-by: Adam Talbot <[email protected]>

* Clarify language around strandedness inference

* default -> filtered

* Fix typo

Co-authored-by: Adam Talbot <[email protected]>

* ifelse -> switch to appease @adamrtalbot

* variables need to be defined outsite switch

* unstranded is broken

* More tests

* Appease eclint

* Fix configs

---------

Co-authored-by: Adam Talbot <[email protected]>
  • Loading branch information
2 people authored and jch-13 committed Mar 18, 2024
1 parent e8ef809 commit 0f7804c
Show file tree
Hide file tree
Showing 8 changed files with 1,876 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/ribotricer/detectorfs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "ribotricer_detectorfs"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::ribotricer=1.3.3"
86 changes: 86 additions & 0 deletions modules/nf-core/ribotricer/detectorfs/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
process RIBOTRICER_DETECTORFS {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ribotricer:1.3.3--pyhdfd78af_0':
'biocontainers/ribotricer:1.3.3--pyhdfd78af_0' }"

input:
tuple val(meta), path(bam), path(bai)
tuple val(meta2), path(candidate_orfs)

output:
tuple val(meta), path('*_protocol.txt') , emit: protocol, optional: true
tuple val(meta), path('*_bam_summary.txt') , emit: bam_summary
tuple val(meta), path('*_read_length_dist.pdf') , emit: read_length_dist
tuple val(meta), path('*_metagene_profiles_5p.tsv') , emit: metagene_profile_5p
tuple val(meta), path('*_metagene_profiles_3p.tsv') , emit: metagene_profile_3p
tuple val(meta), path('*_metagene_plots.pdf') , emit: metagene_plots
tuple val(meta), path('*_psite_offsets.txt') , emit: psite_offsets, optional: true
tuple val(meta), path('*_pos.wig') , emit: pos_wig
tuple val(meta), path('*_neg.wig') , emit: neg_wig
tuple val(meta), path('*_translating_ORFs.tsv') , emit: orfs
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def strandedness_cmd = ''

switch(meta.strandedness) {
case "forward":
strandedness_cmd = "--stranded yes"
break
case "reverse":
strandedness_cmd = "--stranded reverse"
break
//
// Specifying unstranded seems broken - see
// https://github.com/smithlabcode/ribotricer/issues/153. Leaving it
// undefined works, though ribotricer may incorrectly infer
// strandednesss?
//
//case "unstranded":
// strandedness_cmd = "--stranded no"
// break
}
"""
ribotricer detect-orfs \\
--bam $bam \\
--ribotricer_index $candidate_orfs \\
--prefix $prefix \\
$strandedness_cmd \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ribotricer: \$(ribotricer --version 2>&1 | grep ribotricer | sed '1!d ; s/ribotricer, version //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_protocol.txt
touch ${prefix}_bam_summary.txt
touch ${prefix}_read_length_dist.pdf
touch ${prefix}_metagene_profiles_5p.tsv
touch ${prefix}_metagene_profiles_3p.tsv
touch ${prefix}_metagene_plots.pdf
touch ${prefix}_psite_offsets.txt
touch ${prefix}_pos.wig
touch ${prefix}_neg.wig
touch ${prefix}_translating_ORFs.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ribotricer: \$(ribotricer --version 2>&1 | grep ribotricer | sed '1!d ; s/ribotricer, version //')
END_VERSIONS
"""
}
99 changes: 99 additions & 0 deletions modules/nf-core/ribotricer/detectorfs/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "ribotricer_detectorfs"
description: "Accurate detection of short and long active ORFs using Ribo-seq data"
keywords:
- riboseq
- orf
- genomics
tools:
- "ribotricer":
description: "Python package to detect translating ORF from Ribo-seq data"
homepage: "https://github.com/smithlabcode/ribotricer"
documentation: "https://github.com/smithlabcode/ribotricer"
tool_dev_url: "https://github.com/smithlabcode/ribotricer"
doi: "10.1093/bioinformatics/btz878"
licence: ["GNU General Public v3 (GPL v3)"]

input:
- meta:
type: map
description: |
Map containing riboseq sample information
e.g. `[ id:'sample1', single_end:false, strandedness: 'single' ]
- bam_ribo:
type: file
description: Sorted riboseq BAM file(s)
pattern: "*.{bam}"
- bai_ribo:
type: file
description: Index for sorted riboseq bam file(s)
pattern: "*.{bai}"
- meta2:
type: map
description: |
Map containing reference information for the candidate ORFs
e.g. `[ id:'Ensembl human v.111' ]`
- candidate_orfs:
type: file
description: "TSV file with candidate ORFs from 'ribotricer prepareorfs'"
pattern: "*.tsv"

output:
- meta:
type: map
description: |
Groovy Map containing riboseq sample information
e.g. `[ id:'sample1', single_end:false ]
- protocol:
type: file
description: "txt file containing inferred protocol if it was inferred (not supplied as input)"
pattern: "*_protocol.txt"
- bam_summary:
type: file
description: "Text summary of reads found in the BAM"
pattern: "*_bam_summary.txt"
- read_length_dist:
type: file
description: "PDF-format read length distribution as quality control"
pattern: "*_read_length_dist.pdf"
- metagene_profile_5p:
type: file
description: "Metagene profile aligning with the start codon"
pattern: "*_metagene_profiles_5p.tsv"
- metagene_profile_3p:
type: file
description: "Metagene profile aligning with the stop codon"
pattern: "*_metagene_profiles_3p.tsv"
- metagene_plots:
type: file
description: "Metagene plots for quality control"
pattern: "*_metagene_plots.pdf"
- psite_offsets:
type: file
description: |
"If the P-site offsets are not provided, txt file containing the
derived relative offsets"
pattern: "*_psite_offsets.txt"
- pos_wig:
type: file
description: "Positive strand WIG file for visualization in Genome Browser"
pattern: "*_pos.wig"
- neg_wig:
type: file
description: "Negative strand WIG file for visualization in Genome Browser"
pattern: "*_neg.wig"
- orfs:
type: file
description: |
"TSV with ORFs assessed as translating in this BAM file. You can output
all ORFs regardless of the translation status with option --report_all"
pattern: "*_translating_ORFs.tsv"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@pinin4fjords"
maintainers:
- "@pinin4fjords"
Loading

0 comments on commit 0f7804c

Please sign in to comment.