Skip to content

Commit 594c40a

Browse files
authored
Fix meta imputation output (#7)
1 parent c4c85c8 commit 594c40a

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

‎modules/local/compression/compression_encryption_vcf.nf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ process COMPRESSION_ENCRYPTION_VCF {
1818
def info_joined = ArrayUtil.sort(imputed_info)
1919
def prefix = "chr${chr}"
2020
def imputed_name = "${prefix}.dose.vcf.gz"
21-
def meta_name = "${prefix}_empiricalDose.vcf.gz"
21+
def meta_name = "${prefix}.empiricalDose.vcf.gz"
2222
def zip_name = "chr_${chr}.zip"
2323
def info_name = "${prefix}.info"
2424
def aes = params.encryption.aes ? "-mem=AES256" : ""

‎tests/main.nf.test‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,51 @@ nextflow_pipeline {
6666
}
6767

6868
}
69-
69+
7070
test("Should run with phased data") {
7171

7272
when {
7373
params {
74-
project = "test-job"
74+
project = "testPipelineWithPhased"
75+
build = "hg19"
76+
files = "$projectDir/tests/input/chr20-phased/*.vcf.gz"
77+
population = "eur"
78+
password = PASSWORD
79+
refpanel_yaml = "$projectDir/tests/data/refpanels/hapmap2-chr20/cloudgene.yaml"
80+
output = "${outputDir}"
81+
phasing = "no_phasing"
82+
}
83+
}
84+
85+
then {
86+
assert workflow.success
87+
88+
def quality_control_log = file("${outputDir}/cloudgene.report.json")
89+
assert quality_control_log.exists()
90+
assert quality_control_log.text.contains("Remaining sites in total: 7,735")
91+
92+
def imputed_chr_20 = file("${outputDir}/chr_20.zip");
93+
assert imputed_chr_20.exists()
94+
ZipFile zipFile = new ZipFile(imputed_chr_20, PASSWORD.toCharArray());
95+
zipFile.extractAll("${outputDir}");
96+
def file = path("${outputDir}/chr20.dose.vcf.gz").vcf
97+
assert file.getChromosome() == "20"
98+
assert file.getNoSamples() == 51;
99+
assert file.isPhased()
100+
assert file.getNoSnps() == TOTAL_REFPANEL_CHR20_B37 + ONLY_IN_INPUT
101+
102+
//check correct number of snps in info.gz file
103+
assert path("${outputDir}/chr20.info.gz").linesGzip.size() == 1 + TOTAL_REFPANEL_CHR20_B37 + ONLY_IN_INPUT
104+
105+
}
106+
107+
}
108+
109+
test("Should run with phased data and meta option") {
110+
111+
when {
112+
params {
113+
project = "testPipelineWithPhasedAndMetaOption"
75114
build = "hg19"
76115
files = "$projectDir/tests/input/chr20-phased/*.vcf.gz"
77116
population = "eur"
@@ -94,6 +133,8 @@ nextflow_pipeline {
94133
ZipFile zipFile = new ZipFile(imputed_chr_20, PASSWORD.toCharArray());
95134
zipFile.extractAll("${outputDir}");
96135
def file = path("${outputDir}/chr20.dose.vcf.gz").vcf
136+
def fileMeta = path("${outputDir}/chr20.empiricalDose.vcf.gz").vcf
137+
assert fileMeta.getNoSnps() == 7735
97138
assert file.getChromosome() == "20"
98139
assert file.getNoSamples() == 51;
99140
assert file.isPhased()

0 commit comments

Comments
 (0)