Bugfixes on way to a working refactored VariantContext
This commit is contained in:
parent
231c47c039
commit
0be23aae4e
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.diffengine;
|
package org.broadinstitute.sting.gatk.walkers.diffengine;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.broad.tribble.readers.AsciiLineReader;
|
import org.broad.tribble.readers.AsciiLineReader;
|
||||||
import org.broad.tribble.readers.LineReader;
|
import org.broad.tribble.readers.LineReader;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||||
|
|
@ -46,6 +47,8 @@ import java.util.Map;
|
||||||
* Class implementing diffnode reader for VCF
|
* Class implementing diffnode reader for VCF
|
||||||
*/
|
*/
|
||||||
public class VCFDiffableReader implements DiffableReader {
|
public class VCFDiffableReader implements DiffableReader {
|
||||||
|
private static Logger logger = Logger.getLogger(VCFDiffableReader.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return "VCF"; }
|
public String getName() { return "VCF"; }
|
||||||
|
|
||||||
|
|
@ -68,7 +71,10 @@ public class VCFDiffableReader implements DiffableReader {
|
||||||
String key = headerLine.getKey();
|
String key = headerLine.getKey();
|
||||||
if ( headerLine instanceof VCFNamedHeaderLine )
|
if ( headerLine instanceof VCFNamedHeaderLine )
|
||||||
key += "_" + ((VCFNamedHeaderLine) headerLine).getName();
|
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();
|
String line = lineReader.readLine();
|
||||||
|
|
|
||||||
|
|
@ -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 ( this.ID.equals("") ) throw new IllegalArgumentException("ID field cannot be the empty string");
|
||||||
|
|
||||||
if ( !genotypesAreUnparsed && attributes != null ) {
|
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);
|
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);
|
attributes.remove(UNPARSED_GENOTYPE_PARSER_KEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.commonInfo = new CommonInfo(source, negLog10PError, filters, attributes);
|
this.commonInfo = new CommonInfo(source, negLog10PError, filters, attributes);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue