mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-21 10:48:18 +00:00
Update samtools view (#2096)
* samtools view update * remove csi output * prettier * update meta
This commit is contained in:
parent
0857e6c60f
commit
402631fdaa
5 changed files with 49 additions and 22 deletions
|
@ -14,7 +14,7 @@ process SAMTOOLS_VIEW {
|
|||
output:
|
||||
tuple val(meta), path("*.bam") , emit: bam , optional: true
|
||||
tuple val(meta), path("*.cram"), emit: cram, optional: true
|
||||
tuple val(meta), path("*.csi") , emit: csi, optional: true
|
||||
tuple val(meta), path("*.sam") , emit: sam , optional: true
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
when:
|
||||
|
@ -22,10 +22,12 @@ process SAMTOOLS_VIEW {
|
|||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def args2 = task.ext.args2 ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def reference = fasta ? "--reference ${fasta} -C" : ""
|
||||
def file_type = input.getExtension()
|
||||
def reference = fasta ? "--reference ${fasta}" : ""
|
||||
def file_type = args.contains("--output-fmt sam") ? "sam" :
|
||||
args.contains("--output-fmt bam") ? "bam" :
|
||||
args.contains("--output-fmt cram") ? "cram" :
|
||||
input.getExtension()
|
||||
if ("$input" == "${prefix}.${file_type}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
|
||||
"""
|
||||
samtools \\
|
||||
|
@ -34,7 +36,6 @@ process SAMTOOLS_VIEW {
|
|||
${reference} \\
|
||||
$args \\
|
||||
$input \\
|
||||
$args2 \\
|
||||
> ${prefix}.${file_type}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
|
|
|
@ -41,21 +41,22 @@ output:
|
|||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: filtered/converted BAM/SAM file
|
||||
pattern: "*.{bam,sam}"
|
||||
description: optional filtered/converted BAM file
|
||||
pattern: "*.{bam}"
|
||||
- cram:
|
||||
type: file
|
||||
description: filtered/converted CRAM file
|
||||
pattern: "*.cram"
|
||||
description: optional filtered/converted CRAM file
|
||||
pattern: "*.{cram}"
|
||||
- sam:
|
||||
type: file
|
||||
description: optional filtered/converted SAM file
|
||||
pattern: "*.{sam}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- csi:
|
||||
type: file
|
||||
description: BAM index file (optional)
|
||||
pattern: "*.csi"
|
||||
authors:
|
||||
- "@drpatelh"
|
||||
- "@joseespinosa"
|
||||
- "@FriederikeHanssen"
|
||||
- "@priyanka-surana"
|
||||
|
|
|
@ -15,14 +15,24 @@ workflow test_samtools_view {
|
|||
|
||||
workflow test_samtools_view_cram {
|
||||
input = [ [ id: 'test' ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true)
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true)
|
||||
]
|
||||
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
|
||||
|
||||
SAMTOOLS_VIEW ( input, fasta )
|
||||
}
|
||||
|
||||
workflow test_samtools_view_convert {
|
||||
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),
|
||||
|
|
|
@ -2,4 +2,8 @@ process {
|
|||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
withName: 'test_samtools_view_convert:SAMTOOLS_VIEW' {
|
||||
ext.args = "--output-fmt bam"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,35 @@
|
|||
- name: samtools view test_samtools_view
|
||||
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
|
||||
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
|
||||
tags:
|
||||
- samtools/view
|
||||
- samtools
|
||||
- samtools/view
|
||||
files:
|
||||
- path: output/samtools/test.bam
|
||||
md5sum: 8fb1e82f76416e9e30fc6b2357e2cf13
|
||||
|
||||
- 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
|
||||
command: nextflow run ./tests/modules/samtools/view -entry test_samtools_view_cram -c ./tests/config/nextflow.config -c ./tests/modules/samtools/view/nextflow.config
|
||||
tags:
|
||||
- samtools/view
|
||||
- samtools
|
||||
- samtools/view
|
||||
files:
|
||||
- path: output/samtools/test.cram
|
||||
md5sum: 792399d4d7afc9e58ffeedc1073291b9
|
||||
|
||||
- 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 -stub-run
|
||||
- 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
|
||||
tags:
|
||||
- samtools/view
|
||||
- samtools
|
||||
- samtools/view
|
||||
files:
|
||||
- path: output/samtools/test.bam
|
||||
md5sum: 3877632410d032e91a91b054c906a310
|
||||
|
||||
- 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
|
||||
tags:
|
||||
- samtools
|
||||
- samtools/view
|
||||
files:
|
||||
- path: output/samtools/test.bam
|
||||
md5sum: 8fb1e82f76416e9e30fc6b2357e2cf13
|
||||
|
|
Loading…
Reference in a new issue