Added a convenience method in rodDbSNP to deal with Andrey's changes to the rod. Now you can just ask for the first real SNP rod from the list and not have to think about how it works.
CountCovariates uses it. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1688 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
6780476fb5
commit
0748d80baa
|
|
@ -386,4 +386,19 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V
|
|||
public boolean hasGenotype(DiploidGenotype x) {
|
||||
return (!x.toString().equals(this.getAltBasesFWD())) ? false : true;
|
||||
}
|
||||
|
||||
public static rodDbSNP getFirstRealSNP(RODRecordList<ReferenceOrderedDatum> dbsnpList) {
|
||||
if ( dbsnpList == null )
|
||||
return null;
|
||||
|
||||
rodDbSNP dbsnp = null;
|
||||
for ( ReferenceOrderedDatum d : dbsnpList ) {
|
||||
if ( ((rodDbSNP)d).isSNP() ) {
|
||||
dbsnp = (rodDbSNP)d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dbsnp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,11 +77,6 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
}
|
||||
|
||||
covariateCounter = new CovariateCounter(readGroups, collapsePos, collapseDinuc, assumeFaultyHeader);
|
||||
// THIS IS A HACK required in order to reproduce the behavior of old (and imperfect) RODIterator and
|
||||
// hence to pass the integration test. The new iterator this code is now using does see ALL the SNPs,
|
||||
// whether masked by overlapping indels/other events or not.
|
||||
//TODO process correctly all the returned dbSNP rods at each location
|
||||
BrokenRODSimulator.attach("dbSNP");
|
||||
logger.info(String.format("Created recalibration data collectors for %d read group(s)", covariateCounter.getNReadGroups()));
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +97,8 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
*/
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
||||
rodDbSNP dbsnp = (rodDbSNP)BrokenRODSimulator.simulate_lookup("dbSNP",ref.getLocus(),tracker);
|
||||
rodDbSNP dbsnp = rodDbSNP.getFirstRealSNP(tracker.getTrackData("dbsnp", null));
|
||||
|
||||
// long testpos = 10410913 ;
|
||||
// if ( ref.getLocus().getStart() == testpos ) {
|
||||
// System.out.println(rods.size()+" rods:");
|
||||
|
|
@ -110,9 +106,7 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
// System.exit(1);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
if ( dbsnp == null || !dbsnp.isSNP() ) {
|
||||
if ( dbsnp == null ) {
|
||||
// We aren't at a dbSNP position that's a SNP, so update the read
|
||||
|
||||
// if ( ref.getLocus().getStart() == testpos) System.out.println("NOT A SNP INDEED");
|
||||
|
|
|
|||
Loading…
Reference in New Issue