Renamed FragmentPileup to FragmentUtils

This commit is contained in:
Mark DePristo 2011-10-26 14:01:45 -04:00
parent 751d66174a
commit 7fa943aef1
4 changed files with 17 additions and 16 deletions

View File

@ -27,10 +27,10 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
import net.sf.samtools.SAMUtils;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.FragmentUtils;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.pileup.FragmentPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
@ -259,12 +259,12 @@ public class DiploidSNPGenotypeLikelihoods implements Cloneable {
int n = 0;
// for each fragment, add to the likelihoods
FragmentPileup fpile = new FragmentPileup(pileup);
FragmentUtils fpile = new FragmentUtils(pileup);
for ( PileupElement p : fpile.getOneReadPileup() )
n += add(p, ignoreBadBases, capBaseQualsAtMappingQual, minBaseQual);
for ( FragmentPileup.TwoReadPileupElement twoRead : fpile.getTwoReadPileup() )
for ( FragmentUtils.TwoReadPileupElement twoRead : fpile.getTwoReadPileup() )
n += add(twoRead, ignoreBadBases, capBaseQualsAtMappingQual, minBaseQual);
return n;
@ -286,7 +286,7 @@ public class DiploidSNPGenotypeLikelihoods implements Cloneable {
}
}
public int add(FragmentPileup.TwoReadPileupElement twoRead, boolean ignoreBadBases, boolean capBaseQualsAtMappingQual, int minBaseQual) {
public int add(FragmentUtils.TwoReadPileupElement twoRead, boolean ignoreBadBases, boolean capBaseQualsAtMappingQual, int minBaseQual) {
final byte observedBase1 = twoRead.getFirst().getBase();
final byte qualityScore1 = qualToUse(twoRead.getFirst(), ignoreBadBases, capBaseQualsAtMappingQual, minBaseQual);
final byte observedBase2 = twoRead.getSecond().getBase();

View File

@ -1,6 +1,8 @@
package org.broadinstitute.sting.utils.pileup;
package org.broadinstitute.sting.utils;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
import org.broadinstitute.sting.utils.sam.ReadUtils;
@ -23,7 +25,7 @@ import java.util.*;
* Date: 3/26/11
* Time: 10:09 PM
*/
public class FragmentPileup {
public class FragmentUtils {
Collection<PileupElement> oneReadPile = null;
Collection<TwoReadPileupElement> twoReadPile = null;
@ -36,12 +38,12 @@ public class FragmentPileup {
* Create a new Fragment-based pileup from the standard read-based pileup
* @param pileup
*/
public FragmentPileup(ReadBackedPileup pileup) {
public FragmentUtils(ReadBackedPileup pileup) {
skipNonOverlapping(pileup);
}
/** For performance testing only */
protected FragmentPileup(ReadBackedPileup pileup, FragmentMatchingAlgorithm algorithm) {
protected FragmentUtils(ReadBackedPileup pileup, FragmentMatchingAlgorithm algorithm) {
switch ( algorithm ) {
case ORIGINAL: oldSlowCalculation(pileup); break;
case skipNonOverlapping: skipNonOverlapping(pileup); break;

View File

@ -28,7 +28,7 @@ import com.google.caliper.Param;
import com.google.caliper.SimpleBenchmark;
import com.google.caliper.runner.CaliperMain;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.utils.FragmentUtils;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
@ -62,20 +62,20 @@ public class FragmentPileupBenchmark extends SimpleBenchmark {
}
}
private void run(int rep, FragmentPileup.FragmentMatchingAlgorithm algorithm) {
private void run(int rep, FragmentUtils.FragmentMatchingAlgorithm algorithm) {
int nFrags = 0;
for ( int i = 0; i < rep; i++ ) {
for ( ReadBackedPileup rbp : pileups )
nFrags += new FragmentPileup(rbp, algorithm).getTwoReadPileup().size();
nFrags += new FragmentUtils(rbp, algorithm).getTwoReadPileup().size();
}
}
public void timeOriginal(int rep) {
run(rep, FragmentPileup.FragmentMatchingAlgorithm.ORIGINAL);
run(rep, FragmentUtils.FragmentMatchingAlgorithm.ORIGINAL);
}
public void timeSkipNonOverlapping(int rep) {
run(rep, FragmentPileup.FragmentMatchingAlgorithm.skipNonOverlapping);
run(rep, FragmentUtils.FragmentMatchingAlgorithm.skipNonOverlapping);
}
public static void main(String[] args) {

View File

@ -25,10 +25,9 @@
package org.broadinstitute.sting.utils.pileup;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.FragmentUtils;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
@ -113,7 +112,7 @@ public class FragmentPileupUnitTest extends BaseTest {
public void testMe(FragmentPileupTest test) {
for ( TestState testState : test.states ) {
ReadBackedPileup rbp = testState.pileup;
FragmentPileup fp = new FragmentPileup(rbp);
FragmentUtils fp = new FragmentUtils(rbp);
Assert.assertEquals(fp.getTwoReadPileup().size(), testState.shouldBeFragment ? 1 : 0);
Assert.assertEquals(fp.getOneReadPileup().size(), testState.shouldBeFragment ? 0 : 1);
}