Skip to content

Commit

Permalink
🚚 move nf-core subworflows to local workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bunop committed Mar 21, 2024
1 parent 4836ca0 commit 82e4f68
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 80 deletions.
26 changes: 6 additions & 20 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
"picard/markduplicates": {
"branch": "master",
"git_sha": "20b0918591d4ba20047d7e13e5094bcceba81447",
"installed_by": ["bam_markduplicates_picard"],
"installed_by": ["modules"],
"patch": "modules/nf-core/picard/markduplicates/picard-markduplicates.diff"
},
"samtools/coverage": {
"branch": "master",
"git_sha": "a64788f5ad388f1d2ac5bd5f1f3f8fc81476148c",
"installed_by": ["bam_stats_samtools"]
"installed_by": ["modules"]
},
"samtools/depth": {
"branch": "master",
Expand All @@ -92,22 +92,22 @@
"samtools/flagstat": {
"branch": "master",
"git_sha": "a64788f5ad388f1d2ac5bd5f1f3f8fc81476148c",
"installed_by": ["bam_stats_samtools"]
"installed_by": ["modules"]
},
"samtools/idxstats": {
"branch": "master",
"git_sha": "a64788f5ad388f1d2ac5bd5f1f3f8fc81476148c",
"installed_by": ["bam_stats_samtools"]
"installed_by": ["modules"]
},
"samtools/index": {
"branch": "master",
"git_sha": "a64788f5ad388f1d2ac5bd5f1f3f8fc81476148c",
"installed_by": ["bam_markduplicates_picard"]
"installed_by": ["modules"]
},
"samtools/stats": {
"branch": "master",
"git_sha": "a64788f5ad388f1d2ac5bd5f1f3f8fc81476148c",
"installed_by": ["bam_stats_samtools"]
"installed_by": ["modules"]
},
"tabix/bgzip": {
"branch": "master",
Expand All @@ -125,20 +125,6 @@
"installed_by": ["modules"]
}
}
},
"subworkflows": {
"nf-core": {
"bam_markduplicates_picard": {
"branch": "master",
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
"installed_by": ["subworkflows"]
},
"bam_stats_samtools": {
"branch": "master",
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
"installed_by": ["bam_markduplicates_picard"]
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

include { PICARD_MARKDUPLICATES } from '../../../modules/nf-core/picard/markduplicates/main'
include { SAMTOOLS_INDEX } from '../../../modules/nf-core/samtools/index/main'
include { BAM_STATS_SAMTOOLS } from '../bam_stats_samtools/main'
include { CRAM_STATS_SAMTOOLS } from '../cram_stats_samtools/main'

workflow BAM_MARKDUPLICATES_PICARD {
workflow CRAM_MARKDUPLICATES_PICARD {

take:
ch_cram // channel: [ val(meta), path(cram) ]
Expand All @@ -31,19 +31,19 @@ workflow BAM_MARKDUPLICATES_PICARD {
else [ meta, cram, csi ]
}

BAM_STATS_SAMTOOLS ( ch_cram_crai, ch_fasta )
ch_versions = ch_versions.mix(BAM_STATS_SAMTOOLS.out.versions)
CRAM_STATS_SAMTOOLS ( ch_cram_crai, ch_fasta )
ch_versions = ch_versions.mix(CRAM_STATS_SAMTOOLS.out.versions)

emit:
cram = PICARD_MARKDUPLICATES.out.cram // channel: [ val(meta), path(cram) ]
metrics = PICARD_MARKDUPLICATES.out.metrics // channel: [ val(meta), path(cram) ]
crai = SAMTOOLS_INDEX.out.crai // channel: [ val(meta), path(crai) ]
crai = SAMTOOLS_INDEX.out.crai // channel: [ val(meta), path(crai) ]
csi = SAMTOOLS_INDEX.out.csi // channel: [ val(meta), path(csi) ]

stats = BAM_STATS_SAMTOOLS.out.stats // channel: [ val(meta), path(stats) ]
flagstat = BAM_STATS_SAMTOOLS.out.flagstat // channel: [ val(meta), path(flagstat) ]
idxstats = BAM_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), path(idxstats) ]
coverage = BAM_STATS_SAMTOOLS.out.coverage // channel: [ val(meta), path(coverage) ]
stats = CRAM_STATS_SAMTOOLS.out.stats // channel: [ val(meta), path(stats) ]
flagstat = CRAM_STATS_SAMTOOLS.out.flagstat // channel: [ val(meta), path(flagstat) ]
idxstats = CRAM_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), path(idxstats) ]
coverage = CRAM_STATS_SAMTOOLS.out.coverage // channel: [ val(meta), path(coverage) ]

versions = ch_versions // channel: [ versions.yml ]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json
name: "bam_markduplicates_picard"
name: "cram_markduplicates_picard"
description: Picard MarkDuplicates, index BAM file and run samtools stats, flagstat and idxstats
keywords:
- markduplicates
Expand All @@ -12,7 +12,7 @@ components:
- samtools/stats
- samtools/idxstats
- samtools/flagstat
- bam_stats_samtools
- cram_stats_samtools
input:
- ch_bam:
description: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
nextflow_workflow {

name "Test Workflow BAM_MARKDUPLICATES_PICARD"
name "Test Workflow CRAM_MARKDUPLICATES_PICARD"
script "../main.nf"
workflow "BAM_MARKDUPLICATES_PICARD"
workflow "CRAM_MARKDUPLICATES_PICARD"

tag "picard"
tag "picard/markduplicates"
tag "subworkflows"
tag "subworkflows_nfcore"
tag "bam_markduplicates_picard"
tag "subworkflows/bam_markduplicates_picard"
tag "subworkflows/bam_stats_samtools"
tag "bam_stats_samtools"
tag "cram_markduplicates_picard"
tag "subworkflows/cram_markduplicates_picard"
tag "subworkflows/cram_stats_samtools"
tag "cram_stats_samtools"
tag "samtools"
tag "samtools/flagstat"
tag "samtools/idxstats"
Expand Down
2 changes: 2 additions & 0 deletions subworkflows/local/cram_markduplicates_picard/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
subworkflows/cram_markduplicates_picard:
- subworkflows/nf-core/cram_markduplicates_picard/**
37 changes: 37 additions & 0 deletions subworkflows/local/cram_stats_samtools/bam_stats_samtools/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
CRAM_STATS_SAMTOOLS//
// Run SAMtools stats, flagstat and idxstats
//

include { SAMTOOLS_STATS } from '../../../modules/nf-core/samtools/stats/main'
include { SAMTOOLS_IDXSTATS } from '../../../modules/nf-core/samtools/idxstats/main'
include { SAMTOOLS_FLAGSTAT } from '../../../modules/nf-core/samtools/flagstat/main'
include { SAMTOOLS_COVERAGE } from '../../../modules/nf-core/samtools/coverage/main'

workflow CRAM_STATS_SAMTOOLS {
take:
ch_bam_crai // channel: [ val(meta), path(bam), path(crai) ]
ch_fasta // channel: [ val(meta), path(fasta) ]

main:
ch_versions = Channel.empty()

SAMTOOLS_STATS ( ch_bam_crai, ch_fasta )
ch_versions = ch_versions.mix(SAMTOOLS_STATS.out.versions)

SAMTOOLS_FLAGSTAT ( ch_bam_crai )
ch_versions = ch_versions.mix(SAMTOOLS_FLAGSTAT.out.versions)

SAMTOOLS_IDXSTATS ( ch_bam_crai )
ch_versions = ch_versions.mix(SAMTOOLS_IDXSTATS.out.versions)

SAMTOOLS_COVERAGE ( ch_bam_crai )
ch_versions = ch_versions.mix(SAMTOOLS_COVERAGE.out.versions)

emit:
stats = SAMTOOLS_STATS.out.stats // channel: [ val(meta), path(stats) ]
flagstat = SAMTOOLS_FLAGSTAT.out.flagstat // channel: [ val(meta), path(flagstat) ]
idxstats = SAMTOOLS_IDXSTATS.out.idxstats // channel: [ val(meta), path(idxstats) ]
coverage = SAMTOOLS_COVERAGE.out.coverage // channel: [ val(meta), path(coverage) ]

versions = ch_versions // channel: [ path(versions.yml) ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include { SAMTOOLS_IDXSTATS } from '../../../modules/nf-core/samtools/idxstats/m
include { SAMTOOLS_FLAGSTAT } from '../../../modules/nf-core/samtools/flagstat/main'
include { SAMTOOLS_COVERAGE } from '../../../modules/nf-core/samtools/coverage/main'

workflow BAM_STATS_SAMTOOLS {
workflow CRAM_STATS_SAMTOOLS {
take:
ch_bam_crai // channel: [ val(meta), path(bam), path(crai) ]
ch_fasta // channel: [ val(meta), path(fasta) ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json
name: bam_stats_samtools
name: cram_stats_samtools
description: Produces comprehensive statistics from SAM/BAM/CRAM file
keywords:
- statistics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
nextflow_workflow {

name "Test Workflow BAM_STATS_SAMTOOLS"
name "Test Workflow CRAM_STATS_SAMTOOLS"
script "../main.nf"
workflow "BAM_STATS_SAMTOOLS"
workflow "CRAM_STATS_SAMTOOLS"
tag "subworkflows"
tag "subworkflows_nfcore"
tag "bam_stats_samtools"
tag "subworkflows/bam_stats_samtools"
tag "cram_stats_samtools"
tag "subworkflows/cram_stats_samtools"
tag "samtools"
tag "samtools/flagstat"
tag "samtools/idxstats"
tag "samtools/stats"

test("test_bam_stats_samtools_single_end") {
test("test_cram_stats_samtools_single_end") {

when {
params {
Expand All @@ -36,14 +36,14 @@ nextflow_workflow {
then {
assertAll(
{ assert workflow.success},
{ assert snapshot(workflow.out.stats).match("test_bam_stats_samtools_single_end_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_bam_stats_samtools_single_end_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_bam_stats_samtools_single_end_idxstats") }
{ assert snapshot(workflow.out.stats).match("test_cram_stats_samtools_single_end_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_cram_stats_samtools_single_end_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_cram_stats_samtools_single_end_idxstats") }
)
}
}

test("test_bam_stats_samtools_paired_end") {
test("test_cram_stats_samtools_paired_end") {

when {
params {
Expand All @@ -67,14 +67,14 @@ nextflow_workflow {
then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out.stats).match("test_bam_stats_samtools_paired_end_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_bam_stats_samtools_paired_end_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_bam_stats_samtools_paired_end_idxstats") }
{ assert snapshot(workflow.out.stats).match("test_cram_stats_samtools_paired_end_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_cram_stats_samtools_paired_end_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_cram_stats_samtools_paired_end_idxstats") }
)
}
}

test("test_bam_stats_samtools_paired_end_cram") {
test("test_cram_stats_samtools_paired_end_cram") {

when {
params {
Expand All @@ -98,9 +98,9 @@ nextflow_workflow {
then {
assertAll(
{ assert workflow.success},
{ assert snapshot(workflow.out.stats).match("test_bam_stats_samtools_paired_end_cram_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_bam_stats_samtools_paired_end_cram_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_bam_stats_samtools_paired_end_cram_idxstats") }
{ assert snapshot(workflow.out.stats).match("test_cram_stats_samtools_paired_end_cram_stats") },
{ assert snapshot(workflow.out.flagstat).match("test_cram_stats_samtools_paired_end_cram_flagstats") },
{ assert snapshot(workflow.out.idxstats).match("test_cram_stats_samtools_paired_end_cram_idxstats") }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"test_bam_stats_samtools_paired_end_cram_flagstats": {
"test_cram_stats_samtools_paired_end_cram_flagstats": {
"content": [
[
[
Expand All @@ -17,7 +17,7 @@
},
"timestamp": "2023-11-06T09:31:26.194017574"
},
"test_bam_stats_samtools_paired_end_stats": {
"test_cram_stats_samtools_paired_end_stats": {
"content": [
[
[
Expand All @@ -35,7 +35,7 @@
},
"timestamp": "2024-02-13T16:45:06.230091746"
},
"test_bam_stats_samtools_paired_end_flagstats": {
"test_cram_stats_samtools_paired_end_flagstats": {
"content": [
[
[
Expand All @@ -53,7 +53,7 @@
},
"timestamp": "2024-01-18T17:17:27.717482"
},
"test_bam_stats_samtools_single_end_flagstats": {
"test_cram_stats_samtools_single_end_flagstats": {
"content": [
[
[
Expand All @@ -71,7 +71,7 @@
},
"timestamp": "2023-11-06T09:26:10.340046381"
},
"test_bam_stats_samtools_paired_end_cram_idxstats": {
"test_cram_stats_samtools_paired_end_cram_idxstats": {
"content": [
[
[
Expand All @@ -89,7 +89,7 @@
},
"timestamp": "2023-11-06T09:31:26.207052003"
},
"test_bam_stats_samtools_single_end_stats": {
"test_cram_stats_samtools_single_end_stats": {
"content": [
[
[
Expand All @@ -107,7 +107,7 @@
},
"timestamp": "2024-02-13T16:44:57.442208382"
},
"test_bam_stats_samtools_paired_end_idxstats": {
"test_cram_stats_samtools_paired_end_idxstats": {
"content": [
[
[
Expand All @@ -125,7 +125,7 @@
},
"timestamp": "2024-01-18T17:17:27.726719"
},
"test_bam_stats_samtools_single_end_idxstats": {
"test_cram_stats_samtools_single_end_idxstats": {
"content": [
[
[
Expand All @@ -143,7 +143,7 @@
},
"timestamp": "2023-11-06T09:26:10.349439801"
},
"test_bam_stats_samtools_paired_end_cram_stats": {
"test_cram_stats_samtools_paired_end_cram_stats": {
"content": [
[
[
Expand All @@ -161,4 +161,4 @@
},
"timestamp": "2024-02-13T16:45:14.997164209"
}
}
}
2 changes: 2 additions & 0 deletions subworkflows/local/cram_stats_samtools/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
subworkflows/cram_stats_samtools:
- subworkflows/nf-core/cram_stats_samtools/**
2 changes: 0 additions & 2 deletions subworkflows/nf-core/bam_markduplicates_picard/tests/tags.yml

This file was deleted.

2 changes: 0 additions & 2 deletions subworkflows/nf-core/bam_stats_samtools/tests/tags.yml

This file was deleted.

Loading

0 comments on commit 82e4f68

Please sign in to comment.