From 889e3c45830f3afa353523270f827a39d02f9870 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Sat, 2 Jun 2012 20:21:27 -0400 Subject: [PATCH] Code cleanup before major refactor --- .../codecs/bcf2/BCF2LazyGenotypesDecoder.java | 72 ------------------- .../utils/variantcontext/SlowGenotype.java | 1 - 2 files changed, 73 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/codecs/bcf2/BCF2LazyGenotypesDecoder.java b/public/java/src/org/broadinstitute/sting/utils/codecs/bcf2/BCF2LazyGenotypesDecoder.java index b1c7a91db..050ff0717 100644 --- a/public/java/src/org/broadinstitute/sting/utils/codecs/bcf2/BCF2LazyGenotypesDecoder.java +++ b/public/java/src/org/broadinstitute/sting/utils/codecs/bcf2/BCF2LazyGenotypesDecoder.java @@ -56,78 +56,6 @@ class BCF2LazyGenotypesDecoder implements LazyGenotypesContext.LazyParser { this.nFields = nFields; } -// @Override -// public LazyGenotypesContext.LazyData parse(final Object data) { -// logger.info("Decoding BCF genotypes for " + nSamples + " samples with " + nFields + " fields each"); -// -// // load our bytep[] data into the decoder -// final BCF2Decoder decoder = new BCF2Decoder((byte[])data); -// -// // go ahead and decode everyone -// final List samples = new ArrayList(codec.getHeader().getGenotypeSamples()); -// -// if ( samples.size() != nSamples ) -// throw new UserException.MalformedBCF2("GATK currently doesn't support reading BCF2 files with " + -// "different numbers of samples per record. Saw " + samples.size() + -// " samples in header but have a record with " + nSamples + " samples"); -// -// final Map> fieldValues = decodeGenotypeFieldValues(decoder, nFields, nSamples); -// final ArrayList genotypes = new ArrayList(nSamples); -// for ( int i = 0; i < nSamples; i++ ) { -// // all of the information we need for each genotype, with default values -// final String sampleName = samples.get(i); -// List alleles = null; -// boolean isPhased = false; -// double log10PError = VariantContext.NO_LOG10_PERROR; -// Set filters = null; -// Map attributes = null; -// double[] log10Likelihoods = null; -// -// for ( final Map.Entry> entry : fieldValues.entrySet() ) { -// final String field = entry.getKey(); -// Object value = entry.getValue().get(i); -// try { -// if ( field.equals(VCFConstants.GENOTYPE_KEY) ) { -// alleles = decodeGenotypeAlleles(siteAlleles, (List)value); -// } else if ( field.equals(VCFConstants.GENOTYPE_QUALITY_KEY) ) { -// if ( value != BCF2Type.INT8.getMissingJavaValue() ) -// log10PError = ((Integer)value) / -10.0; -// } else if ( field.equals(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY) ) { -// final List pls = (List)value; -// if ( pls != null ) { // we have a PL field -// log10Likelihoods = new double[pls.size()]; -// for ( int j = 0; j < log10Likelihoods.length; j++ ) { -// final double d = pls.get(j); -// log10Likelihoods[j] = d == -0.0 ? 0.0 : d / -10.0; -// } -// } -// } else if ( field.equals(VCFConstants.GENOTYPE_FILTER_KEY) ) { -// throw new ReviewedStingException("Genotype filters not implemented in GATK BCF2"); -// //filters = new HashSet(values.get(i)); -// } else { // add to attributes -// if ( value != null ) { // don't add missing values -// if ( attributes == null ) attributes = new HashMap(nFields); -// if ( value instanceof List && ((List)value).size() == 1) -// value = ((List)value).get(0); -// attributes.put(field, value); -// } -// } -// } catch ( ClassCastException e ) { -// throw new UserException.MalformedBCF2("BUG: expected encoding of field " + field -// + " inconsistent with the value observed in the decoded value in the " -// + " BCF file. Value was " + value); -// } -// } -// -// if ( alleles == null ) throw new UserException.MalformedBCF2("BUG: no alleles found"); -// -// final Genotype g = new Genotype(sampleName, alleles, log10PError, filters, attributes, isPhased, log10Likelihoods); -// genotypes.add(g); -// } -// -// return new LazyGenotypesContext.LazyData(genotypes, codec.getHeader().getSampleNamesInOrder(), codec.getHeader().getSampleNameToOffset()); -// } - @Override public LazyGenotypesContext.LazyData parse(final Object data) { logger.info("Decoding BCF genotypes for " + nSamples + " samples with " + nFields + " fields each"); diff --git a/public/java/src/org/broadinstitute/sting/utils/variantcontext/SlowGenotype.java b/public/java/src/org/broadinstitute/sting/utils/variantcontext/SlowGenotype.java index db480de45..3cca86b30 100755 --- a/public/java/src/org/broadinstitute/sting/utils/variantcontext/SlowGenotype.java +++ b/public/java/src/org/broadinstitute/sting/utils/variantcontext/SlowGenotype.java @@ -25,7 +25,6 @@ package org.broadinstitute.sting.utils.variantcontext; -import org.broad.tribble.util.ParsingUtils; import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;