mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-14 05:43:08 +00:00
new module: samtools/getrg (#2123)
* new module: samtools/getrg * add output file to stub * add missing config * Intentionally break prettier linting * [automated] Fix linting with Prettier Co-authored-by: Phil Ewels <phil@seqera.io> Co-authored-by: nf-core-bot <core@nf-co.re>
This commit is contained in:
parent
33d9ce79c1
commit
b5aa12ad3b
6 changed files with 122 additions and 0 deletions
47
modules/samtools/getrg/main.nf
Normal file
47
modules/samtools/getrg/main.nf
Normal file
|
@ -0,0 +1,47 @@
|
|||
process SAMTOOLS_GETRG {
|
||||
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), file("readgroups.txt"), emit: readgroup
|
||||
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}"
|
||||
"""
|
||||
samtools \\
|
||||
view \\
|
||||
-H \\
|
||||
$args \\
|
||||
$input \\
|
||||
| grep '^@RG' > readgroups.txt
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
|
||||
stub:
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
|
||||
echo -e "@RG\\tID:${prefix}\\tSM:${prefix}\\tPL:ILLUMINA" > readgroups.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
43
modules/samtools/getrg/meta.yml
Normal file
43
modules/samtools/getrg/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: samtools_getrg
|
||||
description: filter/convert SAM/BAM/CRAM file
|
||||
keywords:
|
||||
- view
|
||||
- bam
|
||||
- sam
|
||||
- cram
|
||||
- readgroup
|
||||
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: hhttp://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 ]
|
||||
- input:
|
||||
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 ]
|
||||
- readgroup:
|
||||
type: stdout
|
||||
description: File containing readgroup string(s)
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@matthdsm"
|
|
@ -2115,6 +2115,10 @@ samtools/flagstat:
|
|||
- modules/samtools/flagstat/**
|
||||
- tests/modules/samtools/flagstat/**
|
||||
|
||||
samtools/getrg:
|
||||
- modules/samtools/getrg/**
|
||||
- tests/modules/samtools/getrg/**
|
||||
|
||||
samtools/idxstats:
|
||||
- modules/samtools/idxstats/**
|
||||
- tests/modules/samtools/idxstats/**
|
||||
|
|
15
tests/modules/samtools/getrg/main.nf
Normal file
15
tests/modules/samtools/getrg/main.nf
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { SAMTOOLS_GETRG } from '../../../../modules/samtools/getrg/main.nf'
|
||||
|
||||
workflow test_samtools_getrg {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
|
||||
]
|
||||
|
||||
SAMTOOLS_GETRG ( input )
|
||||
}
|
5
tests/modules/samtools/getrg/nextflow.config
Normal file
5
tests/modules/samtools/getrg/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
process {
|
||||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
8
tests/modules/samtools/getrg/test.yml
Normal file
8
tests/modules/samtools/getrg/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: samtools getrg test_samtools_getrg
|
||||
command: nextflow run ./tests/modules/samtools/getrg -entry test_samtools_getrg -c ./tests/config/nextflow.config -c ./tests/modules/samtools/getrg/nextflow.config
|
||||
tags:
|
||||
- samtools/getrg
|
||||
- samtools
|
||||
files:
|
||||
- path: output/samtools/readgroups.txt
|
||||
md5sum: 7b1d2d10a82a0c4fa6b22673559e41f6
|
Loading…
Reference in a new issue