diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/PlinkRod.java b/java/src/org/broadinstitute/sting/gatk/refdata/PlinkRod.java index bce78234f..143ae8e87 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/PlinkRod.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/PlinkRod.java @@ -114,7 +114,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator> getGenotypes() { + public Map> getGenotypes() { return currentVariant.getGenotypes(); } @@ -169,6 +169,7 @@ public class PlinkRod extends BasicReferenceOrderedDatum implements Iterator(); String line; + long counter = 0; do { line = reader.readLine(); incorporateInfo(seqVars,snpOffsets,line); @@ -425,7 +426,7 @@ class PlinkVariantInfo implements Comparable { private String variantName; private GenomeLoc loc; - private Map> genotypes = new HashMap>(); + private Map> genotypes = new HashMap>(); // for indels private boolean isIndel = false; @@ -450,7 +451,7 @@ class PlinkVariantInfo implements Comparable { return variantName; } - public Map> getGenotypes() { + public Map> getGenotypes() { return genotypes; } @@ -511,13 +512,13 @@ class PlinkVariantInfo implements Comparable { public void addGenotypeEntry(String[] alleleStrings, String sampleName) { - ArrayList alleles = new ArrayList(2); + ArrayList alleles = new ArrayList(2); for ( String alleleString : alleleStrings ) { if ( alleleString.equals(PlinkRod.SEQUENOM_NO_CALL) ) - alleles.add(Allele.NO_CALL_STRING); + alleles.add(Allele.NO_CALL_STRING.getBytes()); else - alleles.add(alleleString); + alleles.add(alleleString.getBytes()); } genotypes.put(sampleName, alleles); diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java index 039ac1e11..9dfc4ef16 100755 --- a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java @@ -386,32 +386,31 @@ public class VariantContextAdaptors { VariantContext convert(String name, Object input, Allele refAllele) { PlinkRod plink = (PlinkRod)input; - HashMap alleles = new HashMap(); // use String keys to help maintain uniqueness - alleles.put(refAllele.isNull() ? Allele.NULL_ALLELE_STRING : new String(refAllele.getBases()), refAllele); + HashSet alleles = new HashSet(); + alleles.add(refAllele); Set genotypes = new HashSet(); - Map> genotypeSets = plink.getGenotypes(); + Map> genotypeSets = plink.getGenotypes(); // for each sample - for ( Map.Entry> genotype : genotypeSets.entrySet() ) { + for ( Map.Entry> genotype : genotypeSets.entrySet() ) { ArrayList myAlleles = new ArrayList(2); // for each allele - for ( String alleleString : genotype.getValue() ) { + for ( byte[] alleleString : genotype.getValue() ) { Allele allele; - if ( alleleString.equals(Allele.NO_CALL_STRING) ) { + if ( Allele.wouldBeNoCallAllele(alleleString) ) { allele = Allele.NO_CALL; } else { if ( !plink.isIndel() ) { allele = new Allele(alleleString, refAllele.basesMatch(alleleString)); - } else if ( alleleString.equals(Allele.NULL_ALLELE_STRING) ) { + } else if ( Allele.wouldBeNullAllele(alleleString) ) { allele = new Allele(alleleString, plink.isInsertion()); } else { allele = new Allele(alleleString, !plink.isInsertion()); } - if ( !alleles.containsKey(alleleString) ) - alleles.put(alleleString, allele); + alleles.add(allele); } myAlleles.add(allele); @@ -424,7 +423,7 @@ public class VariantContextAdaptors { // create the variant context try { GenomeLoc loc = GenomeLocParser.setStop(plink.getLocation(), plink.getLocation().getStop() + plink.getLength()-1); - VariantContext vc = new VariantContext(plink.getVariantName(), loc, alleles.values(), genotypes); + VariantContext vc = new VariantContext(plink.getVariantName(), loc, alleles, genotypes); vc.validate(); return vc; } catch (IllegalArgumentException e) {