Skip to content

Commit

Permalink
Merge pull request #2 from cibinsb/arima_filter_five_end
Browse files Browse the repository at this point in the history
created module Arima filter_five_end.pl
  • Loading branch information
muffato authored Mar 9, 2022
2 parents d1aac93 + 6a1d25b commit 44e8949
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 0 deletions.
44 changes: 44 additions & 0 deletions modules/arima/filterfiveend/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

process ARIMA_FILTERFIVEEND {
tag "$meta.id"
label 'process_medium'
def version = '0.001-c24'

if (params.enable_conda) {
exit 1, "Conda environments cannot be used when using the arima filter_five_end_v1 tool. Please use docker or singularity containers."
}
container "quay.io/sanger-tol/arima:${version}"

input:
tuple val(meta), path(read)

output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
if (meta.single_end) {
"""
samtools view -h ${read} | filter_five_end.pl | samtools view -Sb $args -@ $task.cpus -o ${prefix}_filtered.bam -
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )
arima: ${version}
END_VERSIONS
"""
} else {
"""
samtools view -h ${read[0]} | filter_five_end.pl | samtools view -Sb $args -@ $task.cpus -o ${prefix}_1_filtered.bam -
samtools view -h ${read[1]} | filter_five_end.pl | samtools view -Sb $args -@ $task.cpus -o ${prefix}_2_filtered.bam -
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )
arima: ${version}
END_VERSIONS
"""
}
}
54 changes: 54 additions & 0 deletions modules/arima/filterfiveend/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: arima_filterfiveend
description: Filter BAM files using Arima filter_five_end.pl
keywords:
- bam
- filter
- filterfiveend
- samtools
tools:
- arima:
description: A wrapper tool around Arima Genomics's filter_five_end.pl to filter BAM files.
homepage: https://arimagenomics.com
documentation: https://github.com/ArimaGenomics/mapping_pipeline/blob/master/Arima_Mapping_UserGuide_A160156_v02.pdf
tool_dev_url: https://github.com/ArimaGenomics/mapping_pipeline
licence: MIT

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input BAM files of size 1 and 2 for single-end and paired-end data,
respectively.
- bam:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input adapter trimmed FastQ files of size 1 and 2 for
single-end and paired-end data, respectively.
pattern: "*.{_filtered.bam}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

authors:
- "@cibinsb"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ amrfinderplus/update:
- modules/amrfinderplus/update/**
- tests/modules/amrfinderplus/update/**

arima/filterfiveend:
- modules/arima/filterfiveend/**
- tests/modules/arima/filterfiveend/**

arriba:
- modules/arriba/**
- tests/modules/arriba/**
Expand Down
26 changes: 26 additions & 0 deletions tests/modules/arima/filterfiveend/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { ARIMA_FILTERFIVEEND } from '../../../../modules/arima/filterfiveend/main.nf'

workflow test_arima_filterfiveend_single_end {

input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
]

ARIMA_FILTERFIVEEND ( input )
}

workflow test_arima_filterfiveend_paired_end {

input = [
[ id:'test', single_end:false ], // meta map
[file(params.test_data['bacteroides_fragilis']['illumina']['test1_paired_end_bam'], checkIfExists: true),
file(params.test_data['bacteroides_fragilis']['illumina']['test2_paired_end_bam'], checkIfExists: true)]
]

ARIMA_FILTERFIVEEND ( input )
}
5 changes: 5 additions & 0 deletions tests/modules/arima/filterfiveend/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

}
23 changes: 23 additions & 0 deletions tests/modules/arima/filterfiveend/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: arima filterfiveend test_arima_filterfiveend_single_end
command: nextflow run tests/modules/arima/filterfiveend -entry test_arima_filterfiveend_single_end -c tests/config/nextflow.config
tags:
- arima
- arima/filterfiveend
files:
- path: output/arima/test_filtered.bam
md5sum: 1f31e75a195da133180d8201597d2841
- path: output/arima/versions.yml
md5sum: dcb824f6fc3ab7d5a20afcf2508aa099

- name: arima filterfiveend test_arima_filterfiveend_paired_end
command: nextflow run tests/modules/arima/filterfiveend -entry test_arima_filterfiveend_paired_end -c tests/config/nextflow.config
tags:
- arima
- arima/filterfiveend
files:
- path: output/arima/test_1_filtered.bam
md5sum: 92cd899240cee1ec731ea071023fa56a
- path: output/arima/test_2_filtered.bam
md5sum: 65df90c6d00fbdfc849d2b72fdfbe1c8
- path: output/arima/versions.yml
md5sum: a2d3a97555e1ad30e0c157aef66d25ed

0 comments on commit 44e8949

Please sign in to comment.