Skip to content

Commit

Permalink
more to come
Browse files Browse the repository at this point in the history
  • Loading branch information
takutosato committed Mar 14, 2019
1 parent b3eac71 commit 5ca8d0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import htsjdk.samtools.util.Histogram;
import org.broadinstitute.barclay.argparser.Argument;
import org.broadinstitute.barclay.argparser.CommandLineProgramProperties;
import org.broadinstitute.hellbender.cmdline.programgroups.ShortVariantDiscoveryProgramGroup;
import org.broadinstitute.hellbender.cmdline.programgroups.CoverageAnalysisProgramGroup;
import org.broadinstitute.hellbender.engine.*;
import org.broadinstitute.hellbender.engine.filters.ReadFilter;
import org.broadinstitute.hellbender.exceptions.UserException;
Expand Down Expand Up @@ -44,16 +44,13 @@
@CommandLineProgramProperties(
summary = "Collect F1R2 read counts for the Mutect2 orientation bias mixture model filter",
oneLineSummary = "Collect F1R2 read counts for the Mutect2 orientation bias mixture model filter",
programGroup = ShortVariantDiscoveryProgramGroup.class
programGroup = CoverageAnalysisProgramGroup.class
)

public class CollectF1R2Counts extends LocusWalker {
public static final String ALT_DATA_TABLE_LONG_NAME = "alt-table";
public static final String ALT_DATA_TABLE_SHORT_NAME = "at";
public static final String ALT_DEPTH1_HISTOGRAM_LONG_NAME = "alt-hist";
public static final String ALT_DEPTH1_HISTOGRAM_SHORT_NAME = "ah";
public static final String REF_SITE_METRICS_LONG_NAME = "ref-hist";
public static final String REF_SITE_METRICS_SHORT_NAME = "rh";
public static final String MIN_MEDIAN_MQ_LONG_NAME = "median-mq";
public static final String MIN_BASE_QUALITY_LONG_NAME = "min-bq";
public static final String MAX_DEPTH_LONG_NAME = "max-depth";
Expand All @@ -64,13 +61,13 @@ public class CollectF1R2Counts extends LocusWalker {
@Argument(fullName = MIN_BASE_QUALITY_LONG_NAME, doc = "exclude bases below this quality from pileup", optional = true)
private int MINIMUM_BASE_QUALITY = 20;

@Argument(shortName = ALT_DATA_TABLE_SHORT_NAME, fullName = ALT_DATA_TABLE_LONG_NAME, doc = "a tab-separated output table of pileup data over alt sites")
@Argument(fullName = ALT_DATA_TABLE_LONG_NAME, doc = "a tab-separated output table of pileup data over alt sites")
private File altDataTable = null;

@Argument(shortName = REF_SITE_METRICS_SHORT_NAME, fullName = REF_SITE_METRICS_LONG_NAME, doc = "a metrics file with overall summary metrics and reference context-specific depth histograms")
@Argument(fullName = REF_SITE_METRICS_LONG_NAME, doc = "a metrics file with overall summary metrics and reference context-specific depth histograms")
private File refMetricsOutput = null;

@Argument(shortName = ALT_DEPTH1_HISTOGRAM_SHORT_NAME, fullName = ALT_DEPTH1_HISTOGRAM_LONG_NAME, doc = "a histogram of alt sites with alt depth = 1")
@Argument(fullName = ALT_DEPTH1_HISTOGRAM_LONG_NAME, doc = "a histogram of alt sites with alt depth = 1")
private File altMetricsOutput = null;

@Argument(fullName = MAX_DEPTH_LONG_NAME, doc = "sites with depth higher than this value will be grouped", optional = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,13 @@ public class LearnReadOrientationModel extends CommandLineProgram {
public static final String MAX_EM_ITERATIONS_LONG_NAME = "num-em-iterations";
public static final String MAX_DEPTH_LONG_NAME = "max-depth";

@Argument(fullName = CollectF1R2Counts.REF_SITE_METRICS_LONG_NAME,
shortName = CollectF1R2Counts.REF_SITE_METRICS_SHORT_NAME,
doc = "histograms of depths over ref sites for each reference context")
@Argument(fullName = CollectF1R2Counts.REF_SITE_METRICS_LONG_NAME, doc = "histograms of depths over ref sites for each reference context")
private List<File> refHistogramFiles;

@Argument(fullName = CollectF1R2Counts.ALT_DATA_TABLE_LONG_NAME,
shortName = CollectF1R2Counts.ALT_DATA_TABLE_SHORT_NAME,
doc = "a table of F1R2 and depth counts")
@Argument(fullName = CollectF1R2Counts.ALT_DATA_TABLE_LONG_NAME, doc = "a table of F1R2 and depth counts")
private List<File> altDataTables;

@Argument(fullName = CollectF1R2Counts.ALT_DEPTH1_HISTOGRAM_LONG_NAME,
shortName = CollectF1R2Counts.ALT_DEPTH1_HISTOGRAM_SHORT_NAME,
doc = "histograms of depth 1 alt sites", optional = true)
@Argument(fullName = CollectF1R2Counts.ALT_DEPTH1_HISTOGRAM_LONG_NAME, doc = "histograms of depth 1 alt sites", optional = true)
private List<File> altHistogramFiles = null;

@Argument(fullName = StandardArgumentDefinitions.OUTPUT_LONG_NAME, shortName = StandardArgumentDefinitions.OUTPUT_SHORT_NAME, doc = "table of artifact priors")
Expand All @@ -80,6 +74,10 @@ public class LearnReadOrientationModel extends CommandLineProgram {

@Override
protected void onStartup(){
Utils.validate(refHistogramFiles.size() == altDataTables.size() && altDataTables.size() == altHistogramFiles.size(),
"The numbers of ref histograms, alt histograms, and alt table files must all be the same");
START HERE CHECK HEADER

refHistograms = sumHistogramsFromFiles(refHistogramFiles);

if (altHistogramFiles != null) {
Expand Down Expand Up @@ -269,9 +267,7 @@ public static List<Histogram<Integer>> sumHistogramsFromFiles(final List<File> f
for (final Histogram<Integer> jthHistogram : ithHistograms){
final String refContext = jthHistogram.getValueLabel();
final Optional<Histogram<Integer>> hist = histogramList.stream().filter(h -> h.getValueLabel().equals(refContext)).findAny();
if (! hist.isPresent()){
throw new IllegalStateException("Reference histogram is empty, which violates the invariant enforced by CollectF1R2Counts");
}
Utils.validate(hist.isPresent(),"Reference histogram is empty, which violates the invariant enforced by CollectF1R2Counts");

hist.get().addHistogram(jthHistogram);
}
Expand All @@ -296,7 +292,5 @@ public static Pair<String, List<AltSiteRecord>> gatherAltSiteRecords(final List<
}

return new ImmutablePair<>(sample, records);

}

}
}

0 comments on commit 5ca8d0b

Please sign in to comment.