Added the samtools/dict module (#1922)

* Added the samtools/dict module

* samtools/dict is single-threaded
This commit is contained in:
Matthieu Muffato 2022-07-26 22:13:19 +01:00 committed by GitHub
parent ce06694af8
commit 31409f5e72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,44 @@
process SAMTOOLS_DICT {
tag "$fasta"
label 'process_single'
conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' :
'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }"
input:
tuple val(meta), path(fasta)
output:
tuple val(meta), path ("*.dict"), emit: dict
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
"""
samtools \\
dict \\
$args \\
$fasta \\
> ${fasta}.dict
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
stub:
"""
touch ${fasta}.dict
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,41 @@
name: samtools_dict
description: Create a sequence dictionary file from a FASTA file
keywords:
- dict
- fasta
tools:
- samtools:
description: |
SAMtools is a set of utilities for interacting with and post-processing
short DNA sequence read alignments in the SAM, BAM and CRAM formats, written by Heng Li.
These files are generated as output by short read aligners like BWA.
homepage: http://www.htslib.org/
documentation: http://www.htslib.org/doc/samtools.html
doi: 10.1093/bioinformatics/btp352
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: FASTA file
pattern: "*.{fa,fasta}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- dict:
type: file
description: FASTA dictionary file
pattern: "*.{dict}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@muffato"

View file

@ -1919,6 +1919,10 @@ samtools/depth:
- modules/samtools/depth/** - modules/samtools/depth/**
- tests/modules/samtools/depth/** - tests/modules/samtools/depth/**
samtools/dict:
- modules/samtools/dict/**
- tests/modules/samtools/dict/**
samtools/faidx: samtools/faidx:
- modules/samtools/faidx/** - modules/samtools/faidx/**
- tests/modules/samtools/faidx/** - tests/modules/samtools/faidx/**

View file

@ -0,0 +1,13 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SAMTOOLS_DICT } from '../../../../modules/samtools/dict/main.nf'
workflow test_samtools_dict {
input = [ [ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ]
SAMTOOLS_DICT ( input )
}

View file

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

View file

@ -0,0 +1,13 @@
- name: samtools dict test_samtools_dict
command: nextflow run tests/modules/samtools/dict -entry test_samtools_dict -c tests/config/nextflow.config -c tests/modules/samtools/dict/nextflow.config
tags:
- samtools
- samtools/dict
files:
- path: output/samtools/genome.fasta.dict
contains:
- "SN:MT192765.1"
- "LN:29829"
- "M5:c95f3e5592d0ad9974e41e7f0ea14eb0"
- path: output/samtools/versions.yml
md5sum: 12cd0c5ce466eefb2dff72625ecbe5c2