mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-21 10:48:18 +00:00
samtools fasta module (#2128)
This commit is contained in:
parent
b3e322064e
commit
504028346b
6 changed files with 117 additions and 0 deletions
37
modules/samtools/fasta/main.nf
Normal file
37
modules/samtools/fasta/main.nf
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
process SAMTOOLS_FASTA {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
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(input)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.fasta.gz"), emit: fasta
|
||||||
|
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}"
|
||||||
|
def endedness = meta.single_end ? "-0 ${prefix}.fasta.gz" : "-1 ${prefix}_1.fasta.gz -2 ${prefix}_2.fasta.gz"
|
||||||
|
"""
|
||||||
|
samtools \\
|
||||||
|
fasta \\
|
||||||
|
$args \\
|
||||||
|
--threads ${task.cpus-1} \\
|
||||||
|
$endedness \\
|
||||||
|
$input
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
46
modules/samtools/fasta/meta.yml
Normal file
46
modules/samtools/fasta/meta.yml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: "samtools_fasta"
|
||||||
|
description: Converts a SAM/BAM/CRAM file to FASTA
|
||||||
|
keywords:
|
||||||
|
- bam
|
||||||
|
- sam
|
||||||
|
- cram
|
||||||
|
- fasta
|
||||||
|
tools:
|
||||||
|
- "samtools":
|
||||||
|
description: "Tools for dealing with SAM, BAM and CRAM files"
|
||||||
|
homepage: "http://www.htslib.org"
|
||||||
|
documentation: "https://www.htslib.org/doc/samtools-fasta.html"
|
||||||
|
tool_dev_url: "https://github.com/samtools/samtools"
|
||||||
|
doi: "10.1093/bioinformatics/btp352"
|
||||||
|
licence: "['MIT']"
|
||||||
|
|
||||||
|
input:
|
||||||
|
# Only when we have meta
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- input:
|
||||||
|
type: file
|
||||||
|
description: BAM/CRAM/SAM file
|
||||||
|
pattern: "*.{bam,cram,sam}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
#Only when we have meta
|
||||||
|
- 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"
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: compressed FASTA file
|
||||||
|
pattern: "*.fasta.gz"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@priyanka-surana"
|
|
@ -2103,6 +2103,10 @@ samtools/faidx:
|
||||||
- modules/samtools/faidx/**
|
- modules/samtools/faidx/**
|
||||||
- tests/modules/samtools/faidx/**
|
- tests/modules/samtools/faidx/**
|
||||||
|
|
||||||
|
samtools/fasta:
|
||||||
|
- modules/samtools/fasta/**
|
||||||
|
- tests/modules/samtools/fasta/**
|
||||||
|
|
||||||
samtools/fastq:
|
samtools/fastq:
|
||||||
- modules/samtools/fastq/**
|
- modules/samtools/fastq/**
|
||||||
- tests/modules/samtools/fastq/**
|
- tests/modules/samtools/fastq/**
|
||||||
|
|
15
tests/modules/samtools/fasta/main.nf
Normal file
15
tests/modules/samtools/fasta/main.nf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { SAMTOOLS_FASTA } from '../../../../modules/samtools/fasta/main.nf'
|
||||||
|
|
||||||
|
workflow test_samtools_fasta {
|
||||||
|
|
||||||
|
input = [
|
||||||
|
[ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
SAMTOOLS_FASTA ( input )
|
||||||
|
}
|
5
tests/modules/samtools/fasta/nextflow.config
Normal file
5
tests/modules/samtools/fasta/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
process {
|
||||||
|
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
|
||||||
|
}
|
10
tests/modules/samtools/fasta/test.yml
Normal file
10
tests/modules/samtools/fasta/test.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
- name: samtools fasta test_samtools_fasta
|
||||||
|
command: nextflow run ./tests/modules/samtools/fasta -entry test_samtools_fasta -c ./tests/config/nextflow.config -c ./tests/modules/samtools/fasta/nextflow.config
|
||||||
|
tags:
|
||||||
|
- samtools
|
||||||
|
- samtools/fasta
|
||||||
|
files:
|
||||||
|
- path: output/samtools/test_1.fasta.gz
|
||||||
|
md5sum: 3abd682290bc7c75f1ce2b80db995237
|
||||||
|
- path: output/samtools/test_2.fasta.gz
|
||||||
|
md5sum: 6ada09ce66f68b8732985e14aac1bf1f
|
Loading…
Reference in a new issue