added sha256sum

This commit is contained in:
Matthias De Smet 2022-05-06 10:28:14 +02:00
parent 853b623969
commit 09e729ad41
6 changed files with 107 additions and 0 deletions

35
modules/shasum/main.nf Normal file
View file

@ -0,0 +1,35 @@
process SHASUM {
tag "$meta.id"
label 'process_low'
if (params.enable_conda) {
exit 1, "Conda environments cannot be used when using bcl-convert. Please use docker or singularity containers."
}
container "debian:bullseye-slim"
input:
tuple val(meta), path(file)
output:
tuple val(meta), path("*.sha256"), emit: checksum
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}"
"""
sha256sum \\
$args \\
${file} \\
> ${file}.sha256
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sha256sum: \$(echo \$(sha256sum --version 2>&1 | head -n 1| sed 's/^.*) //;' ))
END_VERSIONS
"""
}

40
modules/shasum/meta.yml Normal file
View file

@ -0,0 +1,40 @@
name: "shasum"
description: Print SHA256 (256-bit) checksums.
keywords:
- checksum
- sha256
tools:
- "md5sum":
description: Create an SHA256 (256-bit) checksum.
homepage: "https://www.gnu.org"
documentation: "https://linux.die.net/man/1/shasum"
licence: GPLv3+
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- file:
type: file
description: Any file
pattern: "*.*"
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"
- checksum:
type: file
description: File containing checksum
pattern: "*.sha256"
authors:
- "@matthdsm"

View file

@ -1739,6 +1739,10 @@ seqwish/induce:
- modules/seqwish/induce/**
- tests/modules/seqwish/induce/**
shasum:
- modules/shasum/**
- tests/modules/shasum/**
shigatyper:
- modules/shigatyper/**
- tests/modules/shigatyper/**

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SHASUM } from '../../../modules/shasum/main.nf'
workflow test_shasum {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
SHASUM ( input )
}

View file

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

View file

@ -0,0 +1,8 @@
- name: shasum test_shasum
command: nextflow run tests/modules/shasum -entry test_shasum -c tests/config/nextflow.config
tags:
- shasum
files:
- path: output/shasum/test.paired_end.bam.sha256
md5sum: 138a19e100f09fc975ea1b717da9b6dd
- path: output/shasum/versions.yml