Bug fix for decode loc
-- decodeLoc() wasn't skipping input header lines, so the system blew up when there was an = line being split.
This commit is contained in:
parent
a340a1aeac
commit
e99871f587
|
|
@ -163,19 +163,26 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec,
|
||||||
*/
|
*/
|
||||||
public Feature decodeLoc(String line) {
|
public Feature decodeLoc(String line) {
|
||||||
lineNo++;
|
lineNo++;
|
||||||
String[] locParts = new String[6];
|
|
||||||
|
// the same line reader is not used for parsing the header and parsing lines, if we see a #, we've seen a header line
|
||||||
|
if (line.startsWith(VCFHeader.HEADER_INDICATOR)) return null;
|
||||||
|
|
||||||
|
// our header cannot be null, we need the genotype sample names and counts
|
||||||
|
if (header == null) throw new ReviewedStingException("VCF Header cannot be null when decoding a record");
|
||||||
|
|
||||||
|
final String[] locParts = new String[6];
|
||||||
int nParts = ParsingUtils.split(line, locParts, VCFConstants.FIELD_SEPARATOR_CHAR, true);
|
int nParts = ParsingUtils.split(line, locParts, VCFConstants.FIELD_SEPARATOR_CHAR, true);
|
||||||
|
|
||||||
if ( nParts != 6 )
|
if ( nParts != 6 )
|
||||||
throw new UserException.MalformedVCF("there aren't enough columns for line " + line, lineNo);
|
throw new UserException.MalformedVCF("there aren't enough columns for line " + line, lineNo);
|
||||||
|
|
||||||
// get our alleles (because the end position depends on them)
|
// get our alleles (because the end position depends on them)
|
||||||
String ref = getCachedString(locParts[3].toUpperCase());
|
final String ref = getCachedString(locParts[3].toUpperCase());
|
||||||
String alts = getCachedString(locParts[4].toUpperCase());
|
final String alts = getCachedString(locParts[4].toUpperCase());
|
||||||
List<Allele> alleles = parseAlleles(ref, alts, lineNo);
|
final List<Allele> alleles = parseAlleles(ref, alts, lineNo);
|
||||||
|
|
||||||
// find out our location
|
// find out our location
|
||||||
int start = Integer.valueOf(locParts[1]);
|
final int start = Integer.valueOf(locParts[1]);
|
||||||
int stop = start;
|
int stop = start;
|
||||||
|
|
||||||
// ref alleles don't need to be single bases for monomorphic sites
|
// ref alleles don't need to be single bases for monomorphic sites
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue