Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions modules/nf-core/quilt/quilt/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ process QUILT_QUILT {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
def extensions = bams.collect { it.extension }
def extensions = bams.collect { path -> path.extension }
def extension = extensions.flatten().unique()
def list_command = extension == ["bam"] ? "--bamlist=" :
extension == ["cram"] ? "--reference=${fasta} --cramlist=" : ""
def genetic_map_command = genetic_map ? "--genetic_map_file=${genetic_map}" : ""
def posfile_command = posfile ? "--posfile=${posfile}" : ""
def phasefile_command = phasefile ? "--phasefile=${phasefile}" : ""
def samplename_command = samplename ? "--sampleNames_file=${samplename}" : ""
def start_command = regions_start ? "--regionStart=$regions_start" : ""
def end_command = regions_end ? "--regionEnd=$regions_end" : ""
def buffer_command = buffer ? "--buffer=$buffer" : ""

if (!(args ==~ /.*--seed.*/)) {args += " --seed=1"}

Expand All @@ -52,10 +55,10 @@ process QUILT_QUILT {
$phasefile_command \\
$samplename_command \\
--chr=$chr \\
--regionStart=$regions_start \\
--regionEnd=$regions_end \\
$start_command \\
$end_command \\
$buffer_command \\
--nGen=$ngen \\
--buffer=$buffer \\
--nCores=$task.cpus \\
--outputdir="." \\
--reference_haplotype_file=$reference_haplotype_file \\
Expand Down
75 changes: 34 additions & 41 deletions modules/nf-core/quilt/quilt/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ nextflow_process {

config "./nextflow.config"

test("QUILT") {
test("homo_sapiens - bam, hap, legend, posfile, phasefile, map - fasta") {
setup {
run("BCFTOOLS_QUERY") {
script "../../../bcftools/query/main.nf"
process {
"""
input[0] = [
[id: 'NA12878'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi', checkIfExists: true)
]
input[1] = []
input[2] = []
Expand All @@ -42,44 +42,31 @@ nextflow_process {
"""
}
}

run("GAWK", alias: "GAWK_POSFILE") {
script "../../../gawk/main.nf"
process {
"""
program = Channel.of('BEGIN{OFS=\"\\t\"} NR>1 {split(\$1, a, \"[:-_]\"); print a[1],\$2,\$3,\$4}').collectFile(name: 'program.txt', newLine: true)
input[0] = [
[id: 'NA12878'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.legend.gz', checkIfExists: true)
]
input[1] = program
input[2] = false
"""
}
}
}

when {
params{
quilt_args = "--save_prepared_reference=TRUE --make_plots=TRUE --seed=1"
bcftools_query_args = "-f '[%GT]\\n'"
bcftools_query_suffix = "genfile.txt"
gawk_posfile_suffix = "posfile.txt"
gawk_name_suffix = "genfile.name.txt"
bcftools_query_args = "-f '[%GT]\\n' -r chr22"
bcftools_query_suffix = "phasefile.txt"
gawk_name_suffix = "phasefile.name.txt"
}
process {
"""
input[0] = Channel.of([
[ id:'NA12878', chr:'chr22' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists: true),
[], [],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.hap.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.legend.gz', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.legend.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExists: true),
])
.combine(GAWK_POSFILE.out.output.map{ it[1] })
.combine(GAWK_NAME.out.output.map{ it[1] })
.combine(Channel.of([[], "chr22", "16570000", "16610000", "100", "10000", []]))
.combine(channel.of([
[], "chr22", "16570000", "16610000", "100", "10000",
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.stitch.map", checkIfExist:true)
]))
input[1] = [
[id: 'GRCh38'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
Expand All @@ -96,13 +83,15 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.vcf,
process.out.tbi,
list.sort(),
process.out.rdata,
process.out.versions,
process.out.vcf.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() },
process.out.vcf.collect{ path(it[1]).vcf.variantsMD5 }
process.out.vcf.collect{ meta, vcf -> [
meta,
path(vcf).vcf.header.getGenotypeSamples().sort(),
path(vcf).vcf.variantsMD5
]}
).match() }
)
}
Expand Down Expand Up @@ -156,8 +145,8 @@ nextflow_process {
"""
input[0] = [
[ id:'test', chr:'chr22' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists: true),
[], [],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.hap.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.legend.gz', checkIfExists: true),
Expand All @@ -174,12 +163,14 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.vcf,
process.out.tbi,
process.out.rdata,
process.out.versions,
process.out.vcf.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() },
process.out.vcf.collect{ path(it[1]).vcf.variantsMD5 }
process.out.vcf.collect{ meta, vcf -> [
meta,
path(vcf).vcf.header.getGenotypeSamples().sort(),
path(vcf).vcf.variantsMD5
]}
).match() }
)
}
Expand All @@ -193,7 +184,7 @@ nextflow_process {
process {
"""
bamlist = Channel.of(
"NA12878.chr22.1X.bam",
"NA12878.chr21_22.1X.bam",
).collectFile(name : 'bamlist.txt', newLine : true)

bamnames = Channel.of(
Expand All @@ -202,8 +193,8 @@ nextflow_process {

ch_input = Channel.of([
[ id:'test', chr:'chr20' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists: true)
])
.combine(bamlist)
.combine(bamnames)
Expand All @@ -225,12 +216,14 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.vcf,
process.out.tbi,
process.out.rdata,
process.out.versions,
process.out.vcf.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() },
process.out.vcf.collect{ path(it[1]).vcf.variantsMD5 }
process.out.vcf.collect{ meta, vcf -> [
meta,
path(vcf).vcf.header.getGenotypeSamples().sort(),
path(vcf).vcf.variantsMD5
]}
).match() }
)
}
Expand Down
Loading
Loading