New Module: endorspy (#1916)

* added module endorspy and test

* added endorspy

* Fixed spaces and remove unnecessary lines from test

* added extra new line to test.yml

* added a prefix to to avoid name collision

* Update modules/endorspy/main.nf

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Update modules/endorspy/meta.yml

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

* Apply suggestions from code review

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

* Apply suggestions from code review

* Update modules/endorspy/main.nf

* Apply suggestions from code review

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Aida Andrades Valtueña 2022-09-28 11:28:11 +02:00 committed by GitHub
parent ee5f59705f
commit 0bdd589163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 145 additions and 0 deletions

38
modules/endorspy/main.nf Normal file
View file

@ -0,0 +1,38 @@
process ENDORSPY {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::endorspy=0.4" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/endorspy:0.4--hdfd78af_0':
'quay.io/biocontainers/endorspy:0.4--hdfd78af_0' }"
input:
tuple val(meta), path(stats), path(stats_optional)
output:
tuple val(meta), path("*_mqc.json"), emit: json
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 optionalstats = stats_optional ? "statsOptional=${stats_optional}" : ''
"""
endorspy \\
$stats \\
$optionalstats \\
$args \\
-o json \\
-n $prefix
cat <<-END_VERSIONS > versions.yml
"${task.process}":
endorspy: \$(echo \$(endorspy --version 2>&1) | sed 's/^endorS.py //' )
END_VERSIONS
"""
}

48
modules/endorspy/meta.yml Normal file
View file

@ -0,0 +1,48 @@
name: "endorspy"
description: endorS.py calculates endogenous DNA from samtools flagstat files and print to screen
keywords:
- endogenous DNA
- ancient DNA
- percent on target
- statistics
tools:
- "endorspy":
description: "endorS.py calculates endogenous DNA from samtools flagstat files and print to screen"
homepage: "https://github.com/aidaanva/endorS.py"
documentation: "https://github.com/aidaanva/endorS.py"
tool_dev_url: "https://github.com/aidaanva/endorS.py"
doi: "10.7717/peerj.10947"
licence: "['GPL v3']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- stats:
type: file
description: output of samtools flagstat in a text file
- stats_optional:
type: file
description: output of a second samtools flagstat run in a text file. If two files are supplied,
the mapped reads of the second file is divided by the total reads in the first, since it
assumes that the <samplefile.stats> are related to the same sample. Useful after BAM filtering.
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"
- json:
type: file
description: file with the endogenous DNA calculation tailored for multiQC
pattern: "*_mqc.json"
authors:
- "@aidaanva"

View file

@ -727,6 +727,10 @@ emmtyper:
- modules/emmtyper/**
- tests/modules/emmtyper/**
endorspy:
- modules/endorspy/**
- tests/modules/endorspy/**
ensemblvep:
- modules/ensemblvep/**
- tests/modules/ensemblvep/**

View file

@ -0,0 +1,36 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ENDORSPY } from '../../../modules/endorspy/main.nf'
include { SAMTOOLS_FLAGSTAT } from '../../../modules/samtools/flagstat/main.nf'
include { SAMTOOLS_FLAGSTAT as SAMTOOLS_FLAGSTAT2 } from '../../../modules/samtools/flagstat/main.nf'
include { SAMTOOLS_VIEW } from '../../../modules/samtools/view/main.nf'
include { SAMTOOLS_INDEX } from '../../../modules/samtools/index/main.nf'
workflow test_endorspy {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
]
SAMTOOLS_FLAGSTAT ( input )
SAMTOOLS_VIEW ( input, [] )
SAMTOOLS_INDEX ( SAMTOOLS_VIEW.out.bam )
input2 = SAMTOOLS_VIEW.out.bam
.mix(SAMTOOLS_INDEX.out.bai)
.groupTuple(by:0)
.map{
def meta = it[0]
def bam = it[1][0]
def bai = it[1][1]
[meta, bam, bai]
}
SAMTOOLS_FLAGSTAT2 ( input2 )
ch_input_flagstat = SAMTOOLS_FLAGSTAT.out.flagstat.join(SAMTOOLS_FLAGSTAT2.out.flagstat)
ENDORSPY ( ch_input_flagstat )
}

View file

@ -0,0 +1,12 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName:SAMTOOLS_VIEW {
ext.args = "-q 30 -b"
}
withName:SAMTOOLS_FLAGSTAT2 {
ext.prefix = "test.filtered"
}
}

View file

@ -0,0 +1,7 @@
- name: endorspy test_endorspy
command: nextflow run ./tests/modules/endorspy -entry test_endorspy -c ./tests/config/nextflow.config -c ./tests/modules/endorspy/nextflow.config
tags:
- endorspy
files:
- path: output/endorspy/test_endogenous_dna_mqc.json
md5sum: fe7bea111d966db321dcde7fbfb062b1