[POC] Get subworkflows working again - bam_stats_samtools (#2097)

* [POC] Get subworkflows working again - bam_stats_samtools

* Comment out aliased anchors

* Add explicit anchor to pytest_modules.yml

* test(subworkflows): Remove anchors

There are two options to get the tests to trigger:

1. Add the module anchors to the subworkflows (less things to update and maintain because we only have to update the module triggers)

2. Add the tags to the pytest workflow spec.

This is option 2.

Co-authored-by: Edmund Miller <edmund.a.miller@protonmail.com>
This commit is contained in:
Harshil Patel 2022-09-28 19:20:20 +01:00 committed by GitHub
parent bfbdc4f79b
commit b3e322064e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 33 deletions

View file

@ -2,26 +2,25 @@
// Run SAMtools stats, flagstat and idxstats
//
params.options = [:]
include { SAMTOOLS_STATS } from '../../../modules/samtools/stats/main' addParams( options: params.options )
include { SAMTOOLS_IDXSTATS } from '../../../modules/samtools/idxstats/main' addParams( options: params.options )
include { SAMTOOLS_FLAGSTAT } from '../../../modules/samtools/flagstat/main' addParams( options: params.options )
include { SAMTOOLS_STATS } from '../../../modules/samtools/stats/main'
include { SAMTOOLS_IDXSTATS } from '../../../modules/samtools/idxstats/main'
include { SAMTOOLS_FLAGSTAT } from '../../../modules/samtools/flagstat/main'
workflow BAM_STATS_SAMTOOLS {
take:
ch_bam_bai // channel: [ val(meta), [ bam ], [bai/csi] ]
bam_bai // channel: [ val(meta), [ bam/cram ], [bai/csi] ]
fasta // channel: [ fasta ]
main:
ch_versions = Channel.empty()
SAMTOOLS_STATS ( ch_bam_bai, [] )
SAMTOOLS_STATS ( bam_bai, fasta )
ch_versions = ch_versions.mix(SAMTOOLS_STATS.out.versions.first())
SAMTOOLS_FLAGSTAT ( ch_bam_bai )
SAMTOOLS_FLAGSTAT ( bam_bai )
ch_versions = ch_versions.mix(SAMTOOLS_FLAGSTAT.out.versions.first())
SAMTOOLS_IDXSTATS ( ch_bam_bai )
SAMTOOLS_IDXSTATS ( bam_bai )
ch_versions = ch_versions.mix(SAMTOOLS_IDXSTATS.out.versions.first())
emit:

View file

@ -1,4 +1,4 @@
name: samtools_stats
name: bam_stats_samtools
description: Produces comprehensive statistics from SAM/BAM/CRAM file
keywords:
- statistics
@ -24,6 +24,10 @@ input:
type: file
description: Index for BAM/CRAM/SAM file
pattern: "*.{bai,crai,sai}"
- fasta:
type: file
description: Reference genome fasta file
pattern: "*.{fasta,fa}"
# TODO Update when we decide on a standard for subworkflow docs
output:
- meta:
@ -35,6 +39,14 @@ output:
type: file
description: File containing samtools stats output
pattern: "*.{stats}"
- flagstat:
type: file
description: File containing samtools flagstat output
pattern: "*.{flagstat}"
- idxstats:
type: file
description: File containing samtools idxstats output
pattern: "*.{idxstats}"
- versions:
type: file
description: File containing software versions

View file

@ -1 +0,0 @@
params.options = [:]

View file

@ -2355,6 +2355,10 @@ subread/featurecounts:
- modules/subread/featurecounts/**
- tests/modules/subread/featurecounts/**
subworkflows/bam_stats_samtools:
- subworkflows/nf-core/bam_stats_samtools/**
- tests/subworkflows/nf-core/bam_stats_samtools/**
svdb/merge:
- modules/svdb/merge/**
- tests/modules/svdb/merge/**

View file

@ -2,22 +2,27 @@
nextflow.enable.dsl = 2
include { BAM_STATS_SAMTOOLS } from '../../../../subworkflows/nf-core/bam_stats_samtools/main' addParams( options: [:] )
include { BAM_STATS_SAMTOOLS as BAM_STATS_SAMTOOLS_SINGLE_END } from '../../../../subworkflows/nf-core/bam_stats_samtools/main'
include { BAM_STATS_SAMTOOLS as BAM_STATS_SAMTOOLS_PAIRED_END } from '../../../../subworkflows/nf-core/bam_stats_samtools/main'
workflow test_bam_stats_samtools_single_end {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true)
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true)
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
BAM_STATS_SAMTOOLS ( input )
BAM_STATS_SAMTOOLS_SINGLE_END ( input, fasta )
}
workflow test_bam_stats_samtools_paired_end {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
BAM_STATS_SAMTOOLS ( input )
BAM_STATS_SAMTOOLS_PAIRED_END ( input, fasta )
}

View file

@ -0,0 +1,13 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: '.*:BAM_STATS_SAMTOOLS_SINGLE_END:.*' {
ext.prefix = { "${meta.id}.single_end.sorted.bam" }
}
withName: '.*:BAM_STATS_SAMTOOLS_PAIRED_END:.*' {
ext.prefix = { "${meta.id}.paired_end.sorted.bam" }
}
}

View file

@ -1,13 +1,14 @@
- name: bam stats samtools single-end
command: nextflow run ./tests/subworkflows/nf-core/bam_stats_samtools -entry test_bam_stats_samtools_single_end -c tests/config/nextflow.config
command: nextflow run ./tests/subworkflows/nf-core/bam_stats_samtools -entry test_bam_stats_samtools_single_end -c ./tests/config/nextflow.config -c ./tests/subworkflows/nf-core/bam_stats_samtools/nextflow.config
tags:
- subworkflows
# - subworkflows/bam_stats_samtools
- subworkflows/bam_stats_samtools
- bam_stats_samtools
# Modules
# - samtools
# - samtools/stats
# - samtools/idxstats
# - samtools/flagstat
- samtools
- samtools/stats
- samtools/idxstats
- samtools/flagstat
files:
- path: ./output/samtools/test.single_end.sorted.bam.flagstat
md5sum: 2191911d72575a2358b08b1df64ccb53
@ -16,15 +17,16 @@
- path: ./output/samtools/test.single_end.sorted.bam.stats
- name: bam stats samtools paired-end
command: nextflow run ./tests/subworkflows/nf-core/bam_stats_samtools -entry test_bam_stats_samtools_paired_end -c tests/config/nextflow.config
command: nextflow run ./tests/subworkflows/nf-core/bam_stats_samtools -entry test_bam_stats_samtools_paired_end -c ./tests/config/nextflow.config -c ./tests/subworkflows/nf-core/bam_stats_samtools/nextflow.config
tags:
- subworkflows
# - subworkflows/bam_stats_samtools
# # Modules
# - samtools
# - samtools/stats
# - samtools/idxstats
# - samtools/flagstat
- subworkflows/bam_stats_samtools
- bam_stats_samtools
# Modules
- samtools
- samtools/stats
- samtools/idxstats
- samtools/flagstat
files:
- path: ./output/samtools/test.paired_end.sorted.bam.flagstat
md5sum: 4f7ffd1e6a5e85524d443209ac97d783