Search in sources :

Example 1 with PurpleQC

use of com.hartwig.hmftools.common.purple.qc.PurpleQC in project hmftools by hartwigmedical.

the class LoadPurpleData method main.

public static void main(@NotNull final String[] args) throws ParseException, IOException, SQLException {
    final Options options = createBasicOptions();
    final CommandLine cmd = createCommandLine(args, options);
    final DatabaseAccess dbAccess = databaseAccess(cmd);
    final String tumorSample = cmd.getOptionValue(SAMPLE);
    final String purplePath = cmd.getOptionValue(PURPLE_DIR);
    LOGGER.info("Persisting purity data");
    final PurpleQC purpleQC = PurpleQCFile.read(PurpleQCFile.generateFilename(purplePath, tumorSample));
    final PurityContext purityContext = FittedPurityFile.read(purplePath, tumorSample);
    final List<FittedPurity> bestFitPerPurity = FittedPurityRangeFile.read(purplePath, tumorSample);
    dbAccess.writePurity(tumorSample, purityContext, purpleQC);
    dbAccess.writeBestFitPerPurity(tumorSample, bestFitPerPurity);
    LOGGER.info("Persisting copy numbers");
    final List<PurpleCopyNumber> copyNumbers = PurpleCopyNumberFile.read(purplePath, tumorSample);
    dbAccess.writeCopynumbers(tumorSample, copyNumbers);
    LOGGER.info("Persisting gene copy numbers");
    final List<GeneCopyNumber> geneCopyNumbers = GeneCopyNumberFile.read(GeneCopyNumberFile.generateFilename(purplePath, tumorSample));
    dbAccess.writeGeneCopynumberRegions(tumorSample, geneCopyNumbers);
    LOGGER.info("Complete");
}
Also used : Options(org.apache.commons.cli.Options) CommandLine(org.apache.commons.cli.CommandLine) PurpleQC(com.hartwig.hmftools.common.purple.qc.PurpleQC) DatabaseAccess(com.hartwig.hmftools.patientdb.dao.DatabaseAccess) PurityContext(com.hartwig.hmftools.common.purple.purity.PurityContext) FittedPurity(com.hartwig.hmftools.common.purple.purity.FittedPurity) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) GeneCopyNumber(com.hartwig.hmftools.common.gene.GeneCopyNumber)

Example 2 with PurpleQC

use of com.hartwig.hmftools.common.purple.qc.PurpleQC in project hmftools by hartwigmedical.

the class PurpleChecker method run.

@NotNull
public BaseResult run(@NotNull final RunContext runContext) throws IOException {
    if (!runContext.isSomaticRun()) {
        return new NoResult(CheckType.PURPLE);
    }
    final String purpleDirectory = runContext.runDirectory() + File.separator + "purple";
    final PurpleQC qcCheck = PurpleQCFile.read(PurpleQCFile.generateFilename(purpleDirectory, runContext.tumorSample()));
    final List<HealthCheck> checks = Lists.newArrayList();
    final String segmentScore = String.valueOf(qcCheck.segmentScore());
    checks.add(new HealthCheck(runContext.tumorSample(), PurpleCheck.PURPLE_SEGMENT_SCORE.toString(), segmentScore));
    checks.add(new HealthCheck(runContext.tumorSample(), PurpleCheck.AMBER_GENDER.toString(), qcCheck.amberGender().toString()));
    checks.add(new HealthCheck(runContext.tumorSample(), PurpleCheck.COBALT_GENDER.toString(), qcCheck.cobaltGender().toString()));
    return toMultiValueResult(checks);
}
Also used : PurpleQC(com.hartwig.hmftools.common.purple.qc.PurpleQC) NoResult(com.hartwig.hmftools.healthchecker.result.NoResult) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PurpleQC (com.hartwig.hmftools.common.purple.qc.PurpleQC)2 GeneCopyNumber (com.hartwig.hmftools.common.gene.GeneCopyNumber)1 PurpleCopyNumber (com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber)1 FittedPurity (com.hartwig.hmftools.common.purple.purity.FittedPurity)1 PurityContext (com.hartwig.hmftools.common.purple.purity.PurityContext)1 NoResult (com.hartwig.hmftools.healthchecker.result.NoResult)1 DatabaseAccess (com.hartwig.hmftools.patientdb.dao.DatabaseAccess)1 CommandLine (org.apache.commons.cli.CommandLine)1 Options (org.apache.commons.cli.Options)1 NotNull (org.jetbrains.annotations.NotNull)1