Skip to content

Commit

Permalink
Merge pull request #339 from JoseEspinosa/fixes
Browse files Browse the repository at this point in the history
Some fixes
  • Loading branch information
JoseEspinosa authored Apr 18, 2023
2 parents 8f4d262 + aece0fb commit 3b94a84
Show file tree
Hide file tree
Showing 40 changed files with 1,304 additions and 460 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated pipeline template to [nf-core/tools 2.7.2](https://github.com/nf-core/tools/releases/tag/2.7.2)
- [[#317](https://github.com/nf-core/chipseq/issues/317)] Added metro map
- [[#288](https://github.com/nf-core/chipseq/issues/291)] Bump `chromap` version 2 and enable all the steps below chromap again when paired-end data is processed.
- [[#311](https://github.com/nf-core/chipseq/issues/311)] Add back `--skip_spp` parameter which was unintentionally removed from the code.
- Install available nf-core subworkflows and refactor code accordingly
- [[#318](https://github.com/nf-core/chipseq/issues/318)] Update `bowtie2/align` module to fix issue when downloading its singularity image.

## [[2.0.0](https://github.com/nf-core/chipseq/releases/tag/2.0.0)] - 2022-10-03

Expand Down
53 changes: 34 additions & 19 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ process {

if (!(params.skip_fastqc || params.skip_qc)) {
process {
withName: '.*:FASTQC_TRIMGALORE:FASTQC' {
withName: 'FASTQC' {
ext.args = '--quiet'
publishDir = [
[
Expand All @@ -142,11 +142,17 @@ if (!(params.skip_fastqc || params.skip_qc)) {

if (!params.skip_trimming) {
process {
withName: '.*:FASTQC_TRIMGALORE:TRIMGALORE' {
ext.args = [
'--fastqc',
params.trim_nextseq > 0 ? "--nextseq ${params.trim_nextseq}" : ''
].join(' ').trim()
withName: 'TRIMGALORE' {
ext.args = {
[
'--fastqc',
params.trim_nextseq > 0 ? "--nextseq ${params.trim_nextseq}" : '',
params.clip_r1 > 0 ? "--clip_r1 ${params.clip_r1}" : '',
params.clip_r2 > 0 ? "--clip_r2 ${params.clip_r2}" : '',
params.three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${params.three_prime_clip_r1}" : '',
params.three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${params.three_prime_clip_r2}" : ''
].join(' ').trim()
}
publishDir = [
[
path: { "${params.outdir}/trimgalore/fastqc" },
Expand Down Expand Up @@ -175,7 +181,7 @@ if (!params.skip_trimming) {
}

process {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:ALIGN_.*:BAM_SORT_SAMTOOLS:SAMTOOLS_SORT' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' {
ext.prefix = { "${meta.id}.Lb.sorted" }
publishDir = [
path: { "${params.outdir}/${params.aligner}/library" },
Expand All @@ -185,7 +191,7 @@ process {
]
}

withName: 'NFCORE_CHIPSEQ:CHIPSEQ:ALIGN_.*:BAM_SORT_SAMTOOLS:SAMTOOLS_INDEX' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' {
publishDir = [
path: { "${params.outdir}/${params.aligner}/library" },
mode: params.publish_dir_mode,
Expand All @@ -194,7 +200,7 @@ process {
]
}

withName: 'NFCORE_CHIPSEQ:CHIPSEQ:ALIGN_.*:BAM_SORT_SAMTOOLS:BAM_STATS_SAMTOOLS:SAMTOOLS_.*' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:.*:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:SAMTOOLS_.*' {
ext.prefix = { "${meta.id}.Lb.sorted.bam" }
publishDir = [
path: { "${params.outdir}/${params.aligner}/library/samtools_stats/" },
Expand All @@ -208,11 +214,13 @@ process {
if (params.aligner == 'bwa') {
process {
withName: 'BWA_MEM' {
ext.args = { [
'-M',
params.bwa_min_score ? " -T ${params.bwa_min_score}" : '',
meta.read_group ? "-R ${meta.read_group}": ''
].join(' ').trim() }
ext.args = {
[
'-M',
params.bwa_min_score ? " -T ${params.bwa_min_score}" : '',
meta.read_group ? "-R ${meta.read_group}": ''
].join(' ').trim()
}
ext.args2 = '-bhS -F 0x0100 -O BAM'
ext.prefix = { "${meta.id}.Lb" }
publishDir = [
Expand Down Expand Up @@ -351,8 +359,15 @@ process {
}

// Should only be published when paired end data is used and save_align_intermeds is true
withName: 'BAM_FILTER' {
ext.prefix = { meta.single_end ? "${meta.id}.mLb.noPublish" : "${meta.id}.mLb.flT.sorted" }
withName: 'BAMTOOLS_FILTER' {
ext.args = {
[
meta.single_end ? '-F 0x004' : '-F 0x004 -F 0x0008 -f 0x001',
params.keep_dups ? '' : '-F 0x0400',
params.keep_multi_map ? '' : '-q 1'
].join(' ').trim()
}
ext.prefix = { meta.single_end ? "${meta.id}.mLb.noPublish" : "${meta.id}.mLb.flT.sorted" } //TODO check with atacseq
publishDir = [
path: { "${params.outdir}/${params.aligner}/mergedLibrary" },
mode: params.publish_dir_mode,
Expand All @@ -367,7 +382,7 @@ process {
publishDir = [ enabled: false ]
}

withName: 'NFCORE_CHIPSEQ:CHIPSEQ:FILTER_BAM_BAMTOOLS:BAM_SORT_SAMTOOLS:SAMTOOLS_SORT' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:SAMTOOLS_SORT' {
ext.prefix = { "${meta.id}.mLb.clN.sorted" }
publishDir = [
path: { "${params.outdir}/${params.aligner}/mergedLibrary" },
Expand All @@ -376,7 +391,7 @@ process {
]
}

withName: 'NFCORE_CHIPSEQ:CHIPSEQ:FILTER_BAM_BAMTOOLS:BAM_SORT_SAMTOOLS:SAMTOOLS_INDEX' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:SAMTOOLS_INDEX' {
ext.prefix = { "${meta.id}.mLb.clN.sorted" }
publishDir = [
path: { "${params.outdir}/${params.aligner}/mergedLibrary" },
Expand All @@ -385,7 +400,7 @@ process {
]
}

withName: 'NFCORE_CHIPSEQ:CHIPSEQ:FILTER_BAM_BAMTOOLS:BAM_SORT_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' {
withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:BAM_STATS_SAMTOOLS:.*' {
ext.prefix = { "${meta.id}.mLb.clN.sorted.bam" }
publishDir = [
path: { "${params.outdir}/${params.aligner}/mergedLibrary/samtools_stats" },
Expand Down
72 changes: 55 additions & 17 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"nf-core": {
"bowtie2/align": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["fastq_align_bowtie2", "modules"]
},
"bowtie2/build": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
},
"bwa/index": {
Expand All @@ -23,12 +23,12 @@
"bwa/mem": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["fastq_align_bwa", "modules"]
},
"chromap/chromap": {
"branch": "master",
"git_sha": "d6b7b1f108dab88b0269a4331767c36a1a8da960",
"installed_by": ["modules"]
"git_sha": "b7f0dbc07af00c0ccdc7c2df06efee8786e976ac",
"installed_by": ["fastq_align_chromap", "modules"]
},
"chromap/index": {
"branch": "master",
Expand All @@ -42,9 +42,8 @@
},
"custom/getchromsizes": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"],
"patch": "modules/nf-core/custom/getchromsizes/custom-getchromsizes.diff"
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
},
"deeptools/computematrix": {
"branch": "master",
Expand All @@ -69,7 +68,7 @@
"fastqc": {
"branch": "master",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
"installed_by": ["modules", "fastq_fastqc_umitools_trimgalore"]
},
"gffread": {
"branch": "master",
Expand Down Expand Up @@ -108,7 +107,7 @@
},
"picard/collectmultiplemetrics": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"git_sha": "75027bf77472b1f4fd2cdd7e46f83119dfb0f2c6",
"installed_by": ["modules"]
},
"picard/markduplicates": {
Expand All @@ -129,27 +128,27 @@
"samtools/flagstat": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"samtools/idxstats": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"samtools/index": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["bam_sort_stats_samtools", "modules"]
},
"samtools/sort": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["bam_sort_stats_samtools", "modules"]
},
"samtools/stats": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["bam_stats_samtools", "modules"]
},
"subread/featurecounts": {
"branch": "master",
Expand All @@ -159,19 +158,58 @@
"trimgalore": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
"installed_by": ["modules", "fastq_fastqc_umitools_trimgalore"]
},
"ucsc/bedgraphtobigwig": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
},
"umitools/extract": {
"branch": "master",
"git_sha": "ffe2f5865f608848e440a52b73c304ea79aaf818",
"installed_by": ["fastq_fastqc_umitools_trimgalore"]
},
"untar": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"installed_by": ["modules"]
}
}
},
"subworkflows": {
"nf-core": {
"bam_sort_stats_samtools": {
"branch": "master",
"git_sha": "3911652a6b24249358f79e8b8466338d63efb2a2",
"installed_by": ["fastq_align_bowtie2", "fastq_align_chromap", "fastq_align_bwa"]
},
"bam_stats_samtools": {
"branch": "master",
"git_sha": "b4b7f89e7fd6d2293f0c176213f710e0bcdaf19e",
"installed_by": ["bam_sort_stats_samtools"]
},
"fastq_align_bowtie2": {
"branch": "master",
"git_sha": "ac75f79157ecc64283a2b3a559f1ba90bc0f2259",
"installed_by": ["subworkflows"]
},
"fastq_align_bwa": {
"branch": "master",
"git_sha": "901fab507683647b43e7032f3ae9e4c234eb68eb",
"installed_by": ["subworkflows"]
},
"fastq_align_chromap": {
"branch": "master",
"git_sha": "ac75f79157ecc64283a2b3a559f1ba90bc0f2259",
"installed_by": ["subworkflows"]
},
"fastq_fastqc_umitools_trimgalore": {
"branch": "master",
"git_sha": "100caf3506850ffcc04953f724a97f422940c377",
"installed_by": ["subworkflows"]
}
}
}
}
}
Expand Down
24 changes: 10 additions & 14 deletions modules/local/bam_filter.nf → modules/local/bamtools_filter.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/*
* Filter BAM file
*/
process BAM_FILTER {
process BAMTOOLS_FILTER {
tag "$meta.id"
label 'process_medium'

Expand All @@ -20,19 +17,18 @@ process BAM_FILTER {
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions

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

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def filter_params = meta.single_end ? '-F 0x004' : '-F 0x004 -F 0x0008 -f 0x001'
def dup_params = params.keep_dups ? '' : '-F 0x0400'
def multimap_params = params.keep_multi_map ? '' : '-q 1'
def blacklist_params = params.blacklist ? "-L $bed" : ''
def config = meta.single_end ? bamtools_filter_se_config : bamtools_filter_pe_config
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def blacklist = bed ? "-L $bed" : ''
def config = meta.single_end ? bamtools_filter_se_config : bamtools_filter_pe_config
"""
samtools view \\
$filter_params \\
$dup_params \\
$multimap_params \\
$blacklist_params \\
$args \\
$blacklist \\
-b $bam \\
| bamtools filter \\
-out ${prefix}.bam \\
Expand Down
8 changes: 6 additions & 2 deletions modules/local/star_align.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ process STAR_ALIGN {
input:
tuple val(meta), path(reads)
path index
val seq_center

output:
tuple val(meta), path('*d.out.bam') , emit: bam
Expand All @@ -25,10 +26,13 @@ process STAR_ALIGN {
tuple val(meta), path('*fastq.gz') , optional:true, emit: fastq
tuple val(meta), path('*.tab') , optional:true, emit: tab

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'"
def seq_center_tag = seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'"
def out_sam_type = (args.contains('--outSAMtype')) ? '' : '--outSAMtype BAM Unsorted'
def mv_unsorted_bam = (args.contains('--outSAMtype BAM Unsorted SortedByCoordinate')) ? "mv ${prefix}.Aligned.out.bam ${prefix}.Aligned.unsort.out.bam" : ''
"""
Expand All @@ -38,7 +42,7 @@ process STAR_ALIGN {
--runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\
$out_sam_type \\
$seq_center \\
$seq_center_tag \\
$args
$mv_unsorted_bam
if [ -f ${prefix}.Unmapped.out.mate1 ]; then
Expand Down
16 changes: 8 additions & 8 deletions modules/nf-core/bowtie2/align/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b94a84

Please sign in to comment.