Update samtools view (#2098)

* samtools view update

* remove csi output

* prettier

* update meta

* add index functionality

* prettier

* fixed test checks
This commit is contained in:
Priyanka Surana 2022-09-23 15:52:01 +01:00 committed by GitHub
parent 402631fdaa
commit 09159edc9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 10 deletions

View file

@ -15,6 +15,9 @@ process SAMTOOLS_VIEW {
tuple val(meta), path("*.bam"), emit: bam, optional: true
tuple val(meta), path("*.cram"), emit: cram, optional: true
tuple val(meta), path("*.sam"), emit: sam, optional: true
tuple val(meta), path("*.bai"), emit: bai, optional: true
tuple val(meta), path("*.csi"), emit: csi, optional: true
tuple val(meta), path("*.crai"), emit: crai, optional: true
path "versions.yml", emit: versions
when:
@ -35,8 +38,8 @@ process SAMTOOLS_VIEW {
--threads ${task.cpus-1} \\
${reference} \\
$args \\
$input \\
> ${prefix}.${file_type}
-o ${prefix}.${file_type} \\
$input
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -51,6 +51,19 @@ output:
type: file
description: optional filtered/converted SAM file
pattern: "*.{sam}"
# bai, csi, and crai are created with `--write-index`
- bai:
type: file
description: optional BAM file index
pattern: "*.{bai}"
- csi:
type: file
description: optional tabix BAM file index
pattern: "*.{csi}"
- crai:
type: file
description: optional CRAM file index
pattern: "*.{crai}"
- versions:
type: file
description: File containing software versions

View file

@ -33,6 +33,16 @@ workflow test_samtools_view_convert {
SAMTOOLS_VIEW ( input, fasta )
}
workflow test_samtools_view_index {
input = [ [ id: 'test' ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
[]
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
SAMTOOLS_VIEW ( input, fasta )
}
workflow test_samtools_view_stubs {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true),

View file

@ -6,4 +6,8 @@ process {
ext.args = "--output-fmt bam"
}
withName: 'test_samtools_view_index:SAMTOOLS_VIEW' {
ext.args = "--output-fmt bam --write-index"
}
}

View file

@ -5,7 +5,7 @@
- samtools/view
files:
- path: output/samtools/test.bam
md5sum: 8fb1e82f76416e9e30fc6b2357e2cf13
md5sum: e6a9285be7b1c616dc4e17679fce5f1e
- name: samtools view test_samtools_view_cram
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view_cram -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
@ -14,7 +14,6 @@
- samtools/view
files:
- path: output/samtools/test.cram
md5sum: 792399d4d7afc9e58ffeedc1073291b9
- name: samtools view test_samtools_view_convert
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view_convert -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
@ -23,7 +22,18 @@
- samtools/view
files:
- path: output/samtools/test.bam
md5sum: 3877632410d032e91a91b054c906a310
md5sum: 4f4a97da17db79c78b1912da3cdc1d8f
- name: samtools view test_samtools_view_index
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view_index -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
tags:
- samtools
- samtools/view
files:
- path: output/samtools/test.bam
md5sum: b2d2482cea94adfc9628473792b0d215
- path: output/samtools/test.bam.csi
md5sum: 343a2085b436cab2123147dafd255607
- name: samtools view test_samtools_view_stubs
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view_stubs -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
@ -32,4 +42,4 @@
- samtools/view
files:
- path: output/samtools/test.bam
md5sum: 8fb1e82f76416e9e30fc6b2357e2cf13
md5sum: e6a9285be7b1c616dc4e17679fce5f1e