Add cram support to Allelecounter module (#1013)

* Add CRAM support to allelecounter

* Update meta.yml

* Rename bam,bai to input,input_index

* Apply suggestions from code review

* Fix reference to renamed variable

Co-authored-by: Maxime U. Garcia <maxime.garcia@scilifelab.se>
This commit is contained in:
fbdtemme 2021-11-02 17:00:25 +01:00 committed by GitHub
parent 374d81e0b3
commit 4619d012e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 9 deletions

View file

@ -19,8 +19,9 @@ process ALLELECOUNTER {
} }
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(input), path(input_index)
path loci path loci
path fasta
output: output:
tuple val(meta), path("*.alleleCount"), emit: allelecount tuple val(meta), path("*.alleleCount"), emit: allelecount
@ -28,11 +29,14 @@ process ALLELECOUNTER {
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def reference_options = fasta ? "-r $fasta": ""
""" """
alleleCounter \\ alleleCounter \\
$options.args \\ $options.args \\
-l $loci \\ -l $loci \\
-b $bam \\ -b $input \\
$reference_options \\
-o ${prefix}.alleleCount -o ${prefix}.alleleCount
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml

View file

@ -19,11 +19,11 @@ input:
description: | description: |
Groovy Map containing sample information Groovy Map containing sample information
e.g. [ id:'test', single_end:false ] e.g. [ id:'test', single_end:false ]
- bam: - input:
type: file type: file
description: BAM/CRAM/SAM file description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}" pattern: "*.{bam,cram,sam}"
- bai: - input_index:
type: file type: file
description: BAM/CRAM/SAM index file description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}" pattern: "*.{bai,crai,sai}"
@ -31,7 +31,9 @@ input:
type: file type: file
description: loci file <CHR><tab><POS1> description: loci file <CHR><tab><POS1>
pattern: "*.{tsv}" pattern: "*.{tsv}"
- fasta:
type: file
description: Input genome fasta file. Required when passing CRAM files.
output: output:
- meta: - meta:
@ -50,3 +52,4 @@ output:
authors: authors:
- "@fullama" - "@fullama"
- "@fbdtemme"

View file

@ -3,12 +3,24 @@ nextflow.enable.dsl = 2
include { ALLELECOUNTER } from '../../../modules/allelecounter/main.nf' addParams( options: [:] ) include { ALLELECOUNTER } from '../../../modules/allelecounter/main.nf' addParams( options: [:] )
workflow test_allelecounter { workflow test_allelecounter_bam {
input = [ [ id:'test', single_end:false ], // meta map input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
] ]
positions = [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ] positions = [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ]
ALLELECOUNTER ( input, positions ) ALLELECOUNTER ( input, positions, [] )
}
workflow test_allelecounter_cram {
input = [ [ id:'test', single_end:false ], // meta map
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)
]
positions = [ file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ]
fasta = [ file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) ]
ALLELECOUNTER ( input, positions, fasta )
} }

View file

@ -1,7 +1,15 @@
- name: allelecounter test_allelecounter - name: allelecounter test_allelecounter_bam
command: nextflow run tests/modules/allelecounter -entry test_allelecounter -c tests/config/nextflow.config command: nextflow run tests/modules/allelecounter -entry test_allelecounter_bam -c tests/config/nextflow.config
tags: tags:
- allelecounter - allelecounter
files: files:
- path: output/allelecounter/test.alleleCount - path: output/allelecounter/test.alleleCount
md5sum: 2bbe9d7331b78bdac30fe30dbc5fdaf3 md5sum: 2bbe9d7331b78bdac30fe30dbc5fdaf3
- name: allelecounter test_allelecounter_cram
command: nextflow run tests/modules/allelecounter -entry test_allelecounter_cram -c tests/config/nextflow.config
tags:
- allelecounter
files:
- path: output/allelecounter/test.alleleCount
md5sum: 2f83352a185168c7c98e9e42550b2856