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.
This commit is contained in:
Mark DePristo 2011-08-01 15:21:16 -04:00
parent 8b1adb8c95
commit 184030dd56
1 changed files with 12 additions and 37 deletions

View File

@ -54,37 +54,12 @@ public class RefMetaDataTracker {
else { else {
map = new HashMap<String, RODRecordList>(allBindings.size()); map = new HashMap<String, RODRecordList>(allBindings.size());
for ( RODRecordList rod : allBindings ) { for ( RODRecordList rod : allBindings ) {
//logger.debug(String.format("Binding %s to %s", name, rod));
if ( rod != null ) 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<GATKFeature> values = new ArrayList<GATKFeature>(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());
}
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
// //
// //