new tool snap-aligner/index (#1506)

* add snapaligner/index

* output fixes

* fix outputs

* fix tests

* update inputs

* fix more bugs

* fix linting

* Update modules/snapaligner/index/main.nf

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

* Update modules/snapaligner/index/main.nf

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

* fix comments

* fix indents

* fix escaping

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Matthias De Smet 2022-04-08 14:41:08 +02:00 committed by GitHub
parent 9ae34a01d1
commit f57f085912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,59 @@
process SNAPALIGNER_INDEX {
tag '$fasta'
label 'process_high'
conda (params.enable_conda ? "bioconda::snap-aligner=2.0.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/snap-aligner:2.0.1--hd03093a_1':
'quay.io/biocontainers/snap-aligner:2.0.1--hd03093a_1' }"
input:
path fasta
path altcontigfile
path nonaltcontigfile
path altliftoverfile
output:
path "snap/*" ,emit: index
path "versions.yml" ,emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def altcontigfile_arg = altcontigfile ? '-altContigFile ' + altcontigfile : ''
def nonaltcontigfile_arg = nonaltcontigfile ? '-nonAltContigFile ' + nonaltcontigfile : ''
def altliftoverfile_arg = altliftoverfile ? '-altLiftoverFile ' + altliftoverfile : ''
"""
mkdir snap
snap-aligner \\
index \\
$fasta \\
snap \\
-t${task.cpus} \\
$altcontigfile_arg \\
$nonaltcontigfile_arg \\
$altliftoverfile_arg \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
snapaligner: \$(snap-aligner 2>&1| head -n 1 | sed 's/^.*version //')
END_VERSIONS
"""
stub:
"""
mkdir snap
echo "Genome" > snap/Genome
echo "GenomeIndex" > snap/GenomeIndex
echo "GenomeIndexHash" > snap/GenomeIndexHash
echo "OverflowTable" > snap/OverflowTable
cat <<-END_VERSIONS > versions.yml
"${task.process}":
snapaligner: \$(snap-aligner 2>&1| head -n 1 | sed 's/^.*version //;s/\.\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,39 @@
name: "snapaligner_index"
description: Create a SNAP index for reference genome
keywords:
- index
- fasta
- genome
- reference
tools:
- "snapaligner":
description: "Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data"
homepage: "http://snap.cs.berkeley.edu"
documentation: "https://1drv.ms/b/s!AhuEg_0yZD86hcpblUt-muHKYsG8fA?e=R8ogug"
tool_dev_url: "https://github.com/amplab/snap"
doi: "10.1101/2021.11.23.469039"
licence: "['Apache v2']"
input:
- fasta:
type: file
description: Input genome fasta file
- altcontigfile:
type: file
description: Optional file with a list of alt contig names, one per line.
- nonaltcontigfile:
type: file
description: Optional file that contains a list of contigs (one per line) that will not be marked ALT regardless of size.
- altliftoverfile:
type: file
description: Optional file containing ALT-to-REF mappings (SAM format). e.g., hs38DH.fa.alt from bwa-kit.
output:
- index:
type: file
description: SNAP genome index files
pattern: "{Genome,GenomeIndex,GenomeIndexHash,OverflowTable}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@matthdsm"

View file

@ -1663,6 +1663,10 @@ sistr:
- modules/sistr/** - modules/sistr/**
- tests/modules/sistr/** - tests/modules/sistr/**
snapaligner/index:
- modules/snapaligner/index/**
- tests/modules/snapaligner/index/**
snpdists: snpdists:
- modules/snpdists/** - modules/snpdists/**
- tests/modules/snpdists/** - tests/modules/snpdists/**

View file

@ -0,0 +1,9 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SNAPALIGNER_INDEX } from '../../../../modules/snapaligner/index/main.nf'
workflow test_snapaligner_index {
SNAPALIGNER_INDEX ( file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),[],[],[])
}

View file

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

View file

@ -0,0 +1,13 @@
- name: snapaligner index test_snapaligner_index
command: nextflow run tests/modules/snapaligner/index -entry test_snapaligner_index -c tests/config/nextflow.config
tags:
- snapaligner/index
- snapaligner
files:
- path: output/snapaligner/snap/Genome
md5sum: 7e189c954142ba37460332b467e34ed4
- path: output/snapaligner/snap/GenomeIndex
md5sum: 298da8bcb1134f7b24379a792a7a46f8
- path: output/snapaligner/snap/GenomeIndexHash
- path: output/snapaligner/snap/OverflowTable
- path: output/snapaligner/versions.yml