Adding bcftools_isec taking a path with several vcfs and its tests

This commit is contained in:
JoseEspinosa 2021-02-02 10:50:45 +01:00
parent 8e4764b8ed
commit 3a40ec5664
5 changed files with 122 additions and 9 deletions

44
.github/workflows/bcftools_isec.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: bcftools_isec
on:
push:
paths:
- software/bcftools/bgzip/**
- software/bcftools/tabix/**
- software/bcftools/isec/**
- .github/workflows/bcftools_isec.yml
- tests/software/bcftools/**
pull_request:
paths:
- software/bcftools/bgzip/**
- software/bcftools/tabix/**
- software/bcftools/isec/**
- .github/workflows/bcftools_tabix.yml
- tests/software/bcftools/**
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag bcftools_isec --symlink --wt 2

View file

@ -4,7 +4,7 @@ include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process BCFTOOLS_STATS { process BCFTOOLS_ISEC {
tag "$meta.id" tag "$meta.id"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
@ -18,17 +18,20 @@ process BCFTOOLS_STATS {
} }
input: input:
tuple val(meta), path(vcf) tuple val(meta), path('vcfs/*')
output: output:
tuple val(meta), path("*.txt"), emit: stats tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
bcftools stats $options.args $vcf > ${prefix}.bcftools_stats.txt bcftools isec \\
$options.args \\
-p $prefix \\
*/*.vcf.gz
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
""" """
} }

View file

@ -41,9 +41,10 @@ input:
Groovy Map containing sample information Groovy Map containing sample information
e.g. [ id:'test', single_end:false ] e.g. [ id:'test', single_end:false ]
- vcf: - vcf:
type: file type: files
description: VCF input file description: |
pattern: "*.{vcf}" List containing 2 or more vcf files and their respective index (tbi files)
e.g. [ 'file1.vcf', 'file1.vcf.tbi', 'file2.vcf', 'file2.vcf.tbi' ]
output: output:
- meta: - meta:
type: map type: map

View file

@ -8,6 +8,11 @@ include { BCFTOOLS_STATS } from '../../../software/bcftools/stats/main.nf' addPa
include { BCFTOOLS_BGZIP } from '../../../software/bcftools/bgzip/main.nf' addParams( options: [:] ) include { BCFTOOLS_BGZIP } from '../../../software/bcftools/bgzip/main.nf' addParams( options: [:] )
include { BCFTOOLS_TABIX } from '../../../software/bcftools/tabix/main.nf' addParams( options: [:] ) include { BCFTOOLS_TABIX } from '../../../software/bcftools/tabix/main.nf' addParams( options: [:] )
include { BCFTOOLS_CONSENSUS } from '../../../software/bcftools/consensus/main.nf' addParams( options: [:] ) include { BCFTOOLS_CONSENSUS } from '../../../software/bcftools/consensus/main.nf' addParams( options: [:] )
include { BCFTOOLS_ISEC } from '../../../software/bcftools/isec/main.nf' addParams( options: ['args': '--nfiles +2 --output-type z'] )
include { BCFTOOLS_BGZIP as BCFTOOLS_BGZIP2 } from '../../../software/bcftools/bgzip/main.nf' addParams( options: [:] )
include { BCFTOOLS_TABIX as BCFTOOLS_TABIX2 } from '../../../software/bcftools/tabix/main.nf' addParams( options: [:] )
include { BCFTOOLS_BGZIP as BCFTOOLS_BGZIP3 } from '../../../software/bcftools/bgzip/main.nf' addParams( options: [:] )
include { BCFTOOLS_TABIX as BCFTOOLS_TABIX3 } from '../../../software/bcftools/tabix/main.nf' addParams( options: [:] )
workflow test_bcftools_filter { workflow test_bcftools_filter {
@ -62,4 +67,31 @@ workflow test_bcftools_consensus {
.join( fasta, by: [0] ) ) .join( fasta, by: [0] ) )
} }
workflow test_bcftools_isec {
def input = []
input1 = [ [ id:'test1' ], // meta map
file("${launchDir}/tests/data/vcf/test.vcf", checkIfExists: true) ]
input2 = [ [ id:'test2' ], // meta map
file("${launchDir}/tests/data/vcf/test.vcf", checkIfExists: true) ]
input3 = [ [ id:'test3' ], // meta map
file("${launchDir}/tests/data/vcf/test.vcf", checkIfExists: true) ]
BCFTOOLS_BGZIP ( input1 )
BCFTOOLS_TABIX ( BCFTOOLS_BGZIP.out.vcf )
BCFTOOLS_BGZIP2 ( input2 )
BCFTOOLS_TABIX2 ( BCFTOOLS_BGZIP2.out.vcf )
BCFTOOLS_BGZIP3 ( input3 )
BCFTOOLS_TABIX3 ( BCFTOOLS_BGZIP3.out.vcf )
BCFTOOLS_ISEC ( BCFTOOLS_BGZIP.out.vcf
.mix( BCFTOOLS_TABIX.out.tbi )
.mix( BCFTOOLS_BGZIP2.out.vcf )
.mix( BCFTOOLS_TABIX2.out.tbi )
.mix( BCFTOOLS_BGZIP3.out.vcf )
.mix( BCFTOOLS_TABIX3.out.tbi)
.map { [ it[1] ]}
.collect()
.map { [ [id: 'test'], it ] } )
}

View file

@ -46,3 +46,36 @@
md5sum: 06d52177f819730dd409157914534e8d md5sum: 06d52177f819730dd409157914534e8d
- path: output/bcftools/test.fa - path: output/bcftools/test.fa
md5sum: c9e7ac4537756a0b33bcf17117f9a065 md5sum: c9e7ac4537756a0b33bcf17117f9a065
- name: Run bcftools isec test workflow
command: nextflow run ./tests/software/bcftools/ -profile docker -entry test_bcftools_isec -c tests/config/nextflow.config
tags:
- bcftools
- bcftools_isec
files:
- path: output/bcftools/test1.vcf.gz
md5sum: eb75ae1f08a1884f8edc59ed423471a2
- path: output/bcftools/test1.vcf.gz.tbi
md5sum: 06d52177f819730dd409157914534e8d
- path: output/bcftools/test2.vcf.gz
md5sum: eb75ae1f08a1884f8edc59ed423471a2
- path: output/bcftools/test2.vcf.gz.tbi
md5sum: 06d52177f819730dd409157914534e8d
- path: output/bcftools/test3.vcf.gz
md5sum: eb75ae1f08a1884f8edc59ed423471a2
- path: output/bcftools/test/0000.vcf.gz
md5sum: 20bd741594f456c48e1928f07f0be342
- path: output/bcftools/test/0000.vcf.gz.tbi
md5sum: d4357a62c60df6abcb5cc806b4681dff
- path: output/bcftools/test/0001.vcf.gz
md5sum: 20bd741594f456c48e1928f07f0be342
- path: output/bcftools/test/0001.vcf.gz.tbi
md5sum: d4357a62c60df6abcb5cc806b4681dff
- path: output/bcftools/test/0002.vcf.gz
md5sum: 20bd741594f456c48e1928f07f0be342
- path: output/bcftools/test/0002.vcf.gz.tbi
md5sum: d4357a62c60df6abcb5cc806b4681dff
- path: md5 output/bcftools/test/README.txt
md5sum: 9a3a041e63a18e0ad41abab96e2c5f73
- path: md5 output/bcftools/test/sites.txt
md5sum: 01bb949ed7825ecf692bf0640e363647