Fixed ValidatingPileup to work with Andrey's new rodSAMPileup -> GenotypeList type hierarchy.
Fixed reference-ordered data validation system to validate class hierarchies instead of specific class types. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@811 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
d056f9f3e8
commit
008d677bea
|
|
@ -140,14 +140,15 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
public String getName() { return name; }
|
||||
|
||||
/**
|
||||
* Special equals override to see if this ROD is of type name, type.
|
||||
* Implemented to preserve data hiding whenever possible.
|
||||
* Special equals override to see if this ROD is compatible with the given
|
||||
* name and type. 'Compatible' means that this ROD has the name that's passed
|
||||
* in and its data can fit into the container specified by type.
|
||||
* @param name Name to check.
|
||||
* @param type Type to check.
|
||||
* @return True if these parameters imply this rod. False otherwise.
|
||||
*/
|
||||
public boolean matches( String name, Class<? extends ReferenceOrderedDatum> type ) {
|
||||
return this.name.equals(name) && this.type.equals(type);
|
||||
return this.name.equals(name) && type.isAssignableFrom(this.type);
|
||||
}
|
||||
|
||||
public RODIterator iterator() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
|||
|
||||
public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
|
||||
Pileup pileup = new ReadBackedPileup(ref, context);
|
||||
Pileup truePileup = (Pileup)tracker.lookup("pileup", null);
|
||||
Pileup truePileup = getTruePileup( tracker );
|
||||
|
||||
if ( truePileup == null ) {
|
||||
System.out.printf("No truth pileup data available at %s%n", pileup.getPileupString());
|
||||
|
|
@ -59,6 +59,22 @@ public class ValidatingPileupWalker extends LocusWalker<Integer, ValidationStats
|
|||
combined.nBases = lhs.nBases + rhs.nBases;
|
||||
return combined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the true pileup data from the given rodSAMPileup. Note that this implementation
|
||||
* assumes that the genotype will only be point or indel.
|
||||
* @param tracker ROD tracker from which to extract pileup data.
|
||||
* @return True pileup data.
|
||||
*/
|
||||
private Pileup getTruePileup( RefMetaDataTracker tracker ) {
|
||||
rodSAMPileup pileup = (rodSAMPileup)tracker.lookup("pileup", null);
|
||||
if( pileup.hasPointGenotype() )
|
||||
return (Pileup)pileup.getPointGenotype();
|
||||
else if( pileup.hasIndelGenotype() )
|
||||
return (Pileup)pileup.getIndelGenotype();
|
||||
else
|
||||
throw new StingException("Unsupported pileup type: " + pileup);
|
||||
}
|
||||
}
|
||||
|
||||
class ValidationStats {
|
||||
|
|
|
|||
Loading…
Reference in New Issue