added a wrapper exception for anything that goes wrong in VCF parsing; this way the problematic file line is emitted, no matter what happens. Makes debugging a lot easier, especially in large files.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2739 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
e7f5c93fe5
commit
ac2a207b0b
|
|
@ -0,0 +1,14 @@
|
|||
package org.broadinstitute.sting.utils.genotype.vcf;
|
||||
|
||||
/**
|
||||
* an exception to funnel all parsing exceptions into; this way we can emit the line we choked on as well
|
||||
*/
|
||||
public class VCFParseException extends RuntimeException {
|
||||
public VCFParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public VCFParseException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,10 +191,10 @@ public class VCFReader implements Iterator<VCFRecord>, Iterable<VCFRecord> {
|
|||
*
|
||||
* @param line the line from the file
|
||||
* @param mHeader the VCF header
|
||||
*
|
||||
* @return the VCFRecord
|
||||
*/
|
||||
public static VCFRecord createRecord(String line, VCFHeader mHeader) {
|
||||
try {
|
||||
// things we need to make a VCF record
|
||||
Map<VCFHeader.HEADER_FIELDS, String> values = new HashMap<VCFHeader.HEADER_FIELDS, String>();
|
||||
String tokens[] = line.split("\\s+");
|
||||
|
|
@ -220,12 +220,15 @@ public class VCFReader implements Iterator<VCFRecord>, Iterable<VCFRecord> {
|
|||
}
|
||||
VCFRecord vrec = new VCFRecord(values, mFormatString, genotypeRecords);
|
||||
// associate the genotypes with this new record
|
||||
for ( VCFGenotypeRecord gr : genotypeRecords )
|
||||
for (VCFGenotypeRecord gr : genotypeRecords)
|
||||
gr.setVCFRecord(vrec);
|
||||
return vrec;
|
||||
|
||||
}
|
||||
return new VCFRecord(values);
|
||||
} catch (Exception e) {
|
||||
throw new VCFParseException("VCF Reader failed to parsing, on line = " + line, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue