From 184030dd562059fcf9c390336c76a3badc552463 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Mon, 1 Aug 2011 15:21:16 -0400 Subject: [PATCH] RefMetaDataTracker no longer automagically converts inputs to VariantContexts This was no longer working properly given that DBSNP indels needed to be moved around. The adaptor system is being refactored and you will need to convert files from X -> VCF for many tools to work. --- .../gatk/refdata/RefMetaDataTracker.java | 49 +++++-------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java b/public/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java index 1436465ad..7ee560d1d 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java @@ -54,37 +54,12 @@ public class RefMetaDataTracker { else { map = new HashMap(allBindings.size()); for ( RODRecordList rod : allBindings ) { - //logger.debug(String.format("Binding %s to %s", name, rod)); if ( rod != null ) - map.put(canonicalName(rod.getName()), maybeConvertToVariantContext(rod)); + map.put(canonicalName(rod.getName()), rod); } } } - /** - * A private converter that transforms a RODRecordList of objects of type X into - * a list of VariantContexts, if possible. - * - * TODO: should be removed when Features like dbsnp and hapmap produce VCs directly - * - * @param bindings - * @return - */ - private final RODRecordList maybeConvertToVariantContext(RODRecordList bindings) { - List values = new ArrayList(bindings.size()); - - for ( GATKFeature rec : bindings ) { - if ( VariantContextAdaptors.canBeConvertedToVariantContext(rec.getUnderlyingObject()) ) { - final VariantContext vc = VariantContextAdaptors.toVariantContext(bindings.getName(), rec.getUnderlyingObject(), ref); - if ( vc != null ) // it's possible that the conversion failed, but we continue along anyway - values.add(new GATKFeature.TribbleGATKFeature(ref.getGenomeLocParser(), vc, rec.getName())); - } else - values.add(rec); - } - - return new RODRecordListImpl(bindings.getName(), values, bindings.getLocation()); - } - // ------------------------------------------------------------------------------------------ // // @@ -294,11 +269,11 @@ public class RefMetaDataTracker { // ------------------------------------------------------------------------------------------ private List addValues(final Collection names, - final Class type, - final List values, - final GenomeLoc curLocation, - final boolean requireStartHere, - final boolean takeFirstOnly ) { + final Class type, + final List values, + final GenomeLoc curLocation, + final boolean requireStartHere, + final boolean takeFirstOnly ) { for ( String name : names ) { RODRecordList rodList = getTrackDataByName(name); // require that the name is an exact match addValues(name, type, values, rodList, curLocation, requireStartHere, takeFirstOnly ); @@ -308,12 +283,12 @@ public class RefMetaDataTracker { } private List addValues(final String name, - final Class type, - final List values, - final RODRecordList rodList, - final GenomeLoc curLocation, - final boolean requireStartHere, - final boolean takeFirstOnly ) { + final Class type, + final List values, + final RODRecordList rodList, + final GenomeLoc curLocation, + final boolean requireStartHere, + final boolean takeFirstOnly ) { for ( GATKFeature rec : rodList ) { if ( ! requireStartHere || rec.getLocation().getStart() == curLocation.getStart() ) { // ok, we are going to keep this thing Object obj = rec.getUnderlyingObject();