Search in sources :

Example 1 with WGSMetrics

use of com.hartwig.hmftools.common.metrics.WGSMetrics in project hmftools by hartwigmedical.

the class CoverageCheckerTest method worksForSomaticRun.

@Test
public void worksForSomaticRun() {
    WGSMetrics metrics = ImmutableWGSMetrics.builder().ref10xCoveragePercentage(REF_COVERAGE_10X).ref20xCoveragePercentage(REF_COVERAGE_20X).refMeanCoverage(0D).tumor30xCoveragePercentage(TUMOR_COVERAGE_30X).tumor60xCoveragePercentage(TUMOR_COVERAGE_60X).build();
    PatientResult result = (PatientResult) CoverageChecker.toCheckResult(metrics, REF_SAMPLE, TUMOR_SAMPLE);
    List<HealthCheck> refResult = result.refSampleChecks();
    assertEquals(REF_NUMBER_OF_CHECKS, refResult.size());
    assertCheck(refResult, REF_SAMPLE, CoverageCheck.COVERAGE_10X, REF_COVERAGE_10X);
    assertCheck(refResult, REF_SAMPLE, CoverageCheck.COVERAGE_20X, REF_COVERAGE_20X);
    List<HealthCheck> tumorResult = result.tumorSampleChecks();
    assertEquals(TUMOR_NUMBER_OF_CHECKS, tumorResult.size());
    assertCheck(tumorResult, TUMOR_SAMPLE, CoverageCheck.COVERAGE_30X, TUMOR_COVERAGE_30X);
    assertCheck(tumorResult, TUMOR_SAMPLE, CoverageCheck.COVERAGE_60X, TUMOR_COVERAGE_60X);
}
Also used : WGSMetrics(com.hartwig.hmftools.common.metrics.WGSMetrics) ImmutableWGSMetrics(com.hartwig.hmftools.common.metrics.ImmutableWGSMetrics) PatientResult(com.hartwig.hmftools.healthchecker.result.PatientResult) Test(org.junit.Test)

Example 2 with WGSMetrics

use of com.hartwig.hmftools.common.metrics.WGSMetrics in project hmftools by hartwigmedical.

the class LoadMetricsData method main.

public static void main(@NotNull final String[] args) throws ParseException, SQLException, IOException {
    final Options options = createOptions();
    final CommandLine cmd = createCommandLine(args, options);
    final String userName = cmd.getOptionValue(DB_USER);
    final String password = cmd.getOptionValue(DB_PASS);
    final String databaseUrl = cmd.getOptionValue(DB_URL);
    final String runDirectoryPath = cmd.getOptionValue(RUN_DIR);
    if (Utils.anyNull(userName, password, databaseUrl, runDirectoryPath)) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("patient-db - load metrics data", options);
    } else {
        final File runDirectory = new File(runDirectoryPath);
        if (runDirectory.isDirectory()) {
            final String jdbcUrl = "jdbc:" + databaseUrl;
            final DatabaseAccess dbWriter = new DatabaseAccess(userName, password, jdbcUrl);
            RunContext runContext = ProductionRunContextFactory.fromRunDirectory(runDirectory.toPath().toString());
            LOGGER.info(String.format("Extracting and writing metrics for %s", runContext.runDirectory()));
            try {
                WGSMetrics metrics = generateMetricsForRun(runContext);
                dbWriter.writeMetrics(runContext.tumorSample(), metrics);
            } catch (IOException e) {
                LOGGER.warn(String.format("Cannot extract metrics for %s.", runContext.runDirectory()));
            }
        } else {
            if (!runDirectory.exists()) {
                LOGGER.warn("dir " + runDirectory + " does not exist.");
            }
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("patient-db - load metrics data", options);
        }
    }
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter) Options(org.apache.commons.cli.Options) CommandLine(org.apache.commons.cli.CommandLine) WGSMetrics(com.hartwig.hmftools.common.metrics.WGSMetrics) DatabaseAccess(com.hartwig.hmftools.patientdb.dao.DatabaseAccess) RunContext(com.hartwig.hmftools.common.context.RunContext) IOException(java.io.IOException) File(java.io.File) WGSMetricsFile(com.hartwig.hmftools.common.metrics.WGSMetricsFile)

Example 3 with WGSMetrics

use of com.hartwig.hmftools.common.metrics.WGSMetrics in project hmftools by hartwigmedical.

the class CoverageCheckerTest method worksForSingleSampleRun.

@Test
public void worksForSingleSampleRun() {
    WGSMetrics metrics = ImmutableWGSMetrics.builder().ref10xCoveragePercentage(REF_COVERAGE_10X).ref20xCoveragePercentage(REF_COVERAGE_20X).refMeanCoverage(0D).build();
    MultiValueResult result = (MultiValueResult) CoverageChecker.toCheckResult(metrics, REF_SAMPLE, null);
    List<HealthCheck> refResult = result.checks();
    assertEquals(REF_NUMBER_OF_CHECKS, refResult.size());
    assertCheck(refResult, REF_SAMPLE, CoverageCheck.COVERAGE_10X, REF_COVERAGE_10X);
    assertCheck(refResult, REF_SAMPLE, CoverageCheck.COVERAGE_20X, REF_COVERAGE_20X);
}
Also used : WGSMetrics(com.hartwig.hmftools.common.metrics.WGSMetrics) ImmutableWGSMetrics(com.hartwig.hmftools.common.metrics.ImmutableWGSMetrics) MultiValueResult(com.hartwig.hmftools.healthchecker.result.MultiValueResult) Test(org.junit.Test)

Aggregations

WGSMetrics (com.hartwig.hmftools.common.metrics.WGSMetrics)3 ImmutableWGSMetrics (com.hartwig.hmftools.common.metrics.ImmutableWGSMetrics)2 Test (org.junit.Test)2 RunContext (com.hartwig.hmftools.common.context.RunContext)1 WGSMetricsFile (com.hartwig.hmftools.common.metrics.WGSMetricsFile)1 MultiValueResult (com.hartwig.hmftools.healthchecker.result.MultiValueResult)1 PatientResult (com.hartwig.hmftools.healthchecker.result.PatientResult)1 DatabaseAccess (com.hartwig.hmftools.patientdb.dao.DatabaseAccess)1 File (java.io.File)1 IOException (java.io.IOException)1 CommandLine (org.apache.commons.cli.CommandLine)1 HelpFormatter (org.apache.commons.cli.HelpFormatter)1 Options (org.apache.commons.cli.Options)1