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);
}
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);
}
}
}
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);
}
Aggregations