Skip to content

Commit

Permalink
Blocking upload of VCF files with GRCh38/hg38/hg19 builds for VarFish…
Browse files Browse the repository at this point in the history
… Kiosk.
  • Loading branch information
stolpeo committed Apr 29, 2020
1 parent 00b6db6 commit 5946524
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ End-User Summary

- Fixed bug where some variant flags didn't color the row in filtering results after reloading the page.
- Fixed upload bug in VarFish Kiosk when vcf file was too small.
- Blocking upload of VCF files with GRCh38/hg38/hg19 builds for VarFish Kiosk.

Full Change List
================

- Fixed bug where some variant flags didn't color the row in filtering results after reloading the page.
- Fixed upload bug in VarFish Kiosk when vcf file was too small and the file copy process didn't flush the file completely resulting in only a parly available header.
- Blocking upload of VCF files with GRCh38/hg38/hg19 builds for VarFish Kiosk.

-------
v0.21.0
Expand Down
12 changes: 11 additions & 1 deletion variants/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@ def clean(self):
tmp_file.flush()
self.cleaned_data.get("vcf_file").seek(0)
try:
vcf_samples = vcfpy.Reader.from_path(tmp_file.name).header.samples.names
vcf_header = vcfpy.Reader.from_path(tmp_file.name).header
vcf_samples = vcf_header.samples.names
self.cleaned_data["vcf_index"] = vcf_samples[0]
if ped_samples and set(vcf_samples) != set(ped_samples):
self.add_error(
Expand All @@ -1652,6 +1653,15 @@ def clean(self):
self.cleaned_data["ped"] = [
"\t".join(["FAM", sample, "0", "0", "1", "2"]) for sample in vcf_samples
]
for entry in list(vcf_header.get_lines("contig")):
# GRCh38/hg38?
if entry.id in ("chr1", "1") and int(entry.length) == 248956422:
self.add_error("vcf_file", "Only GRCh37 build is supported!")
break
# hg19?
if entry.id == "chr1" and int(entry.length) == 249250621:
self.add_error("vcf_file", "Only GRCh37 build is supported!")
break
except vcfpy.exceptions.VCFPyException as e:
self.add_error("vcf_file", "Problem with VCF file: %s" % e)

Expand Down

0 comments on commit 5946524

Please sign in to comment.