Bugfixes on way to a working refactored VariantContext

This commit is contained in:
Mark DePristo 2011-11-15 17:20:14 -05:00
parent 231c47c039
commit 0be23aae4e
2 changed files with 13 additions and 3 deletions

View File

@ -24,6 +24,7 @@
package org.broadinstitute.sting.gatk.walkers.diffengine;
import org.apache.log4j.Logger;
import org.broad.tribble.readers.AsciiLineReader;
import org.broad.tribble.readers.LineReader;
import org.broadinstitute.sting.utils.codecs.vcf.*;
@ -46,6 +47,8 @@ import java.util.Map;
* Class implementing diffnode reader for VCF
*/
public class VCFDiffableReader implements DiffableReader {
private static Logger logger = Logger.getLogger(VCFDiffableReader.class);
@Override
public String getName() { return "VCF"; }
@ -68,7 +71,10 @@ public class VCFDiffableReader implements DiffableReader {
String key = headerLine.getKey();
if ( headerLine instanceof VCFNamedHeaderLine )
key += "_" + ((VCFNamedHeaderLine) headerLine).getName();
root.add(key, headerLine.toString());
if ( root.hasElement(key) )
logger.warn("Skipping duplicate header line: file=" + file + " line=" + headerLine.toString());
else
root.add(key, headerLine.toString());
}
String line = lineReader.readLine();

View File

@ -388,10 +388,14 @@ public class VariantContext implements Feature { // to enable tribble intergrati
if ( this.ID.equals("") ) throw new IllegalArgumentException("ID field cannot be the empty string");
if ( !genotypesAreUnparsed && attributes != null ) {
if ( attributes.containsKey(UNPARSED_GENOTYPE_MAP_KEY) )
if ( attributes.containsKey(UNPARSED_GENOTYPE_MAP_KEY) ) {
attributes = new HashMap<String, Object>(attributes);
attributes.remove(UNPARSED_GENOTYPE_MAP_KEY);
if ( attributes.containsKey(UNPARSED_GENOTYPE_PARSER_KEY) )
}
if ( attributes.containsKey(UNPARSED_GENOTYPE_PARSER_KEY) ) {
attributes = new HashMap<String, Object>(attributes);
attributes.remove(UNPARSED_GENOTYPE_PARSER_KEY);
}
}
this.commonInfo = new CommonInfo(source, negLog10PError, filters, attributes);