Limiting access to the DT classes

* Make most classes final, others package local
    * Move to diagnostics.diagnosetargets package
    * Aggregate statistics and walker classes on the same package for simplified visibility.
    * Make status list a LinkedList instead of a HashSet
This commit is contained in:
Mauricio Carneiro 2013-04-23 14:01:43 -04:00
parent fdd16dc6f9
commit 38662f1d47
21 changed files with 57 additions and 117 deletions

View File

@ -44,7 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics;
import org.broadinstitute.sting.commandline.Argument; import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output; import org.broadinstitute.sting.commandline.Output;

View File

@ -44,7 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics;
import org.broadinstitute.sting.commandline.Argument; import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output; import org.broadinstitute.sting.commandline.Output;

View File

@ -44,7 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
/** /**
* Short one line description of the walker. * Short one line description of the walker.
@ -52,7 +52,7 @@ package org.broadinstitute.sting.gatk.walkers.diagnostics.targets;
* @author Mauricio Carneiro * @author Mauricio Carneiro
* @since 2/1/12 * @since 2/1/12
*/ */
public enum CallableStatus { enum CallableStatus {
PASS("the base satisfied the min. depth for calling but had less than maxDepth to avoid having EXCESSIVE_COVERAGE"), PASS("the base satisfied the min. depth for calling but had less than maxDepth to avoid having EXCESSIVE_COVERAGE"),

View File

@ -44,7 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import net.sf.picard.util.PeekableIterator; import net.sf.picard.util.PeekableIterator;
import org.broadinstitute.sting.commandline.ArgumentCollection; import org.broadinstitute.sting.commandline.ArgumentCollection;
@ -54,9 +54,6 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*; import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Interval;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Locus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Sample;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.SampleUtils; import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.classloader.PluginManager; import org.broadinstitute.sting.utils.classloader.PluginManager;
@ -259,7 +256,7 @@ public class DiagnoseTargets extends LocusWalker<Long, Long> {
VariantContextBuilder vcb = new VariantContextBuilder("DiagnoseTargets", interval.getContig(), interval.getStart(), interval.getStop(), alleles); VariantContextBuilder vcb = new VariantContextBuilder("DiagnoseTargets", interval.getContig(), interval.getStart(), interval.getStop(), alleles);
vcb = vcb.log10PError(VariantContext.NO_LOG10_PERROR); vcb = vcb.log10PError(VariantContext.NO_LOG10_PERROR);
vcb.filters(new HashSet<String>(statusesToStrings(stats.callableStatuses(), true))); vcb.filters(new LinkedHashSet<String>(statusToStrings(stats.callableStatuses(), true)));
attributes.put(VCFConstants.END_KEY, interval.getStop()); attributes.put(VCFConstants.END_KEY, interval.getStop());
attributes.put(AVG_INTERVAL_DP_KEY, stats.averageCoverage()); attributes.put(AVG_INTERVAL_DP_KEY, stats.averageCoverage());
@ -268,10 +265,10 @@ public class DiagnoseTargets extends LocusWalker<Long, Long> {
for (String sample : samples) { for (String sample : samples) {
final GenotypeBuilder gb = new GenotypeBuilder(sample); final GenotypeBuilder gb = new GenotypeBuilder(sample);
SampleStatistics sampleStat = stats.getSampleStatics(sample); SampleStatistics sampleStat = stats.getSampleStatistics(sample);
gb.attribute(AVG_INTERVAL_DP_KEY, sampleStat.averageCoverage()); gb.attribute(AVG_INTERVAL_DP_KEY, sampleStat.averageCoverage());
gb.filters(statusesToStrings(stats.getSampleStatics(sample).getCallableStatuses(), false)); gb.filters(statusToStrings(stats.getSampleStatistics(sample).callableStatuses(), false));
genotypes.add(gb.make()); genotypes.add(gb.make());
} }
@ -286,7 +283,7 @@ public class DiagnoseTargets extends LocusWalker<Long, Long> {
* @param statuses the set of statuses to be converted * @param statuses the set of statuses to be converted
* @return a matching set of strings * @return a matching set of strings
*/ */
private List<String> statusesToStrings(Set<CallableStatus> statuses, final boolean isInfoField) { private List<String> statusToStrings(List<CallableStatus> statuses, final boolean isInfoField) {
List<String> output = new ArrayList<String>(statuses.size()); List<String> output = new ArrayList<String>(statuses.size());
for (CallableStatus status : statuses) for (CallableStatus status : statuses)

View File

@ -44,11 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.IntervalStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -57,7 +53,7 @@ import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
* Time: 11:30 PM * Time: 11:30 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public interface Interval { interface Interval {
public void initialize(ThresHolder thresholds); public void initialize(ThresHolder thresholds);
public CallableStatus status (IntervalStatistics intervalStatistics); public CallableStatus status (IntervalStatistics intervalStatistics);
} }

View File

@ -44,21 +44,16 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Interval;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import java.util.HashMap; import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class IntervalStatistics {
final class IntervalStatistics {
private final Map<String, SampleStatistics> samples; private final Map<String, SampleStatistics> samples;
private final GenomeLoc interval; private final GenomeLoc interval;
private final ThresHolder thresholds; private final ThresHolder thresholds;
@ -73,7 +68,7 @@ public class IntervalStatistics {
this.samples.put(sample, new SampleStatistics(interval, thresholds)); this.samples.put(sample, new SampleStatistics(interval, thresholds));
} }
public SampleStatistics getSampleStatics(String sample) { public SampleStatistics getSampleStatistics(String sample) {
return samples.get(sample); return samples.get(sample);
} }
@ -126,13 +121,13 @@ public class IntervalStatistics {
* *
* @return the callable status(es) for the whole interval * @return the callable status(es) for the whole interval
*/ */
public Set<CallableStatus> callableStatuses() { public List<CallableStatus> callableStatuses() {
final Set<CallableStatus> output = new HashSet<CallableStatus>(); final List<CallableStatus> output = new LinkedList<CallableStatus>();
// sum up all the callable status for each sample // sum up all the callable status for each sample
final Map<CallableStatus, Integer> sampleStatusTally = new HashMap<CallableStatus, Integer>(CallableStatus.values().length); final Map<CallableStatus, Integer> sampleStatusTally = new HashMap<CallableStatus, Integer>(CallableStatus.values().length);
for (SampleStatistics sampleStatistics : samples.values()) { for (SampleStatistics sampleStatistics : samples.values()) {
for (CallableStatus status : sampleStatistics.getCallableStatuses()) { for (CallableStatus status : sampleStatistics.callableStatuses()) {
sampleStatusTally.put(status, !sampleStatusTally.containsKey(status) ? 1 : sampleStatusTally.get(status) + 1); sampleStatusTally.put(status, !sampleStatusTally.containsKey(status) ? 1 : sampleStatusTally.get(status) + 1);
} }
} }

View File

@ -44,12 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.LocusStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -58,7 +53,7 @@ import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
* Time: 11:29 PM * Time: 11:29 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public interface Locus { interface Locus {
public void initialize(ThresHolder thresholds); public void initialize(ThresHolder thresholds);
public CallableStatus status (LocusStatistics locusStatistics); public CallableStatus status (LocusStatistics locusStatistics);
public CallableStatus sampleStatus (SampleStatistics sampleStatistics); public CallableStatus sampleStatus (SampleStatistics sampleStatistics);

View File

@ -44,19 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.LocusStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class LocusCoverageGap implements Locus { final class LocusCoverageGap implements Locus {
private double threshold; private double threshold;
private static final CallableStatus CALL = CallableStatus.COVERAGE_GAPS; private static final CallableStatus CALL = CallableStatus.COVERAGE_GAPS;

View File

@ -44,19 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.LocusStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class LocusExcessiveCoverage implements Locus { final class LocusExcessiveCoverage implements Locus {
private int excessiveCoverage; private int excessiveCoverage;
private double threshold; private double threshold;
private static final CallableStatus CALL = CallableStatus.EXCESSIVE_COVERAGE ; private static final CallableStatus CALL = CallableStatus.EXCESSIVE_COVERAGE ;

View File

@ -44,19 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.LocusStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class LocusLowCoverage implements Locus { final class LocusLowCoverage implements Locus {
private int minCoverage; private int minCoverage;
private double threshold; private double threshold;
private static final CallableStatus CALL = CallableStatus.LOW_COVERAGE ; private static final CallableStatus CALL = CallableStatus.LOW_COVERAGE ;

View File

@ -44,19 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.LocusStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class LocusPoorQuality implements Locus { final class LocusPoorQuality implements Locus {
private int minCoverage; private int minCoverage;
private double threshold; private double threshold;
private static final CallableStatus CALL = CallableStatus.POOR_QUALITY ; private static final CallableStatus CALL = CallableStatus.POOR_QUALITY ;

View File

@ -44,15 +44,12 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Locus; import java.util.LinkedList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
public class LocusStatistics { final class LocusStatistics {
private int coverage; private int coverage;
private int rawCoverage; private int rawCoverage;
private final List<Locus> locusStatisticsList; private final List<Locus> locusStatisticsList;
@ -80,8 +77,8 @@ public class LocusStatistics {
* *
* @return a set of all statuses that apply * @return a set of all statuses that apply
*/ */
public Set<CallableStatus> callableStatuses() { public List<CallableStatus> callableStatuses() {
Set<CallableStatus> output = new HashSet<CallableStatus>(); List<CallableStatus> output = new LinkedList<CallableStatus>();
for (Locus stats : locusStatisticsList) { for (Locus stats : locusStatisticsList) {
CallableStatus status = stats.status(this); CallableStatus status = stats.status(this);
if (status != null) { if (status != null) {

View File

@ -44,10 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import java.util.Map; import java.util.Map;
@ -56,7 +53,7 @@ import java.util.Map;
* Date: 4/21/13 * Date: 4/21/13
* Time: 11:23 AM * Time: 11:23 AM
*/ */
public class PluginUtils { final class PluginUtils {
public static CallableStatus genericSampleStatus (final SampleStatistics sampleStatistics, final CallableStatus CALL, final double threshold) { public static CallableStatus genericSampleStatus (final SampleStatistics sampleStatistics, final CallableStatus CALL, final double threshold) {
final Map<CallableStatus, Integer> totals = sampleStatistics.getLocusStatusTally(); final Map<CallableStatus, Integer> totals = sampleStatistics.getLocusStatusTally();
final int size = sampleStatistics.getIntervalSize(); final int size = sampleStatistics.getIntervalSize();

View File

@ -44,11 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -57,7 +53,7 @@ import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
* Time: 11:30 PM * Time: 11:30 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public interface Sample { interface Sample {
public void initialize(ThresHolder thresholds); public void initialize(ThresHolder thresholds);
public CallableStatus status (SampleStatistics sampleStatistics); public CallableStatus status (SampleStatistics sampleStatistics);
} }

View File

@ -44,18 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class SampleBadMates implements Sample { final class SampleBadMates implements Sample {
private static final CallableStatus CALL = CallableStatus.NO_READS ; private static final CallableStatus CALL = CallableStatus.NO_READS ;
private double threshold; private double threshold;

View File

@ -44,18 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.CallableStatus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.SampleStatistics;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.ThresHolder;
/** /**
* User: carneiro * User: carneiro
* Date: 4/20/13 * Date: 4/20/13
* Time: 11:44 PM * Time: 11:44 PM
*/ */
public class SampleNoReads implements Sample { final class SampleNoReads implements Sample {
private static final CallableStatus CALL = CallableStatus.NO_READS; private static final CallableStatus CALL = CallableStatus.NO_READS;
private double votingThreshold; private double votingThreshold;

View File

@ -44,10 +44,8 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Locus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Sample;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
@ -58,7 +56,7 @@ import java.util.*;
/** /**
* The statistics calculator for a specific sample given the interval * The statistics calculator for a specific sample given the interval
*/ */
public class SampleStatistics { final class SampleStatistics {
private final GenomeLoc interval; private final GenomeLoc interval;
private final ArrayList<LocusStatistics> loci; private final ArrayList<LocusStatistics> loci;
private final ThresHolder thresholds; private final ThresHolder thresholds;
@ -129,8 +127,8 @@ public class SampleStatistics {
* *
* @return the callable statuses of the entire sample * @return the callable statuses of the entire sample
*/ */
public Set<CallableStatus> getCallableStatuses() { public List<CallableStatus> callableStatuses() {
final Set<CallableStatus> output = new HashSet<CallableStatus>(); final List<CallableStatus> output = new LinkedList<CallableStatus>();
// get the tally of all the locus callable statuses // get the tally of all the locus callable statuses
for (Locus locusStat : thresholds.locusStatisticList) { for (Locus locusStat : thresholds.locusStatisticList) {

View File

@ -44,17 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.commandline.Argument; import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Interval;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Locus;
import org.broadinstitute.sting.gatk.walkers.diagnostics.targets.statistics.Sample;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
public class ThresHolder { final class ThresHolder {
/** /**
* Only bases with quality greater than this will be considered in the coverage metrics. * Only bases with quality greater than this will be considered in the coverage metrics.

View File

@ -44,7 +44,7 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics;
import org.broadinstitute.sting.WalkerTest; import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;

View File

@ -44,23 +44,23 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.WalkerTest; import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Arrays; import java.util.Arrays;
public class DiagnoseTargetsIntegrationTest extends WalkerTest { public class DiagnoseTargetsIntegrationTest extends WalkerTest {
final static String REF = b37KGReference; final static String REF = BaseTest.b37KGReference;
final String singleSample = validationDataLocation + "NA12878.HiSeq.b37.chr20.10_11mb.bam"; final String singleSample = BaseTest.validationDataLocation + "NA12878.HiSeq.b37.chr20.10_11mb.bam";
final String multiSample = validationDataLocation + "CEUTrio.HiSeq.b37.chr20.10_11mb.bam"; final String multiSample = BaseTest.validationDataLocation + "CEUTrio.HiSeq.b37.chr20.10_11mb.bam";
final String L = validationDataLocation + "DT-itest.interval_list"; final String L = BaseTest.validationDataLocation + "DT-itest.interval_list";
private void DTTest(String testName, String args, String md5) { private void DTTest(String testName, String args, String md5) {
String base = String.format("-T DiagnoseTargets --no_cmdline_in_header -R %s -L %s", REF, L) + " -o %s "; String base = String.format("-T DiagnoseTargets --no_cmdline_in_header -R %s -L %s", REF, L) + " -o %s ";
WalkerTestSpec spec = new WalkerTestSpec(base + args, Arrays.asList(md5)); WalkerTestSpec spec = new WalkerTestSpec(base + args, Arrays.asList(md5));
//spec.disableShadowBCF();
executeTest(testName, spec); executeTest(testName, spec);
} }

View File

@ -44,14 +44,14 @@
* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. * 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
*/ */
package org.broadinstitute.sting.gatk.walkers.diagnostics.targets; package org.broadinstitute.sting.gatk.walkers.diagnostics.diagnosetargets;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Set; import java.util.List;
public class LocusStatisticsUnitTest { public class LocusStatisticsUnitTest {
@ -64,7 +64,7 @@ public class LocusStatisticsUnitTest {
@Test(dataProvider = "StatusTestValues") @Test(dataProvider = "StatusTestValues")
public void testCallableStatuses(int coverage, int rawCoverage, CallableStatus status) { public void testCallableStatuses(int coverage, int rawCoverage, CallableStatus status) {
Set<CallableStatus> statuses = new LocusStatistics(coverage, rawCoverage, thresholds).callableStatuses(); List<CallableStatus> statuses = new LocusStatistics(coverage, rawCoverage, thresholds).callableStatuses();
Assert.assertTrue((status == null) ? statuses.isEmpty() : (statuses.contains(status) && statuses.size() == 1)); Assert.assertTrue((status == null) ? statuses.isEmpty() : (statuses.contains(status) && statuses.size() == 1));
} }