Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply samtools fixmate after ivar trim #396

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Special thanks to the following for their code contributions to the release:

- [Adam Talbot](https://github.com/adamrtalbot)
- [Joon Klaps](https://github.com/Joon-Klaps)
- [Jessica Wu](https://github.com/wutron)

Thank you to everyone else that has contributed by reporting bugs, enhancements or in any other way, shape or form.

### Enhancements & fixes

- [[PR #396](https://github.com/nf-core/viralrecon/pull/396)] - Apply samtools fixmate after ivar trim
- [[#299](https://github.com/nf-core/viralrecon/issues/299)] - Add the freyja pipeline as a subworkflow
- [[PR #387](https://github.com/nf-core/viralrecon/pull/387)] - Software closes gracefully when encountering an error
- [[PR #395](https://github.com/nf-core/viralrecon/pull/395)] - Remove minia from default assemblers because it is unreliable
Expand Down
14 changes: 14 additions & 0 deletions conf/modules_illumina.config
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@ if (!params.skip_variants) {
]
}

withName: '.*:.*:BAM_TRIM_PRIMERS_IVAR:SAMTOOLS_COLLATE' {
ext.prefix = { "${meta.id}.ivar_trim.collate" }
publishDir = [ enabled:false ]
}

withName: '.*:.*:BAM_TRIM_PRIMERS_IVAR:SAMTOOLS_FIXMATE' {
ext.prefix = { "${meta.id}.ivar_trim" }
publishDir = [
path: { "${params.outdir}/variants/bowtie2" },
mode: params.publish_dir_mode,
pattern: "*.bam"
]
}

withName: '.*:.*:BAM_TRIM_PRIMERS_IVAR:.*:SAMTOOLS_SORT' {
ext.prefix = { "${meta.id}.ivar_trim.sorted" }
publishDir = [
Expand Down
46 changes: 46 additions & 0 deletions modules/nf-core/samtools/collate/main.nf

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

44 changes: 44 additions & 0 deletions modules/nf-core/samtools/collate/meta.yml

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

37 changes: 37 additions & 0 deletions modules/nf-core/samtools/fixmate/main.nf

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

49 changes: 49 additions & 0 deletions modules/nf-core/samtools/fixmate/meta.yml

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

15 changes: 13 additions & 2 deletions subworkflows/local/bam_trim_primers_ivar.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

include { IVAR_TRIM } from '../../modules/nf-core/ivar/trim/main'
include { BAM_SORT_STATS_SAMTOOLS } from '../nf-core/bam_sort_stats_samtools/main'
include { SAMTOOLS_COLLATE } from '../../modules/nf-core/samtools/collate/main'
include { SAMTOOLS_FIXMATE } from '../../modules/nf-core/samtools/fixmate/main'

workflow BAM_TRIM_PRIMERS_IVAR {
take:
Expand All @@ -24,17 +26,26 @@ workflow BAM_TRIM_PRIMERS_IVAR {
)
ch_versions = ch_versions.mix(IVAR_TRIM.out.versions.first())

//
// samtools fixmate fills in mate coordinates and insert size fields
//
SAMTOOLS_COLLATE ( IVAR_TRIM.out.bam, fasta )
ch_versions = ch_versions.mix(SAMTOOLS_COLLATE.out.versions.first())

SAMTOOLS_FIXMATE ( SAMTOOLS_COLLATE.out.bam )
ch_versions = ch_versions.mix(SAMTOOLS_FIXMATE.out.versions.first())

//
// Sort, index BAM file and run samtools stats, flagstat and idxstats
//
BAM_SORT_STATS_SAMTOOLS (
IVAR_TRIM.out.bam,
SAMTOOLS_FIXMATE.out.bam,
fasta
)
ch_versions = ch_versions.mix(BAM_SORT_STATS_SAMTOOLS.out.versions)

emit:
bam_orig = IVAR_TRIM.out.bam // channel: [ val(meta), bam ]
bam_orig = SAMTOOLS_FIXMATE.out.bam // channel: [ val(meta), bam ]
log_out = IVAR_TRIM.out.log // channel: [ val(meta), log ]

bam = BAM_SORT_STATS_SAMTOOLS.out.bam // channel: [ val(meta), [ bam ] ]
Expand Down
Loading