Cleaned up RefMetaDataTracker

Renamed many functions to more clearly state what they are actually doing
Removed unnecessary / unused functionality, reducing interface complexity
Updated all uses of this code in GATK
Added generic, type-safe accessors to RefMetaDataTracker such as public <T> List<T> getValues(final String name, Class<T> clazz)
Added standard refMetaDataTracker accessors to RodBinding, so you can do everything you can for generic rods with the tracker directly with with the RodBinding
This commit is contained in:
Mark DePristo 2011-07-27 23:25:52 -04:00
parent f3ad4ec94b
commit c83f9432eb
24 changed files with 134 additions and 165 deletions

View File

@ -25,8 +25,11 @@
package org.broadinstitute.sting.commandline;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.List;
import java.util.*;
/**
*
@ -50,8 +53,24 @@ public class RodBinding {
return source;
}
public List<Object> getAll(RefMetaDataTracker tracker) {
return tracker.getReferenceMetaData(variableName);
public List<Object> getValues(RefMetaDataTracker tracker) {
return tracker.getValues(variableName);
}
public <T> List<T> getValues(RefMetaDataTracker tracker, Class<T> clazz) {
return tracker.getValues(variableName, clazz);
}
public <T> T getFirstValue(RefMetaDataTracker tracker, Class<T> clazz) {
return tracker.getFirstValue(variableName, clazz);
}
public boolean hasValues(RefMetaDataTracker tracker) {
return tracker.hasValues(variableName);
}
public List<GATKFeature> getValuesAsGATKFeatures(RefMetaDataTracker tracker) {
return tracker.getValuesAsGATKFeatures(variableName);
}
public Tags getTags() {

View File

@ -43,4 +43,28 @@ public class VariantContextRodBinding extends RodBinding {
public VariantContext getVariantContext(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc) {
return tracker.getVariantContext(ref, variableName, loc);
}
// public Collection<VariantContext> getAllVariantContexts(ReferenceContext ref) {
// }
//
// public Collection<VariantContext> getAllVariantContexts(ReferenceContext ref, GenomeLoc curLocation) {
// }
//
// public Collection<VariantContext> getAllVariantContexts(ReferenceContext ref, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
// }
//
// public Collection<VariantContext> getVariantContexts(ReferenceContext ref, String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
// }
//
// public Collection<VariantContext> getVariantContexts(ReferenceContext ref, Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
// }
//
// public Collection<VariantContext> getVariantContextsByPrefix(ReferenceContext ref, Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
// }
//
// public VariantContext getVariantContext(ReferenceContext ref, String name, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere ) {
// }
//
// public VariantContext getVariantContext(ReferenceContext ref, String name, GenomeLoc curLocation) {
// }
}

View File

@ -140,7 +140,7 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
private RefMetaDataTracker createTracker( Collection<RODRecordList> allTracksHere ) {
RefMetaDataTracker t = new RefMetaDataTracker(allTracksHere.size());
for ( RODRecordList track : allTracksHere ) {
if ( ! t.hasROD(track.getName()) )
if ( ! t.hasValues(track.getName()) )
t.bind(track.getName(), track);
}

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) 2010 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.gatk.datasources.reference;
public interface ReferenceDataSourceProgressListener {
public void percentProgress(int percent);
}

View File

@ -38,61 +38,45 @@ public class RefMetaDataTracker {
map = new HashMap<String, RODRecordList>(nBindings);
}
/**
* No-assumption version of getValues(name, class). Returns Objects.
*/
public List<Object> getValues(final String name) {
return getValues(name, Object.class);
}
/**
* get all the reference meta data associated with a track name.
* @param name the name of the track we're looking for
* @param clazz the expected class of the elements bound to rod name
* @return a list of objects, representing the underlying objects that the tracks produce. I.e. for a
* dbSNP RMD this will be a RodDbSNP, etc.
*
* Important: The list returned by this function is guaranteed not to be null, but may be empty!
*/
public List<Object> getReferenceMetaData(final String name) {
RODRecordList list = getTrackDataByName(name, true);
List<Object> objects = new ArrayList<Object>();
if (list == null) return objects;
for (GATKFeature feature : list)
objects.add(feature.getUnderlyingObject());
return objects;
}
public <T> List<T> getValues(final String name, Class<T> clazz) {
RODRecordList list = getTrackDataByName(name);
/**
* get all the reference meta data associated with a track name.
* @param name the name of the track we're looking for
* @param requireExactMatch do we require an exact match for the name (true) or do we require only that the name starts with
* the passed in parameter (false).
* @return a list of objects, representing the underlying objects that the tracks produce. I.e. for a
* dbSNP rod this will be a RodDbSNP, etc.
*
* Important: The list returned by this function is guaranteed not to be null, but may be empty!
*/
public List<Object> getReferenceMetaData(final String name, boolean requireExactMatch) {
RODRecordList list = getTrackDataByName(name, requireExactMatch);
List<Object> objects = new ArrayList<Object>();
if (list == null) return objects;
for (GATKFeature feature : list)
objects.add(feature.getUnderlyingObject());
return objects;
}
/**
* get all the GATK features associated with a specific track name
* @param name the name of the track we're looking for
* @param requireExactMatch do we require an exact match for the name (true) or do we require only that the name starts with
* the passed in parameter (false).
* @return a list of GATKFeatures for the target rmd
*
* Important: The list returned by this function is guaranteed not to be null, but may be empty!
*/
public List<GATKFeature> getGATKFeatureMetaData(final String name, boolean requireExactMatch) {
List<GATKFeature> feat = getTrackDataByName(name,requireExactMatch);
return (feat == null) ? new ArrayList<GATKFeature>() : feat; // to satisfy the above requirement that we don't return null
if (list == null)
return Collections.emptyList();
else {
List<T> objects = new ArrayList<T>();
for (GATKFeature feature : list) {
final Object obj = feature.getUnderlyingObject();
if (!(clazz.isAssignableFrom(obj.getClass())))
throw new UserException.CommandLineException("Unable to case track named " + name + " to type of " + clazz.toString()
+ " it's of type " + obj.getClass());
objects.add((T)obj);
}
return objects;
}
}
/**
* get a singleton record, given the name and a type. This function will return the first record at the current position seen,
* and emit a logger warning if there were more than one option.
*
* WARNING: this method is deprecated, since we now suppport more than one RMD at a single position for all tracks. If there are
* WARNING: we now suppport more than one RMD at a single position for all tracks. If there are
* are multiple RMD objects at this location, there is no contract for which object this method will pick, and which object gets
* picked may change from time to time! BE WARNED!
*
@ -101,22 +85,18 @@ public class RefMetaDataTracker {
* @param <T> the type to parameterize on, matching the clazz argument
* @return a record of type T, or null if no record is present.
*/
@Deprecated
public <T> T lookup(final String name, Class<T> clazz) {
RODRecordList objects = getTrackDataByName(name, true);
public <T> T getFirstValue(final String name, Class<T> clazz) {
RODRecordList objects = getTrackDataByName(name);
// if emtpy or null return null;
// if empty or null return null;
if (objects == null || objects.size() < 1) return null;
if (objects.size() > 1)
logger.info("lookup is choosing the first record from " + (objects.size() - 1) + " options");
Object obj = objects.get(0).getUnderlyingObject();
if (!(clazz.isAssignableFrom(obj.getClass())))
throw new UserException.CommandLineException("Unable to case track named " + name + " to type of " + clazz.toString()
+ " it's of type " + obj.getClass());
return (T)obj;
else
return (T)obj;
}
/**
@ -125,7 +105,7 @@ public class RefMetaDataTracker {
* @param name the name of the rod
* @return true if it has the rod
*/
public boolean hasROD(final String name) {
public boolean hasValues(final String name) {
return map.containsKey(canonicalName(name));
}
@ -136,14 +116,25 @@ public class RefMetaDataTracker {
*
* @return collection of all rods
*/
public Collection<GATKFeature> getAllRods() {
public Collection<GATKFeature> getAllValuesAsGATKFeatures() {
List<GATKFeature> l = new ArrayList<GATKFeature>();
for ( RODRecordList rl : map.values() ) {
if ( rl == null ) continue; // how do we get null value stored for a track? shouldn't the track be missing from the map alltogether?
l.addAll(rl);
if ( rl != null )
l.addAll(rl);
}
return l;
}
/**
* get all the GATK features associated with a specific track name
* @param name the name of the track we're looking for
* @return a list of GATKFeatures for the target rmd
*
* Important: The list returned by this function is guaranteed not to be null, but may be empty!
*/
public List<GATKFeature> getValuesAsGATKFeatures(final String name) {
List<GATKFeature> feat = getTrackDataByName(name);
return (feat == null) ? new ArrayList<GATKFeature>() : feat; // to satisfy the above requirement that we don't return null
}
/**
@ -163,23 +154,16 @@ public class RefMetaDataTracker {
}
/**
* @return the number of ROD bindings (name -> value) where value is not empty in this tracker
* The number of tracks with at least one value bound here
* @return
*/
public int getNBoundRodTracks() {
return getNBoundRodTracks(null);
}
public int getNBoundRodTracks(final String excludeIn ) {
final String exclude = excludeIn == null ? null : canonicalName(excludeIn);
public int getNumberOfTracksWithValue() {
int n = 0;
for ( RODRecordList value : map.values() ) {
if ( value != null && ! value.isEmpty() ) {
if ( exclude == null || ! value.getName().equals(exclude) )
n++;
n++;
}
}
return n;
}
@ -276,20 +260,7 @@ public class RefMetaDataTracker {
Collection<VariantContext> contexts = new ArrayList<VariantContext>();
for ( String name : names ) {
RODRecordList rodList = getTrackDataByName(name,true); // require that the name is an exact match
if ( rodList != null )
addVariantContexts(contexts, rodList, ref, allowedTypes, curLocation, requireStartHere, takeFirstOnly );
}
return contexts;
}
public Collection<VariantContext> getVariantContextsByPrefix(ReferenceContext ref, Collection<String> names, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
Collection<VariantContext> contexts = new ArrayList<VariantContext>();
for ( String name : names ) {
RODRecordList rodList = getTrackDataByName(name,false); // require that the name is an exact match
RODRecordList rodList = getTrackDataByName(name); // require that the name is an exact match
if ( rodList != null )
addVariantContexts(contexts, rodList, ref, allowedTypes, curLocation, requireStartHere, takeFirstOnly );
@ -332,7 +303,6 @@ public class RefMetaDataTracker {
return getVariantContext(ref, name, null, curLocation, true);
}
private void addVariantContexts(Collection<VariantContext> contexts, RODRecordList rodList, ReferenceContext ref, EnumSet<VariantContext.Type> allowedTypes, GenomeLoc curLocation, boolean requireStartHere, boolean takeFirstOnly ) {
for ( GATKFeature rec : rodList ) {
if ( VariantContextAdaptors.canBeConvertedToVariantContext(rec.getUnderlyingObject()) ) {
@ -367,29 +337,11 @@ public class RefMetaDataTracker {
* for instance, on locus traversal, location is usually expected to be a single base we are currently looking at,
* regardless of the presence of "extended" RODs overlapping with that location).
* @param name track name
* @param requireExactMatch do we require an exact match of the rod name?
* @return track data for the given rod
*/
private RODRecordList getTrackDataByName(final String name, boolean requireExactMatch) {
//logger.debug(String.format("Lookup %s%n", name));
private RODRecordList getTrackDataByName(final String name) {
final String luName = canonicalName(name);
RODRecordList trackData = null;
if ( requireExactMatch ) {
if ( map.containsKey(luName) )
trackData = map.get(luName);
} else {
for ( Map.Entry<String, RODRecordList> datum : map.entrySet() ) {
final String rodName = datum.getKey();
if ( datum.getValue() != null && rodName.startsWith(luName) ) {
if ( trackData == null ) trackData = new RODRecordListImpl(name);
//System.out.printf("Adding bindings from %s to %s at %s%n", rodName, name, datum.getValue().getLocation());
((RODRecordListImpl)trackData).add(datum.getValue(), true);
}
}
}
return trackData;
return map.get(luName);
}
/**
@ -398,6 +350,7 @@ public class RefMetaDataTracker {
* @return canonical name of the rod
*/
private final String canonicalName(final String name) {
// todo -- remove me after switch to RodBinding syntax
return name.toLowerCase();
}
}

View File

@ -57,6 +57,7 @@ public abstract class GATKFeature implements Feature, HasGenomeLocation {
public abstract GenomeLoc getLocation();
// TODO: this should be a Feature
public abstract Object getUnderlyingObject();
/**
@ -98,6 +99,7 @@ public abstract class GATKFeature implements Feature, HasGenomeLocation {
return feature.getEnd();
}
// TODO: this should be a Feature, actually
public Object getUnderlyingObject() {
return feature;
}

View File

@ -112,14 +112,14 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
*/
private String getReferenceOrderedData( RefMetaDataTracker tracker ) {
ArrayList<String> rodStrings = new ArrayList<String>();
for ( GATKFeature datum : tracker.getAllRods() ) {
for ( GATKFeature datum : tracker.getAllValuesAsGATKFeatures() ) {
if ( datum != null && datum.getUnderlyingObject() instanceof ReferenceOrderedDatum ) {
rodStrings.add(((ReferenceOrderedDatum)datum.getUnderlyingObject()).toSimpleString()); // TODO: Aaron: this line still survives, try to remove it
}
}
String rodString = Utils.join(", ", rodStrings);
DbSNPFeature dbsnp = tracker.lookup(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, DbSNPFeature.class);
DbSNPFeature dbsnp = tracker.getFirstValue(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME, DbSNPFeature.class);
if ( dbsnp != null)
rodString += DbSNPHelper.toMediumString(dbsnp);

View File

@ -61,7 +61,7 @@ public class PrintRODsWalker extends RodWalker<Integer, Integer> {
if ( tracker == null )
return 0;
Iterator<GATKFeature> rods = tracker.getAllRods().iterator();
Iterator<GATKFeature> rods = tracker.getAllValuesAsGATKFeatures().iterator();
while ( rods.hasNext() ) {
Object rod = rods.next().getUnderlyingObject();
if (VariantContextAdaptors.canBeConvertedToVariantContext(rod) )

View File

@ -194,9 +194,9 @@ public class VariantAnnotatorEngine {
String rsID = null;
if (vc.isSNP())
rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
else if (vc.isIndel())
rsID = DbSNPHelper.rsIDOfFirstRealIndel(tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
rsID = DbSNPHelper.rsIDOfFirstRealIndel(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
infoAnnotations.put(VCFConstants.DBSNP_KEY, rsID != null );
// annotate dbsnp id if available and not already there
if ( rsID != null && (!vc.hasID() || vc.getID().equals(VCFConstants.EMPTY_ID_FIELD)) )

View File

@ -146,7 +146,7 @@ public class GenomicAnnotation extends InfoFieldAnnotation {
//iterate over each record that overlaps the current locus, and, if it passes certain filters,
//add its values to the list of annotations for this locus.
final Map<String, Object> annotations = new HashMap<String, Object>();
for(final GATKFeature gatkFeature : tracker.getAllRods())
for(final GATKFeature gatkFeature : tracker.getAllValuesAsGATKFeatures())
{
final String name = gatkFeature.getName();
if( name.equals("variant") || name.equals("interval") ) {

View File

@ -213,7 +213,7 @@ public class TranscriptToGenomicInfo extends RodWalker<Integer, Integer> {
if ( rods.size() == 0 )
return 0;
final List<Object> transcriptRODs = tracker.getReferenceMetaData(ROD_NAME);
final List<Object> transcriptRODs = tracker.getValues(ROD_NAME);
//there may be multiple transcriptRODs that overlap this locus
for ( Object transcriptRodObject : transcriptRODs ) {

View File

@ -130,7 +130,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
vcfWriter.add(vc_input, ref.getBase());
return 1;
}
List<Object> r2rods = tracker.getReferenceMetaData(R2_ROD_NAME);
List<Object> r2rods = tracker.getValues(R2_ROD_NAME);
// ignore places where we don't have a variant
if ( r2rods.size() == 0 )
@ -138,7 +138,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
BeagleFeature beagleR2Feature = (BeagleFeature)r2rods.get(0);
List<Object> gProbsrods = tracker.getReferenceMetaData(PROBS_ROD_NAME);
List<Object> gProbsrods = tracker.getValues(PROBS_ROD_NAME);
// ignore places where we don't have a variant
if ( gProbsrods.size() == 0 )
@ -146,7 +146,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
BeagleFeature beagleProbsFeature = (BeagleFeature)gProbsrods.get(0);
List<Object> gPhasedrods = tracker.getReferenceMetaData(PHASED_ROD_NAME);
List<Object> gPhasedrods = tracker.getValues(PHASED_ROD_NAME);
// ignore places where we don't have a variant
if ( gPhasedrods.size() == 0 )

View File

@ -92,7 +92,7 @@ public class CompareCallableLociWalker extends RodWalker<List<CallableLociWalker
private CallableLociWalker.CallableBaseState getCallableBaseState(RefMetaDataTracker tracker, String track) {
//System.out.printf("tracker %s%n", tracker);
List<Object> bindings = tracker.getReferenceMetaData(track);
List<Object> bindings = tracker.getValues(track);
if ( bindings.size() != 1 || ! (bindings.get(0) instanceof FullBEDFeature)) {
throw new UserException.MalformedFile(String.format("%s track isn't a properly formated CallableBases object!", track));
}

View File

@ -152,7 +152,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
Collection<VariantContext> VCs = tracker.getVariantContexts(ref, INPUT_VARIANT_ROD_BINDING_NAME, null, context.getLocation(), true, false);
// is there a SNP mask present?
boolean hasMask = tracker.getReferenceMetaData("mask").size() > 0;
boolean hasMask = tracker.getValues("mask").size() > 0;
if ( hasMask )
previousMaskPosition = ref.getLocus(); // multi-base masks will get triggered over all bases of the mask

View File

@ -172,7 +172,7 @@ public class AnnotateMNPsWalker extends RodWalker<Integer, Integer> {
}
GenomeLoc stopLoc = locParser.createGenomeLoc(curLocus.getContig(), vcLoc.getStop());
final List<Object> refSeqRODs = tracker.getReferenceMetaData(REFSEQ_ROD_NAME);
final List<Object> refSeqRODs = tracker.getValues(REFSEQ_ROD_NAME);
for (Object refSeqObject : refSeqRODs) {
AnnotatorInputTableFeature refSeqAnnotation = (AnnotatorInputTableFeature) refSeqObject;
locusToRefSeqFeatures.putLocusFeatures(curLocus, refSeqAnnotation, stopLoc);

View File

@ -36,7 +36,7 @@ public class CountIntervals extends RefWalker<Long, Long> {
return null;
}
List<GATKFeature> checkIntervals = tracker.getGATKFeatureMetaData("check",false);
List<Object> checkIntervals = tracker.getValues("check");
return (long) checkIntervals.size();
}

View File

@ -73,9 +73,9 @@ public class RodSystemValidationWalker extends RodWalker<Integer,Integer> {
@Override
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
int ret = 0;
if (tracker != null && tracker.getAllRods().size() > 0) {
if (tracker != null && tracker.getAllValuesAsGATKFeatures().size() > 0) {
out.print(context.getLocation() + DIVIDER);
Collection<GATKFeature> features = tracker.getAllRods();
Collection<GATKFeature> features = tracker.getAllValuesAsGATKFeatures();
for (GATKFeature feat : features)
out.print(feat.getName() + DIVIDER);
out.println(";");

View File

@ -130,7 +130,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
* @return True pileup data.
*/
private SAMPileupFeature getTruePileup( RefMetaDataTracker tracker ) {
SAMPileupFeature pileup = tracker.lookup("pileup",SAMPileupFeature.class);
SAMPileupFeature pileup = tracker.getFirstValue("pileup", SAMPileupFeature.class);
if( pileup == null)
return null;

View File

@ -294,7 +294,7 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
// If any ROD covers this site then we assume it is a site of known genetic variation and we skip it
boolean isSNP = false;
for( final GATKFeature rod : tracker.getAllRods() ) {
for( final GATKFeature rod : tracker.getAllValuesAsGATKFeatures() ) {
if( rod != null ) {
isSNP = true;
break;

View File

@ -99,9 +99,10 @@ public class ValidationAmplicons extends RodWalker<Integer,Integer> {
}
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
if ( tracker == null || ! tracker.hasROD("ProbeIntervals")) { return null; }
if ( tracker == null || ! tracker.hasValues("ProbeIntervals")) { return null; }
GenomeLoc interval = ((TableFeature) tracker.getReferenceMetaData("ProbeIntervals",true).get(0)).getLocation();
TableFeature feature = tracker.getFirstValue("ProbeIntervals", TableFeature.class);
GenomeLoc interval = feature.getLocation();
//logger.debug(interval);
if ( prevInterval == null || ! interval.equals(prevInterval) ) {
// we're in a new interval, we should:
@ -129,8 +130,8 @@ public class ValidationAmplicons extends RodWalker<Integer,Integer> {
rawSequence = new StringBuilder();
sequenceInvalid = false;
invReason = new LinkedList<String>();
logger.debug(Utils.join("\t",((TableFeature) tracker.getReferenceMetaData("ProbeIntervals",true).get(0)).getAllValues()));
probeName = ((TableFeature) tracker.getReferenceMetaData("ProbeIntervals",true).get(0)).getValue(1);
logger.debug(Utils.join("\t",feature.getAllValues()));
probeName = feature.getValue(1);
indelCounter = 0;
}

View File

@ -34,7 +34,7 @@ public class Novelty extends VariantStratifier implements StandardStratification
if (tracker != null) {
for (String knownName : knownNames) {
if (tracker.hasROD(knownName)) {
if (tracker.hasValues(knownName)) {
EnumSet<VariantContext.Type> allowableTypes = EnumSet.of(VariantContext.Type.NO_VARIATION);
if (eval != null) {
allowableTypes.add(eval.getType());

View File

@ -142,8 +142,8 @@ public class ValidateVariants extends RodWalker<Integer, Integer> {
// get the RS IDs
Set<String> rsIDs = null;
if ( tracker.hasROD(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ) {
List<Object> dbsnpList = tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME);
if ( tracker.hasValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ) {
List<Object> dbsnpList = tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME);
rsIDs = new HashSet<String>();
for ( Object d : dbsnpList ) {
if (d instanceof DbSNPFeature )

View File

@ -85,7 +85,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
if ( tracker == null || !BaseUtils.isRegularBase(ref.getBase()) )
return 0;
String rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
String rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
Collection<VariantContext> contexts = getVariantContexts(tracker, ref);
@ -112,7 +112,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
private Collection<VariantContext> getVariantContexts(RefMetaDataTracker tracker, ReferenceContext ref) {
// we need to special case the HapMap format because indels aren't handled correctly
List<Object> features = tracker.getReferenceMetaData(INPUT_ROD_NAME, true);
List<Object> features = tracker.getValues(INPUT_ROD_NAME);
if ( features.size() > 0 && features.get(0) instanceof HapMapFeature ) {
ArrayList<VariantContext> hapmapVCs = new ArrayList<VariantContext>(features.size());
for ( Object feature : features ) {
@ -217,7 +217,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(INPUT_ROD_NAME));
if ( samples.isEmpty() ) {
List<Object> rods = tracker.getReferenceMetaData(INPUT_ROD_NAME);
List<Object> rods = tracker.getValues(INPUT_ROD_NAME);
if ( rods.size() == 0 )
throw new IllegalStateException("No rod data is present");

View File

@ -70,7 +70,7 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",10));
Assert.assertEquals(tracker.getAllRods().size(), 0, "The tracker should not have produced any data");
Assert.assertEquals(tracker.getAllValuesAsGATKFeatures().size(), 0, "The tracker should not have produced any data");
}
/**
@ -88,7 +88,7 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",20));
TableFeature datum = tracker.lookup("tableTest",TableFeature.class);
TableFeature datum = tracker.getFirstValue("tableTest", TableFeature.class);
Assert.assertEquals(datum.get("COL1"),"C","datum parameter for COL1 is incorrect");
Assert.assertEquals(datum.get("COL2"),"D","datum parameter for COL2 is incorrect");
@ -114,13 +114,13 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",20));
TableFeature datum1 = tracker.lookup("tableTest1",TableFeature.class);
TableFeature datum1 = tracker.getFirstValue("tableTest1", TableFeature.class);
Assert.assertEquals(datum1.get("COL1"),"C","datum1 parameter for COL1 is incorrect");
Assert.assertEquals(datum1.get("COL2"),"D","datum1 parameter for COL2 is incorrect");
Assert.assertEquals(datum1.get("COL3"),"E","datum1 parameter for COL3 is incorrect");
TableFeature datum2 = tracker.lookup("tableTest2", TableFeature.class);
TableFeature datum2 = tracker.getFirstValue("tableTest2", TableFeature.class);
Assert.assertEquals(datum2.get("COL1"),"C","datum2 parameter for COL1 is incorrect");
Assert.assertEquals(datum2.get("COL2"),"D","datum2 parameter for COL2 is incorrect");