Skip to content

Commit

Permalink
Bug fix for decode loc
Browse files Browse the repository at this point in the history
-- decodeLoc() wasn't skipping input header lines, so the system blew up when there was an = line being split.
  • Loading branch information
Mark DePristo committed Nov 4, 2011
1 parent a340a1a commit e99871f
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,26 @@ protected Object createHeader(List<String> headerStrings, String line) {
*/
public Feature decodeLoc(String line) {
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);

if ( nParts != 6 )
throw new UserException.MalformedVCF("there aren't enough columns for line " + line, lineNo);

// get our alleles (because the end position depends on them)
String ref = getCachedString(locParts[3].toUpperCase());
String alts = getCachedString(locParts[4].toUpperCase());
List<Allele> alleles = parseAlleles(ref, alts, lineNo);
final String ref = getCachedString(locParts[3].toUpperCase());
final String alts = getCachedString(locParts[4].toUpperCase());
final List<Allele> alleles = parseAlleles(ref, alts, lineNo);

// find out our location
int start = Integer.valueOf(locParts[1]);
final int start = Integer.valueOf(locParts[1]);
int stop = start;

// ref alleles don't need to be single bases for monomorphic sites
Expand Down

0 comments on commit e99871f

Please sign in to comment.