Use new optimized ReadBackedPileup
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2184 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
d8146ab23d
commit
e9a8156cfb
|
|
@ -12,12 +12,8 @@ import java.util.List;
|
|||
public class SpanningDeletions extends StandardVariantAnnotation {
|
||||
|
||||
public Pair<String, String> annotate(ReferenceContext ref, ReadBackedPileup pileup, Variation variation, List<Genotype> genotypes) {
|
||||
int deletions = 0;
|
||||
for (Integer offset : pileup.getOffsets() ) {
|
||||
if ( offset == -1 )
|
||||
deletions++;
|
||||
}
|
||||
return new Pair<String, String>("SpanningDeletionFraction", String.format("%.2f", (double)deletions/(double)pileup.getReads().size()));
|
||||
int deletions = pileup.getNumberOfDeletions();
|
||||
return new Pair<String, String>("SpanningDeletionFraction", String.format("%.2f", (double)deletions/(double)pileup.size()));
|
||||
}
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.pileup.*;
|
||||
import org.broadinstitute.sting.utils.genotype.*;
|
||||
import org.broadinstitute.sting.utils.genotype.Variation.VARIANT_TYPE;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
|
|
@ -10,8 +11,6 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
|||
import java.util.*;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
|
||||
public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalculationModel {
|
||||
|
||||
// because the null allele frequencies are constant for a given N,
|
||||
|
|
@ -77,19 +76,16 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
|
|||
int[] qualCounts = new int[4];
|
||||
|
||||
// calculate the sum of quality scores for each base
|
||||
List<SAMRecord> reads = context.getReads();
|
||||
List<Integer> offsets = context.getOffsets();
|
||||
for (int i = 0; i < reads.size(); i++) {
|
||||
int offset = offsets.get(i);
|
||||
ReadBackedPileup pileup = context.getPileup();
|
||||
for ( PileupElement p : pileup ) {
|
||||
byte base = p.getBase();
|
||||
// ignore deletions
|
||||
if ( offset == -1 )
|
||||
if ( base == PileupElement.DELETION_BASE )
|
||||
continue;
|
||||
|
||||
SAMRecord read = reads.get(i);
|
||||
char base = (char)read.getReadBases()[offset];
|
||||
int index = BaseUtils.simpleBaseToBaseIndex(base);
|
||||
int index = BaseUtils.simpleBaseToBaseIndex((char)base);
|
||||
if ( index >= 0 )
|
||||
qualCounts[index] += read.getBaseQualities()[offset];
|
||||
qualCounts[index] += p.getQual();
|
||||
}
|
||||
|
||||
// set the non-ref base with maximum quality score sum
|
||||
|
|
|
|||
Loading…
Reference in New Issue