Continuing progress towards RodBinding 1.0

-- Cleaning up old interface to RMDT, docs and contracts added
-- Proper type checking for RodBinding for cases where the Tribble type isn't found or is the wrong type
This commit is contained in:
Mark DePristo 2011-08-03 17:19:28 -04:00
parent 800bb97f0b
commit 8f696c7731
21 changed files with 107 additions and 279 deletions

View File

@ -292,21 +292,33 @@ public class RefMetaDataTracker {
}
/**
* Helper function for getFirst() operations that takes a list of <T> and
* returns the first element, or null if no such element exists.
* Get all of the RMD tracks at the current site. Each track is returned as a single compound
* object (RODRecordList) that may contain multiple RMD records associated with the current site.
*
* @param l
* @param <T>
* @return
* @return List of all tracks
*/
@Requires({"l != null"})
final private <T extends Feature> T safeGetFirst(final List<T> l) {
return l.isEmpty() ? null : l.get(0);
public List<RODRecordList> getBoundRodTracks() {
return new ArrayList<RODRecordList>(map.values());
}
/**
* The number of tracks with at least one value bound here
* @return the number of tracks with at least one bound Feature
*/
public int getNTracksWithBoundFeatures() {
return map.size();
}
// ------------------------------------------------------------------------------------------
//
// Deprecated accessors -- will be removed
//
// old style accessors
//
// TODO -- DELETE ME
//
//
// ------------------------------------------------------------------------------------------
@Deprecated
public boolean hasValues(final String name) {
return map.containsKey(canonicalName(name));
@ -333,73 +345,27 @@ public class RefMetaDataTracker {
return safeGetFirst(getValues(type, name, onlyAtThisLoc));
}
/**
* Get all of the RMDs at the current site. The collection is "flattened": for any track that has multiple records
* at the current site, they all will be added to the list as separate elements.
*
* @return collection of all rods
*/
@Deprecated
public List<GATKFeature> getAllValuesAsGATKFeatures() {
List<GATKFeature> l = new ArrayList<GATKFeature>();
for ( RODRecordList rl : map.values() ) {
if ( rl != null )
l.addAll(rl);
}
return l;
}
// ------------------------------------------------------------------------------------------
//
//
// Private utility functions
//
//
// ------------------------------------------------------------------------------------------
/**
* Get all of the RMD tracks at the current site. Each track is returned as a single compound
* object (RODRecordList) that may contain multiple RMD records associated with the current site.
* Helper function for getFirst() operations that takes a list of <T> and
* returns the first element, or null if no such element exists.
*
* @return List of all tracks
*/
public List<RODRecordList> getBoundRodTracks() {
return new ArrayList<RODRecordList>(map.values());
}
/**
* The number of tracks with at least one value bound here
* @param l
* @param <T>
* @return
*/
public int getNumberOfTracksWithValue() {
int n = 0;
for ( RODRecordList value : map.values() ) {
if ( ! value.isEmpty() ) {
n++;
}
}
return n;
@Requires({"l != null"})
final private <T extends Feature> T safeGetFirst(final List<T> l) {
return l.isEmpty() ? null : l.get(0);
}
// ------------------------------------------------------------------------------------------
//
//
// old style Generic accessors
//
// TODO -- DELETE ME
//
//
// ------------------------------------------------------------------------------------------
/**
* No-assumption version of getValues(name, class). Returns Objects.
*/
@Deprecated
public List<Object> getValues(final String name) {
return (List<Object>)(List)getValues(Feature.class, name);
}
// ------------------------------------------------------------------------------------------
//
//
// VariantContext helpers
//
//
// ------------------------------------------------------------------------------------------
private <T extends Feature> List<T> addValues(final Collection<String> names,
final Class<T> type,
List<T> values,

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.refdata.features;
import net.sf.samtools.util.SequenceUtil;
import org.broad.tribble.Feature;
import org.broad.tribble.annotation.Strand;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broadinstitute.sting.utils.Utils;
@ -58,12 +59,12 @@ public class DbSNPHelper {
return dbsnp;
}
public static String rsIDOfFirstRealSNP(List<Object> featureList) {
public static String rsIDOfFirstRealSNP(List<Feature> featureList) {
if (featureList == null)
return null;
String rsID = null;
for ( Object d : featureList ) {
for ( Feature d : featureList ) {
if ( d instanceof DbSNPFeature ) {
if ( DbSNPHelper.isSNP((DbSNPFeature)d) ) {
rsID = ((DbSNPFeature)d).getRsID();
@ -80,12 +81,12 @@ public class DbSNPHelper {
return rsID;
}
public static String rsIDOfFirstRealIndel(List<Object> featureList) {
public static String rsIDOfFirstRealIndel(List<Feature> featureList) {
if (featureList == null)
return null;
String rsID = null;
for ( Object d : featureList ) {
for ( Feature d : featureList ) {
if ( d instanceof DbSNPFeature ) {
if ( DbSNPHelper.isIndel((DbSNPFeature) d) ) {
rsID = ((DbSNPFeature)d).getRsID();

View File

@ -39,6 +39,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet.RMDStorageType;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.SequenceDictionaryUtils;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.classloader.PluginManager;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -133,7 +134,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
HashMap classToRecord = new HashMap<String, Class>();
for (String name: this.getPluginsByName().keySet()) {
FeatureCodec codec = this.createByName(name);
classToRecord.put(name, codec.getFeatureType());
classToRecord.put(name.toUpperCase(), codec.getFeatureType());
}
return classToRecord;
}
@ -142,10 +143,25 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
return getAvailableTrackNamesAndTypes().get(fileDescriptor.getType().toUpperCase());
}
/**
* Returns the FeatureClass (BeagleFeature) produced by an RMDTriplet, or null
* if no such binding is found
*
* @param fileDescriptor
* @return
*/
public Class getFeatureClass(RMDTriplet fileDescriptor) {
return getAvailableTrackNamesAndRecordTypes().get(fileDescriptor.getType().toUpperCase());
}
/**
* Returns a list of the available tribble track names (vcf,dbsnp,etc) that we can load
* @return
*/
public String getAvailableTribbleFeatureNames() {
return Utils.join(",", getAvailableTrackNamesAndRecordTypes().keySet());
}
/**
* create a RMDTrack of the specified type
*

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@ -61,11 +62,8 @@ public class PrintRODsWalker extends RodWalker<Integer, Integer> {
if ( tracker == null )
return 0;
Iterator<GATKFeature> rods = tracker.getAllValuesAsGATKFeatures().iterator();
while ( rods.hasNext() ) {
Object rod = rods.next().getUnderlyingObject();
if (VariantContextAdaptors.canBeConvertedToVariantContext(rod) )
out.println(rod.toString());
for ( Feature feature : tracker.getValues(Feature.class) ) {
out.println(feature.toString());
}
return 1;

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@ -154,9 +155,9 @@ public class VariantAnnotatorEngine {
String rsID = null;
if (vc.isSNP())
rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(Feature.class, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
else if (vc.isIndel())
rsID = DbSNPHelper.rsIDOfFirstRealIndel(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
rsID = DbSNPHelper.rsIDOfFirstRealIndel(tracker.getValues(Feature.class, 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

@ -22,6 +22,7 @@
package org.broadinstitute.sting.gatk.walkers.coverage;
import org.broad.tribble.Feature;
import org.broad.tribble.bed.FullBEDFeature;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
@ -92,7 +93,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.getValues(track);
List<Feature> bindings = tracker.getValues(Feature.class, 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

@ -116,12 +116,8 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
if ( genotypeFilterExps.size() > 0 )
hInfo.add(new VCFFormatHeaderLine(VCFConstants.GENOTYPE_FILTER_KEY, 1, VCFHeaderLineType.String, "Genotype-level filter"));
List<ReferenceOrderedDataSource> dataSources = getToolkit().getRodDataSources();
for ( ReferenceOrderedDataSource source : dataSources ) {
if ( source.getName().equals("mask") ) {
hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Overlaps a user-input mask"));
break;
}
if ( mask.isBound() ) {
hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Overlaps a user-input mask"));
}
writer.writeHeader(new VCFHeader(hInfo, SampleUtils.getUniqueSamplesFromRods(getToolkit(), inputNames)));

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.qc;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@ -36,7 +37,7 @@ public class CountIntervals extends RefWalker<Long, Long> {
return null;
}
List<Object> checkIntervals = tracker.getValues("check");
List<Feature> checkIntervals = tracker.getValues(Feature.class, "check");
return (long) checkIntervals.size();
}

View File

@ -1,155 +0,0 @@
package org.broadinstitute.sting.gatk.walkers.qc;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.walkers.Reference;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.Window;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.io.*;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;
import java.util.List;
/**
* a walker for validating (in the style of validating pile-up) the ROD system.
*/
@Reference(window=@Window(start=-40,stop=40))
public class RodSystemValidationWalker extends RodWalker<Integer,Integer> {
// the divider to use in some of the text output
private static final String DIVIDER = ",";
@Output
public PrintStream out;
@Argument(fullName="PerLocusEqual",required=false,doc="Should we check that all records at the same site produce equivilent variant contexts")
public boolean allRecordsVariantContextEquivalent = false;
// used to calculate the MD5 of a file
MessageDigest digest = null;
// we sometimes need to know what rods the engine's seen
List<ReferenceOrderedDataSource> rodList;
/**
* emit the md5 sums for each of the input ROD files (will save up a lot of time if and when the ROD files change
* underneath us).
*/
public void initialize() {
// setup the MD5-er
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new ReviewedStingException("Unable to find MD5 checksumer");
}
out.println("Header:");
// enumerate the list of ROD's we've loaded
rodList = this.getToolkit().getRodDataSources();
for (ReferenceOrderedDataSource rod : rodList) {
out.println(rod.getName() + DIVIDER + rod.getType());
out.println(rod.getName() + DIVIDER + rod.getFile());
out.println(rod.getName() + DIVIDER + md5sum(rod.getFile()));
}
out.println("Data:");
}
/**
*
* @param tracker the ref meta data tracker to get RODs
* @param ref reference context
* @param context the reads
* @return an 1 for each site with a rod(s), 0 otherwise
*/
@Override
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
int ret = 0;
if (tracker != null && tracker.getAllValuesAsGATKFeatures().size() > 0) {
out.print(context.getLocation() + DIVIDER);
Collection<GATKFeature> features = tracker.getAllValuesAsGATKFeatures();
for (GATKFeature feat : features)
out.print(feat.getName() + DIVIDER);
out.println(";");
ret++;
}
// if the argument was set, check for equivalence
if (allRecordsVariantContextEquivalent && tracker != null) {
Collection<VariantContext> col = tracker.getValues(VariantContext.class);
VariantContext con = null;
for (VariantContext contextInList : col)
if (con == null) con = contextInList;
else if (!con.equals(col)) out.println("FAIL: context " + col + " doesn't match " + con);
}
return ret;
}
/**
* Provide an initial value for reduce computations.
*
* @return Initial value of reduce.
*/
@Override
public Integer reduceInit() {
return 0;
}
/**
* Reduces a single map with the accumulator provided as the ReduceType.
*
* @param value result of the map.
* @param sum accumulator for the reduce.
* @return accumulator with result of the map taken into account.
*/
@Override
public Integer reduce(Integer value, Integer sum) {
return value + sum;
}
@Override
public void onTraversalDone(Integer result) {
// Double check traversal result to make count is the same.
// TODO: Is this check necessary?
out.println("[REDUCE RESULT] Traversal result is: " + result);
}
// shamelessly absconded and adapted from http://www.javalobby.org/java/forums/t84420.html
private String md5sum(File f) {
InputStream is;
try {
is = new FileInputStream(f);
} catch (FileNotFoundException e) {
return "Not a file";
}
byte[] buffer = new byte[8192];
int read = 0;
try {
while ((read = is.read(buffer)) > 0) {
digest.update(buffer, 0, read);
}
byte[] md5sum = digest.digest();
BigInteger bigInt = new BigInteger(1, md5sum);
return bigInt.toString(16);
}
catch (IOException e) {
throw new RuntimeException("Unable to process file for MD5", e);
}
finally {
try {
is.close();
}
catch (IOException e) {
throw new RuntimeException("Unable to close input stream for MD5 calculation", e);
}
}
}
}

View File

@ -37,7 +37,6 @@ import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.filters.MappingQualityUnavailableReadFilter;
import org.broadinstitute.sting.gatk.filters.MappingQualityZeroReadFilter;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.Utils;
@ -291,15 +290,8 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
* @return Returns 1, but this value isn't used in the reduce step
*/
public CountedData map( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) {
// 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.getAllValuesAsGATKFeatures() ) {
if( rod != null ) {
isSNP = true;
break;
}
}
boolean isSNP = tracker.getNTracksWithBoundFeatures() > 0;
// Only use data from non-dbsnp sites
// Assume every mismatch at a non-dbsnp site is indicative of poor quality

View File

@ -25,6 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broad.tribble.Feature;
import org.broad.tribble.TribbleException;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broadinstitute.sting.commandline.Argument;
@ -140,7 +141,7 @@ public class ValidateVariants extends RodWalker<Integer, Integer> {
// get the RS IDs
Set<String> rsIDs = null;
if ( tracker.hasValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ) {
List<Object> dbsnpList = tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME);
List<Feature> dbsnpList = tracker.getValues(Feature.class, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME);
rsIDs = new HashSet<String>();
for ( Object d : dbsnpList ) {
if (d instanceof DbSNPFeature )

View File

@ -26,6 +26,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import net.sf.samtools.util.CloseableIterator;
import org.broad.tribble.Feature;
import org.broad.tribble.dbsnp.DbSNPCodec;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broadinstitute.sting.commandline.Argument;
@ -88,7 +89,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
if ( tracker == null || !BaseUtils.isRegularBase(ref.getBase()) )
return 0;
String rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
String rsID = DbSNPHelper.rsIDOfFirstRealSNP(tracker.getValues(Feature.class, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
Collection<VariantContext> contexts = getVariantContexts(tracker, ref);
@ -117,7 +118,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.getValues(variants.getName());
List<Feature> features = tracker.getValues(Feature.class, variants.getName());
if ( features.size() > 0 && features.get(0) instanceof HapMapFeature ) {
ArrayList<VariantContext> hapmapVCs = new ArrayList<VariantContext>(features.size());
for ( Object feature : features ) {
@ -223,7 +224,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variants.getName()));
if ( samples.isEmpty() ) {
List<Object> rods = tracker.getValues(variants.getName());
List<Feature> rods = tracker.getValues(Feature.class, variants.getName());
if ( rods.size() == 0 )
throw new IllegalStateException("No rod data is present");

View File

@ -87,6 +87,13 @@ public class UserException extends ReviewedStingException {
}
}
public static class UnknownTribbleType extends CommandLineException {
public UnknownTribbleType(String type, String message) {
super(String.format("Unknown tribble type %s: %s", type, message));
}
}
public static class BadTmpDir extends UserException {
public BadTmpDir(String message) {
super(String.format("Failure working with the tmp directory %s. Override with -Djava.io.tmpdir=X on the command line to a bigger/better file system. Exact error was %s", System.getProperties().get("java.io.tmpdir"), message));

View File

@ -154,7 +154,11 @@ public class ListFileUtils {
// validate triplet type
Class typeFromTribble = builderForValidation.getFeatureClass(triplet);
if ( typeFromTribble != null && ! rodBinding.getType().isAssignableFrom(typeFromTribble) )
if ( typeFromTribble == null )
throw new UserException.UnknownTribbleType(rodBinding.getTribbleType(),
String.format("Field %s had provided type %s but there's no such Tribble type. Available types are %s",
rodBinding.getName(), rodBinding.getTribbleType(), builderForValidation.getAvailableTribbleFeatureNames()));
if ( ! rodBinding.getType().isAssignableFrom(typeFromTribble) )
throw new UserException.BadArgumentValue(rodBinding.getName(),
String.format("Field %s expected type %s, but the type of the input file provided on the command line was %s",
rodBinding.getName(), rodBinding.getType(), typeFromTribble));

View File

@ -42,28 +42,27 @@ import java.util.List;
*
*/
public class EngineFeaturesIntegrationTest extends WalkerTest {
private void testBadRODBindingInput(String type, String name) {
private void testBadRODBindingInput(String type, String name, Class c) {
WalkerTestSpec spec = new WalkerTestSpec("-T SelectVariants -L 1:1 --variants:" + type + " "
+ b37dbSNP132 + " -R " + b37KGReference + " -o %s",
1, UserException.class);
1, c);
executeTest(name, spec);
}
@Test() private void testBadRODBindingInputType1() {
testBadRODBindingInput("beagle", "BEAGLE input to VCF expecting walker");
testBadRODBindingInput("beagle", "BEAGLE input to VCF expecting walker", UserException.BadArgumentValue.class);
}
@Test() private void testBadRODBindingInputType2() {
testBadRODBindingInput("vcf3", "VCF3 input to VCF expecting walker");
testBadRODBindingInput("vcf3", "VCF3 input to VCF expecting walker", UserException.class);
}
@Test() private void testBadRODBindingInputType3() {
testBadRODBindingInput("bed", "Bed input to VCF expecting walker");
testBadRODBindingInput("bed", "Bed input to VCF expecting walker", UserException.BadArgumentValue.class);
}
@Test() private void testBadRODBindingInputTypeUnknownType() {
testBadRODBindingInput("bedXXX", "Unknown input to VCF expecting walker");
testBadRODBindingInput("bedXXX", "Unknown input to VCF expecting walker", UserException.UnknownTribbleType.class);
}
}

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.broad.tribble.Feature;
import org.broadinstitute.sting.commandline.Tags;
import org.broadinstitute.sting.gatk.datasources.reads.MockLocusShard;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
@ -70,7 +71,7 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",10), null);
Assert.assertEquals(tracker.getAllValuesAsGATKFeatures().size(), 0, "The tracker should not have produced any data");
Assert.assertEquals(tracker.getValues(Feature.class).size(), 0, "The tracker should not have produced any data");
}
/**

View File

@ -27,8 +27,6 @@ package org.broadinstitute.sting.gatk.refdata;
import net.sf.samtools.SAMFileHeader;
import org.apache.log4j.Logger;
import org.broad.tribble.Feature;
import org.broad.tribble.dbsnp.DbSNPCodec;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.commandline.RodBinding;
import org.broadinstitute.sting.commandline.Tags;
@ -38,7 +36,6 @@ import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
@ -173,7 +170,7 @@ public class RefMetaDataTrackerUnitTest {
public void testRawBindings(MyTest test) {
logger.warn("Testing " + test + " for number of bound tracks");
RefMetaDataTracker tracker = test.makeTracker();
Assert.assertEquals(tracker.getNumberOfTracksWithValue(), test.nBoundTracks());
Assert.assertEquals(tracker.getNTracksWithBoundFeatures(), test.nBoundTracks());
testSimpleBindings("A", tracker, test.AValues);
testSimpleBindings("B", tracker, test.BValues);

View File

@ -26,7 +26,7 @@ public class FastaAlternateReferenceIntegrationTest extends WalkerTest {
WalkerTestSpec spec2 = new WalkerTestSpec(
"-T FastaAlternateReferenceMaker -R " + b36KGReference + " -B:indels,VCF " + validationDataLocation + "NA12878.chr1_10mb_11mb.slx.indels.vcf4 --snpmask:vcf " + GATKDataLocation + "dbsnp_132.b36.excluding_sites_after_129.vcf -L 1:10,075,000-10,075,380;1:10,093,447-10,093,847;1:10,271,252-10,271,452 -o %s",
1,
Arrays.asList("3a48986c3832a768b478c3e95f994b0f"));
Arrays.asList("0567b32ebdc26604ddf2a390de4579ac"));
executeTest("testFastaAlternateReferenceIndels", spec2);
// TODO : Eric, update with new DBSNP

View File

@ -14,13 +14,14 @@ public class PhaseByTransmissionIntegrationTest extends WalkerTest {
WalkerTestSpec spec = new WalkerTestSpec(
buildCommandLine(
"-T PhaseByTransmission",
"-NO_HEADER",
"-R " + b37KGReference,
"-B:variant,VCF " + fundamentalTestVCF,
"-f NA12892+NA12891=NA12878",
"-o %s"
),
1,
Arrays.asList("45fef0e23113e2fcd9570379e2fc1b75")
Arrays.asList("")
);
executeTest("testBasicFunctionality", spec);
}

View File

@ -18,7 +18,7 @@ public class ValidatingPileupIntegrationTest extends WalkerTest {
"-T ValidatingPileup" +
" -I " + validationDataLocation + "MV1994.selected.bam" +
" -R " + validationDataLocation + "Escherichia_coli_K12_MG1655.fasta" +
" -B:pileup,SAMPileup "+ validationDataLocation + "MV1994.selected.pileup" +
" --pileup:SAMPileup "+ validationDataLocation + "MV1994.selected.pileup" +
" -S SILENT -nt 8",0, Collections.<String>emptyList());
executeTest("testEcoliThreaded",spec);
}

View File

@ -19,8 +19,8 @@ public class ValidationAmpliconsIntegrationTest extends WalkerTest {
String siteVCF = validationDataLocation + "sites_to_validate.vcf";
String maskVCF = validationDataLocation + "amplicon_mask_sites.vcf";
String intervalTable = validationDataLocation + "amplicon_interval_table1.table";
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons -B:ValidateAlleles,VCF "+siteVCF+" -o %s";
testArgs += " -B:ProbeIntervals,table "+intervalTable+" -BTI ProbeIntervals -B:MaskAlleles,VCF "+maskVCF;
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons --ValidateAlleles:VCF "+siteVCF+" -o %s";
testArgs += " --ProbeIntervals:table "+intervalTable+" -BTI ProbeIntervals --MaskAlleles:VCF "+maskVCF;
testArgs += " --virtualPrimerSize 30";
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
Arrays.asList("27f9450afa132888a8994167f0035fd7"));
@ -32,8 +32,8 @@ public class ValidationAmpliconsIntegrationTest extends WalkerTest {
String siteVCF = validationDataLocation + "sites_to_validate.vcf";
String maskVCF = validationDataLocation + "amplicon_mask_sites.vcf";
String intervalTable = validationDataLocation + "amplicon_interval_table1.table";
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons -B:ValidateAlleles,VCF "+siteVCF+" -o %s";
testArgs += " -B:ProbeIntervals,table "+intervalTable+" -BTI ProbeIntervals -B:MaskAlleles,VCF "+maskVCF;
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons --ValidateAlleles:VCF "+siteVCF+" -o %s";
testArgs += " --ProbeIntervals:table "+intervalTable+" -BTI ProbeIntervals --MaskAlleles:VCF "+maskVCF;
testArgs += " --virtualPrimerSize 30 --doNotUseBWA";
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
Arrays.asList("f2611ff1d9cd5bedaad003251fed8bc1"));
@ -45,8 +45,8 @@ public class ValidationAmpliconsIntegrationTest extends WalkerTest {
String siteVCF = validationDataLocation + "sites_to_validate.vcf";
String maskVCF = validationDataLocation + "amplicon_mask_sites.vcf";
String intervalTable = validationDataLocation + "amplicon_interval_table1.table";
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons -B:ValidateAlleles,VCF "+siteVCF+" -o %s";
testArgs += " -B:ProbeIntervals,table "+intervalTable+" -BTI ProbeIntervals -B:MaskAlleles,VCF "+maskVCF;
String testArgs = "-R " + b37KGReference + " -T ValidationAmplicons --ValidateAlleles:VCF "+siteVCF+" -o %s";
testArgs += " --ProbeIntervals:table "+intervalTable+" -BTI ProbeIntervals --MaskAlleles:VCF "+maskVCF;
testArgs += " --virtualPrimerSize 30 --filterMonomorphic";
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
Arrays.asList("77b3f30e38fedad812125bdf6cf3255f"));