Search in sources :

Example 1 with LineType

use of org.molgenis.gavin.job.input.model.LineType in project molgenis by molgenis.

the class GavinJob method call.

@Override
public Void call(Progress progress) throws Exception {
    progress.setProgressMax(5);
    progress.progress(0, "Preprocessing input file...");
    Multiset<LineType> lineTypes = parser.tryTransform(inputFile, processedInputFile, errorFile);
    progress.status(format("Parsed input file. Found {0} lines ({1} comments, {2} valid VCF, {3} valid CADD, " + "{4} errors, {5} indels without CADD score, {6} skipped)", lineTypes.size(), lineTypes.count(COMMENT), lineTypes.count(VCF), lineTypes.count(CADD), lineTypes.count(ERROR), lineTypes.count(INDEL_NOCADD), lineTypes.count(SKIPPED)));
    gavinJobExecution.setLineTypes(lineTypes);
    if (lineTypes.contains(SKIPPED)) {
        throw new MolgenisDataException(format("Input file contains too many lines. Maximum is {0}.", Parser.MAX_LINES));
    }
    if (lineTypes.containsAll(Arrays.asList(CADD, VCF))) {
        throw new MolgenisDataException("Input file contains mixed line types. Please use one type only, either VCF or CADD.");
    }
    if (!lineTypes.contains(CADD) && !lineTypes.contains(VCF)) {
        throw new MolgenisDataException("Not a single valid variant line found.");
    }
    File exacInputFile = processedInputFile;
    if (!lineTypes.contains(CADD)) {
        progress.progress(1, "Annotating with cadd...");
        annotatorRunner.runAnnotator(cadd, processedInputFile, caddOutputFile, true);
        exacInputFile = caddOutputFile;
    } else {
        progress.progress(1, "File already annotated by cadd, skipping cadd annotation.");
    }
    progress.progress(2, "Annotating with exac...");
    annotatorRunner.runAnnotator(exac, exacInputFile, exacOutputFile, true);
    progress.progress(3, "Annotating with snpEff...");
    annotatorRunner.runAnnotator(snpeff, exacOutputFile, snpeffOutputFile, false);
    progress.progress(4, "Annotating with gavin...");
    annotatorRunner.runAnnotator(gavin, snpeffOutputFile, gavinOutputFile, false);
    progress.progress(5, "Result is ready for download.");
    String path = menuReaderService.getMenu().findMenuItemPath(GAVIN_APP);
    // TODO Filter
    // TODO write to database
    // TODO result -> GeneNetwork
    // TODO VCF pipe aware import
    progress.setResultUrl(format("{0}/result/{1}", path, jobIdentifier));
    return null;
}
Also used : MolgenisDataException(org.molgenis.data.MolgenisDataException) LineType(org.molgenis.gavin.job.input.model.LineType) File(java.io.File)

Aggregations

File (java.io.File)1 MolgenisDataException (org.molgenis.data.MolgenisDataException)1 LineType (org.molgenis.gavin.job.input.model.LineType)1