Create atlas/splitmerge Module (#1756)

* Add atlas/splitmerge module

* Finish the tests for atlas/splitmerge

* Prettier

* Update modules/atlas/splitmerge/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Remove curly brackets from meta.yml parameters

For single-file outputs, as reviewed

* Lintung: Remove trailing white-space

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Merlin Szymanski 2022-06-13 15:09:32 +02:00 committed by GitHub
parent 81232af296
commit 8f199c4fa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 144 additions and 1 deletions

View file

@ -0,0 +1,36 @@
process ATLAS_SPLITMERGE {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::atlas=0.9.9" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/atlas:0.9.9--h082e891_0':
'quay.io/biocontainers/atlas:0.9.9--h082e891_0' }"
input:
tuple val(meta), path(bam), path(bai), path(read_group_settings), path(blacklist)
output:
tuple val(meta), path("*_mergedReads.bam"), path("*.txt.gz"), emit: data
path "versions.yml", emit: versions
when:
task.ext.when == null || task.ext.when
script:
def optional = blacklist ? 'blacklist=${blacklist}' : ''
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
atlas \\
task=splitMerge bam=${bam} \\
readGroupSettings=${read_group_settings}\\
$optional \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
atlas: \$((atlas 2>&1) | grep Atlas | head -n 1 | sed -e 's/^[ \t]*Atlas //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,70 @@
name: "atlas_splitmerge"
description: split single end read groups by length and merge paired end reads
keywords:
- split
- merge
- bam
- read group
tools:
- "atlas":
description: "ATLAS, a suite of methods to accurately genotype and estimate genetic diversity"
homepage: "https://bitbucket.org/wegmannlab/atlas/wiki/Home"
documentation: "https://bitbucket.org/wegmannlab/atlas/wiki/Home"
tool_dev_url: "https://bitbucket.org/wegmannlab/atlas"
doi: "10.1101/105346"
licence: "['GPL v3']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: Single input BAM file.
pattern: "*.bam"
- bai:
type: file
description: The BAI file for the input BAM file
pattern: "*.bai"
- read_group_setting:
type: file
description: |
TXT file containing the split and merge settings for
each readgroup. Each line consist of one readgroup,
single/double identifier and the maximum cycle number
of the sequencer. e.g. "RG1 single 100"
pattern: "*.txt"
- blacklist:
type: file
description: |
blacklist.txt (optional), A txt file with blacklisted read names
that should be ignored and just written to file, each on a new line
pattern: "*.txt"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: A BAM file with suffix_mergedReads.bam
pattern: "*_mergedReads.bam"
- filelist:
type: file
description: A file listing all reads that were filtered out in the merging process with suffix_ignoredReads.txt.gz
pattern: "*.txt.gz"
authors:
- "@merszym"

View file

@ -78,6 +78,10 @@ ataqv/ataqv:
- modules/ataqv/ataqv/** - modules/ataqv/ataqv/**
- tests/modules/ataqv/ataqv/** - tests/modules/ataqv/ataqv/**
atlas/splitmerge:
- modules/atlas/splitmerge/**
- tests/modules/atlas/splitmerge/**
bakta: bakta:
- modules/bakta/** - modules/bakta/**
- tests/modules/bakta/** - tests/modules/bakta/**

View file

@ -237,6 +237,8 @@ params {
test3_single_end_markduplicates_sorted_bam = "${test_data_dir}/genomics/homo_sapiens/illumina/bam/test3.single_end.markduplicates.sorted.bam" test3_single_end_markduplicates_sorted_bam = "${test_data_dir}/genomics/homo_sapiens/illumina/bam/test3.single_end.markduplicates.sorted.bam"
read_group_settings_txt = "${test_data_dir}/genomics/homo_sapiens/illumina/bam/read_group_settings.txt"
test_paired_end_sorted_cram = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram" test_paired_end_sorted_cram = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram"
test_paired_end_sorted_cram_crai = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai" test_paired_end_sorted_cram_crai = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai"
test_paired_end_markduplicates_sorted_cram = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.markduplicates.sorted.cram" test_paired_end_markduplicates_sorted_cram = "${test_data_dir}/genomics/homo_sapiens/illumina/cram/test.paired_end.markduplicates.sorted.cram"

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ATLAS_SPLITMERGE } from '../../../../modules/atlas/splitmerge/main.nf'
//MAIN
workflow test_atlas_splitmerge {
meta = [ id:'test', single_end:false ]
bam = file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)
bai = file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
settings = file(params.test_data['homo_sapiens']['illumina']['read_group_settings_txt'], checkIfExists: true)
ATLAS_SPLITMERGE ( [meta, bam, bai, settings, []] )
}

View file

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

View file

@ -0,0 +1,11 @@
- name: atlas splitmerge test_atlas_splitmerge
command: nextflow run tests/modules/atlas/splitmerge -entry test_atlas_splitmerge -c tests/config/nextflow.config
tags:
- atlas
- atlas/splitmerge
files:
- path: output/atlas/test.paired_end.sorted_ignoredReads.txt.gz
md5sum: 9b64c47313d2de89c26790f713707ee6
- path: output/atlas/test.paired_end.sorted_mergedReads.bam
- path: output/atlas/versions.yml
md5sum: 11735bec9c2f4b395b987fd00d4e4294