Add CRAM to samtools/index (#1049)

* feat: update samtools/index

* feat: add test

* fix: lint

* fix: output file + md5
This commit is contained in:
Maxime U. Garcia 2021-11-10 10:30:48 +01:00 committed by GitHub
parent b399f22af2
commit 1abe23e159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 7 deletions

View file

@ -19,16 +19,17 @@ process SAMTOOLS_INDEX {
}
input:
tuple val(meta), path(bam)
tuple val(meta), path(input)
output:
tuple val(meta), path("*.bai"), optional:true, emit: bai
tuple val(meta), path("*.csi"), optional:true, emit: csi
path "versions.yml" , emit: versions
tuple val(meta), path("*.bai") , optional:true, emit: bai
tuple val(meta), path("*.crai"), optional:true, emit: crai
tuple val(meta), path("*.csi") , optional:true, emit: csi
path "versions.yml" , emit: versions
script:
"""
samtools index $options.args $bam
samtools index $options.args $input
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -35,6 +35,10 @@ output:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}"
- crai:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}"
- csi:
type: file
description: CSI index file
@ -46,3 +50,4 @@ output:
authors:
- "@drpatelh"
- "@ewels"
- "@maxulysse"

View file

@ -2,8 +2,9 @@
nextflow.enable.dsl = 2
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_BAI } from '../../../../modules/samtools/index/main.nf' addParams( options: [:] )
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_CSI } from '../../../../modules/samtools/index/main.nf' addParams( options: [args:'-c'] )
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_BAI } from '../../../../modules/samtools/index/main.nf' addParams( options: [:] )
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_CRAI } from '../../../../modules/samtools/index/main.nf' addParams( options: [:] )
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_CSI } from '../../../../modules/samtools/index/main.nf' addParams( options: [args:'-c'] )
workflow test_samtools_index_bai {
input = [ [ id:'test', single_end:false ], // meta map
@ -13,6 +14,14 @@ workflow test_samtools_index_bai {
SAMTOOLS_INDEX_BAI ( input )
}
workflow test_samtools_index_crai {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true)
]
SAMTOOLS_INDEX_CRAI ( input )
}
workflow test_samtools_index_csi {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)

View file

@ -7,6 +7,15 @@
- path: output/samtools/test.paired_end.sorted.bam.bai
md5sum: 704c10dd1326482448ca3073fdebc2f4
- name: samtools index crai
command: nextflow run tests/modules/samtools/index -entry test_samtools_index_crai -c tests/config/nextflow.config
tags:
- samtools
- samtools/index
files:
- path: output/samtools/test.paired_end.recalibrated.sorted.cram.crai
md5sum: 537e3d8c937bcc4e34e1cf47cd71d484
- name: samtools index csi
command: nextflow run tests/modules/samtools/index -entry test_samtools_index_csi -c tests/config/nextflow.config
tags: