Moved some more walkers to oneoffprojects and killed an old indel-related walker that isn't being used.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2228 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
dec0a781c2
commit
a09fee2b5e
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.playground.gatk.walkers;
|
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.playground.gatk.walkers;
|
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.playground.gatk.walkers;
|
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.playground.gatk.walkers;
|
package org.broadinstitute.sting.oneoffprojects.walkers;
|
||||||
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
import org.broadinstitute.sting.utils.cmdLine.Argument;
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
package org.broadinstitute.sting.playground.gatk.walkers.indels;
|
|
||||||
|
|
||||||
import net.sf.samtools.*;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.*;
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
|
||||||
import org.broadinstitute.sting.utils.*;
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.WalkerName;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@WalkerName("CoverageGapIntervals")
|
|
||||||
public class CoverageGapIntervalWalker extends LocusWalker<Pair<GenomeLoc, Integer>, GenomeLoc> {
|
|
||||||
|
|
||||||
private final int minReadsAtInterval = 10;
|
|
||||||
|
|
||||||
public void initialize() {}
|
|
||||||
|
|
||||||
public boolean filter(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
|
||||||
int goodReads = 0;
|
|
||||||
List<SAMRecord> reads = context.getReads();
|
|
||||||
for (int i = 0; i < reads.size(); i++ ) {
|
|
||||||
if ( reads.get(i).getMappingQuality() > 0 )
|
|
||||||
goodReads++;
|
|
||||||
}
|
|
||||||
return goodReads >= minReadsAtInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pair<GenomeLoc, Integer> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
|
||||||
// find the probability that this locus has a statistically significant gap in coverage
|
|
||||||
List<SAMRecord> reads = context.getReads();
|
|
||||||
List<Integer> offsets = context.getOffsets();
|
|
||||||
int totalXi = 0;
|
|
||||||
for (int i = 0; i < reads.size(); i++ ) {
|
|
||||||
SAMRecord read = reads.get(i);
|
|
||||||
if ( read.getMappingQuality() == 0 )
|
|
||||||
continue;
|
|
||||||
int halfLength = read.getReadString().length() >> 1;
|
|
||||||
int distanceFromMiddle = Math.abs(offsets.get(i) - halfLength);
|
|
||||||
int quarterLength = halfLength >> 1;
|
|
||||||
|
|
||||||
// Xi is < 0 if you are closer to the middle than the quartile
|
|
||||||
// and is > 0 if further to the middle than quartile
|
|
||||||
// We expect the total sum of Xi over an interval to be ~0
|
|
||||||
int Xi = distanceFromMiddle - quarterLength;
|
|
||||||
totalXi += Xi;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Pair<GenomeLoc, Integer>(context.getLocation(), totalXi);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTraversalDone() {}
|
|
||||||
|
|
||||||
public GenomeLoc reduceInit() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenomeLoc reduce(Pair<GenomeLoc, Integer> value, GenomeLoc sum) {
|
|
||||||
if ( value.second > 1000 ) {
|
|
||||||
if ( sum != null )
|
|
||||||
sum = GenomeLocParser.setStop(sum,value.first.getStop());
|
|
||||||
else
|
|
||||||
sum = value.first;
|
|
||||||
} else if ( sum != null ) {
|
|
||||||
out.println(sum);
|
|
||||||
sum = null;
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue