hammerlab / cycledash

Variant Caller Analysis Dashboard and Data Management System
Other
35 stars 2 forks source link

Fail responsibly when dealing with VCF files without headers #821

Open armish opened 9 years ago

armish commented 9 years ago

Turns out the reason behind issue #783 was a VCF file without any headers. This is how that particular VCF file looks like:

$ head -10 $SOMEPATH/work-Mutect-PT189-PT189_6_13-merged.SureSelect.vcf
chr1    69511   rs75062661  A   G   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:0,196:33:196:1.00   0:0,75:.:66:1.00
chr1    69557   .   C   T   .   REJECT  .   GT:AD:BQ:DP:FA  0/1:255,3:34:258:0.012  0:92,0:.:92:0.00
chr1    762273  rs3115849   G   A   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:209,195:34:404:0.483    0:24,12:.:34:0.333
chr1    762472  rs145493205 C   T   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:54,22:32:76:0.289   0:42,13:.:49:0.236
chr1    762485  rs148989274 C   A   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:54,15:33:69:0.217   0:40,18:.:50:0.310
chr1    876499  rs4372192   A   G   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:0,55:34:55:1.00 0:0,11:.:11:1.00
chr1    877715  rs6605066   C   G   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:0,20:31:20:1.00 0:0,4:.:4:1.00
chr1    877831  rs6672356   T   C   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:0,23:33:23:1.00 0:0,3:.:3:1.00
chr1    878314  rs142558220 G   C   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:134,88:36:222:0.396 0:4,12:.:16:0.750
chr1    880238  rs3748592   A   G   .   REJECT  DB  GT:AD:BQ:DP:FA  0/1:0,227:36:227:1.00   0:0,15:.:15:1.00

Submitting VCFs without any headers triggers an Internal Server Error, yet the Run is still created. See this example, which was a re-submission of the same VCF file that was causing #783: http://cycledash.demeter.hpc.mssm.edu/runs/352/examine

and the error on the server side is as follows:

[ERROR] 2015-08-28 17:16:32,790 - cycledash
/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask_restful/__init__.py:299
Internal Error
Traceback (most recent call last):
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask_restful/__init__.py", line 462, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/cycledash/cycledash/cycledash/api/__init__.py", line 37, in dispatch_request
    return super(Resource, self).dispatch_request(*args, **kwargs)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/flask_restful/__init__.py", line 572, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/cycledash/cycledash/cycledash/api/__init__.py", line 100, in wrapper
    return f(*args, **kwargs)
  File "/home/cycledash/cycledash/cycledash/api/__init__.py", line 74, in wrapper
    content = marshal(resp[0], schema, envelope=envelope)
  File "/home/cycledash/cycledash/cycledash/api/__init__.py", line 56, in marshal
    items = schema(data)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/voluptuous.py", line 333, in __call__
    return self._compiled([], data)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/voluptuous.py", line 631, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/home/cycledash/cycledash/venv/lib/python2.7/site-packages/voluptuous.py", line 467, in validate_mapping
    raise MultipleInvalid(errors)
MultipleInvalid: extra keys not allowed @ data['normal']

We should not allow these problematic files to be submitted in the first place.

armish commented 9 years ago

also relevant: #490