Feat seqtk update (#503)

* hifiasm copied from fastqc

* hifiasm tests init from fastqc

* meta.yml init; test.yml and main.nf for printing version

* Add hifiasm version printing

* Removed spaced on an empty line

* Reverted hifiasm from main

* hifiasm copied from fastqc

* hifiasm tests init from fastqc

* meta.yml init; test.yml and main.nf for printing version

* Add hifiasm version printing

* Removed spaced on an empty line

* Reverted hifiasm from main

* Added seqtk/subseq and checking for seed in seqtk/sample

* Separate authors in software/seqtk/sample/meta.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Align commans in output channesl software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Define prefix in software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Use prefix in output file name software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Define suffix in options in tests/software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Change output file name in tests/software/seqtk/subseq/test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Remove a to-do point from tests/software/seqtk/subseq/test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Added --no-name into gzip commands

* Update samtools from 1.10 to 1.12 (#530)

* feat: remove social preview image to use GitHub OpenGraph

* feat: update samtools from 1.10 to 1.12

* fix: CI tests

* fix: add meta.yml file for samtools/merge

* Update software/samtools/merge/meta.yml

Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com>

* Update software/samtools/merge/meta.yml

Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com>

* hifiasm copied from fastqc

* hifiasm tests init from fastqc

* meta.yml init; test.yml and main.nf for printing version

* Add hifiasm version printing

* Removed spaced on an empty line

* Reverted hifiasm from main

* Added seqtk/subseq and checking for seed in seqtk/sample

* hifiasm copied from fastqc

* hifiasm tests init from fastqc

* meta.yml init; test.yml and main.nf for printing version

* Add hifiasm version printing

* Removed spaced on an empty line

* Reverted hifiasm from main

* Separate authors in software/seqtk/sample/meta.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Align commans in output channesl software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Define prefix in software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Use prefix in output file name software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Define suffix in options in tests/software/seqtk/subseq/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Change output file name in tests/software/seqtk/subseq/test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Remove a to-do point from tests/software/seqtk/subseq/test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Added --no-name into gzip commands

* Replaced functions.nf in seqtk/subseq

* Refreshed tests for sample and subseq

* Corrected paired-end test and YAML description for sample

Co-authored-by: Sviatoslav Sidorov <sviatoslav.sidorov@crick.ac.uk>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
Co-authored-by: Maxime U. Garcia <max.u.garcia@gmail.com>
Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com>
This commit is contained in:
Svyatoslav Sidorov 2021-06-14 12:23:15 +01:00 committed by GitHub
parent d9e48b70ca
commit 01dc6a289d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 197 additions and 15 deletions

View file

@ -36,25 +36,28 @@ process SEQTK_SAMPLE {
$options.args \\
$reads \\
$sample_size \\
| gzip > ${prefix}.fastq.gz \\
| gzip --no-name > ${prefix}.fastq.gz \\
echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//' > ${software}.version.txt
"""
} else {
if (!(options.args ==~ /.*-s[0-9]+.*/)) {
options.args = options.args + " -s100"
}
"""
seqtk \\
sample \\
$options.args \\
$reads[0] \\
${reads[0]} \\
$sample_size \\
| gzip > ${prefix}_1.fastq.gz \\
| gzip --no-name > ${prefix}_1.fastq.gz \\
seqtk \\
sample \\
$options.args \\
$reads[1] \\
${reads[1]} \\
$sample_size \\
| gzip > ${prefix}_2.fastq.gz \\
| gzip --no-name > ${prefix}_2.fastq.gz \\
echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//' > ${software}.version.txt
"""

View file

@ -7,6 +7,7 @@ tools:
description: Seqtk is a fast and lightweight tool for processing sequences in the FASTA or FASTQ format. Seqtk sample command subsamples sequences.
homepage: https://github.com/lh3/seqtk
documentation: https://docs.csc.fi/apps/seqtk/
tool_dev_url: https://github.com/lh3/seqtk
licence: ['MIT']
input:
@ -19,6 +20,9 @@ input:
type: file
description: List of input FastQ files of size 1 and 2 for single-end and paired-end data,respectively.
pattern: "*.{fastq.gz}"
- sample_size:
type: value
description: Number of reads to sample.
output:
- meta:
@ -32,8 +36,9 @@ output:
pattern: "*.{version.txt}"
- reads:
type: file
description: Subsampled FastQ files of size 1 and 2 for single-end and paired-end data,respectively.
description: Subsampled FastQ files, 1 for single-end data or 2 for paired-end data.
pattern: "*.{fastq.gz}"
authors:
- "@kaurravneet4123"
- "@sidorov-si"

View file

@ -0,0 +1,68 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -0,0 +1,46 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
options = initOptions(params.options)
process SEQTK_SUBSEQ {
tag '$sequences'
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::seqtk=1.3" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/seqtk:1.3--h5bf99c6_3"
} else {
container "quay.io/biocontainers/seqtk:1.3--h5bf99c6_3"
}
input:
path sequences
path filter_list
output:
path "*.gz" , emit: sequences
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ?: ''
def ext = "fa"
if ("$sequences" ==~ /.+\.fq|.+\.fq.gz|.+\.fastq|.+\.fastq.gz/) {
ext = "fq"
}
"""
seqtk \\
subseq \\
$options.args \\
$sequences \\
$filter_list | \\
gzip --no-name > ${sequences}${prefix}.${ext}.gz
echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,34 @@
name: seqtk_subseq
description: Select only sequences that match the filtering condition
keywords:
- filtering,selection
tools:
- seqtk:
description: Seqtk is a fast and lightweight tool for processing sequences in the FASTA or FASTQ format
homepage: https://github.com/lh3/seqtk
documentation: https://docs.csc.fi/apps/seqtk/
tool_dev_url: https://github.com/lh3/seqtk
licence: ['MIT']
input:
- sequences:
type: file
description: FASTQ/FASTA file
pattern: "*.{fq,fq.gz,fa,fa.gz}"
- filter_list:
type: file
description: BED file or a text file with a list of sequence names
pattern: "*.{bed,lst}"
output:
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
- sequences:
type: file
description: FASTQ/FASTA file
pattern: "*.{fq.gz,fa.gz}"
authors:
- "@sidorov-si"

View file

@ -639,6 +639,10 @@ seqtk/sample:
- software/seqtk/sample/**
- tests/software/seqtk/sample/**
seqtk/subseq:
- software/seqtk/subseq/**
- tests/software/seqtk/subseq/**
sequenzautils/bam2seqz:
- software/sequenzautils/bam2seqz/**
- tests/software/sequenzautils/bam2seqz/**

View file

@ -12,7 +12,7 @@ workflow test_seqtk_sample_single_end {
input = [ [ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
SEQTK_SAMPLE ( input, 250000 )
SEQTK_SAMPLE ( input, 50 )
}
//
@ -25,5 +25,5 @@ workflow test_seqtk_sample_paired_end {
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
SEQTK_SAMPLE ( input, 250000 )
SEQTK_SAMPLE ( input, 50 )
}

View file

@ -1,19 +1,19 @@
- name: seqtk sample single-end
command: nextflow run ./tests/software/seqtk/sample -entry test_seqtk_sample_single_end -c tests/config/nextflow.config
- name: seqtk sample test_seqtk_sample_single_end
command: nextflow run tests/software/seqtk/sample -entry test_seqtk_sample_single_end -c tests/config/nextflow.config
tags:
- seqtk
- seqtk/sample
files:
- path: output/seqtk/test.sampled.fastq.gz
md5sum: 875863b402f67403dac63ef59b9c9a8a
md5sum: 73c3e8f113860244f3ed3866a8b9d555
- name: seqtk sample paired-end
command: nextflow run ./tests/software/seqtk/sample -entry test_seqtk_sample_paired_end -c tests/config/nextflow.config
- name: seqtk sample test_seqtk_sample_paired_end
command: nextflow run tests/software/seqtk/sample -entry test_seqtk_sample_paired_end -c tests/config/nextflow.config
tags:
- seqtk
- seqtk/sample
files:
- path: output/seqtk/test.sampled_1.fastq.gz
md5sum: 7029066c27ac6f5ef18d660d5741979a
md5sum: 73c3e8f113860244f3ed3866a8b9d555
- path: output/seqtk/test.sampled_2.fastq.gz
md5sum: 7029066c27ac6f5ef18d660d5741979a
md5sum: 75457ddceea3a5688d05438cdbffba24

View file

@ -0,0 +1,14 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SEQTK_SUBSEQ } from '../../../../software/seqtk/subseq/main.nf' addParams( options: ['suffix':'.filtered'] )
workflow test_seqtk_subseq {
sequences = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
filter_list = file(params.test_data['sarscov2']['genome']['test_bed_gz'], checkIfExists: true)
SEQTK_SUBSEQ ( sequences, filter_list )
}

View file

@ -0,0 +1,8 @@
- name: seqtk subseq test_seqtk_subseq
command: nextflow run tests/software/seqtk/subseq -entry test_seqtk_subseq -c tests/config/nextflow.config
tags:
- seqtk
- seqtk/subseq
files:
- path: output/seqtk/genome.fasta.filtered.fa.gz
md5sum: 488001c0fbedabf24d3e10fe7f96c78a