hall-lab / svtools

Tools for processing and analyzing structural variants.
MIT License
150 stars 54 forks source link

Lsort File error handling #231

Closed ernfrid closed 6 years ago

ernfrid commented 7 years ago

We've encountered an issue where input files don't exist and errors weren't reported. Ensure that non-existent files throw an error.

ernfrid commented 7 years ago

I think this is due to a balky exception catch in the main application that is swallowing IO Errors.

See https://github.com/hall-lab/svtools/blob/87e89a4f02bd87bde2cef5bf9414334c3dd0debf/svtools/cli.py#L81

Probably need to raise after this statement.

See:

>>> try:
...    i = open("/gscmnt/gc2758/analysis/ccdg/data/Non_African_American/T1D_hap.covfailures/H_VD-30002220/sv/H_VD-30002220.gt.vcf", 'r')
... except IOError as e:
...    if e.errno == errno.EPIPE:
...       print "PIPE ERROR"
...
>>> try:
...    i = open("/gscmnt/gc2758/analysis/ccdg/data/Non_African_American/T1D_hap.covfailures/H_VD-30002220/sv/H_VD-30002220.gt.vcf", 'r')
... except IOError as e:
...    if e.errno == errno.EPIPE:
...       print "PIPE ERROR"
...    else:
...       raise
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
IOError: [Errno 2] No such file or directory: '/gscmnt/gc2758/analysis/ccdg/data/Non_African_American/T1D_hap.covfailures/H_VD-30002220/sv/H_VD-30002220.gt.vcf'