Search in sources :

Example 1 with GenomicProcessingContext

use of au.edu.wehi.idsv.GenomicProcessingContext in project gridss by PapenfussLab.

the class ComputeCoverage method initIntervalCoverageAccumulator.

private IntervalCoverageAccumulator initIntervalCoverageAccumulator() {
    SAMSequenceDictionary dictionary = getReference().getSequenceDictionary();
    if (VCF == null) {
        return new IntervalCoverageAccumulator(COVERAGE_METHOD, dictionary, BIN_SIZE, null);
    } else {
        try (VCFFileReader vcfReader = new VCFFileReader(VCF, false)) {
            try (CloseableIterator<VariantContext> it = vcfReader.iterator()) {
                GenomicProcessingContext pc = new GenomicProcessingContext(new FileSystemContext(TMP_DIR.get(0), MAX_RECORDS_IN_RAM), REFERENCE_SEQUENCE, getReference());
                Iterator<IdsvVariantContext> idsvIt = Iterators.transform(it, variant -> IdsvVariantContext.create(pc, null, variant));
                Iterator<VariantContextDirectedEvidence> bpit = Iterators.filter(idsvIt, VariantContextDirectedEvidence.class);
                return new IntervalCoverageAccumulator(COVERAGE_METHOD, dictionary, BIN_SIZE, bpit);
            }
        }
    }
}
Also used : IntervalCoverageAccumulator(au.edu.wehi.idsv.IntervalCoverageAccumulator) VariantContextDirectedEvidence(au.edu.wehi.idsv.VariantContextDirectedEvidence) VCFFileReader(htsjdk.variant.vcf.VCFFileReader) VariantContext(htsjdk.variant.variantcontext.VariantContext) IdsvVariantContext(au.edu.wehi.idsv.IdsvVariantContext) FileSystemContext(au.edu.wehi.idsv.FileSystemContext) IdsvVariantContext(au.edu.wehi.idsv.IdsvVariantContext) SAMSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary) GenomicProcessingContext(au.edu.wehi.idsv.GenomicProcessingContext)

Example 2 with GenomicProcessingContext

use of au.edu.wehi.idsv.GenomicProcessingContext in project gridss by PapenfussLab.

the class SoftClipsToSplitReads method doWork.

@Override
protected int doWork() {
    log.debug("Setting language-neutral locale");
    java.util.Locale.setDefault(Locale.ROOT);
    validateParameters();
    GenomicProcessingContext pc = new GenomicProcessingContext(getFileSystemContext(), REFERENCE_SEQUENCE, getReference());
    pc.setCommandLineProgram(this);
    pc.setFilterDuplicates(IGNORE_DUPLICATES);
    SplitReadRealigner realigner = new SplitReadRealigner(pc);
    realigner.setMinSoftClipLength(MIN_CLIP_LENGTH);
    realigner.setMinSoftClipQuality(MIN_CLIP_QUAL);
    realigner.setProcessSecondaryAlignments(PROCESS_SECONDARY_ALIGNMENTS);
    realigner.setWorkerThreads(WORKER_THREADS);
    try {
        SamReaderFactory readerFactory = SamReaderFactory.make();
        SAMFileWriterFactory writerFactory = new SAMFileWriterFactory();
        if (ALIGNER_STREAMING) {
            ExternalProcessStreamingAligner aligner = new ExternalProcessStreamingAligner(readerFactory, ALIGNER_COMMAND_LINE, REFERENCE_SEQUENCE, WORKER_THREADS);
            realigner.createSupplementaryAlignments(aligner, INPUT, OUTPUT);
        } else {
            ExternalProcessFastqAligner aligner = new ExternalProcessFastqAligner(readerFactory, writerFactory, ALIGNER_COMMAND_LINE);
            realigner.createSupplementaryAlignments(aligner, INPUT, OUTPUT);
        }
    } catch (IOException e) {
        log.error(e);
        return -1;
    }
    return 0;
}
Also used : ExternalProcessStreamingAligner(au.edu.wehi.idsv.alignment.ExternalProcessStreamingAligner) SplitReadRealigner(au.edu.wehi.idsv.SplitReadRealigner) SamReaderFactory(htsjdk.samtools.SamReaderFactory) SAMFileWriterFactory(htsjdk.samtools.SAMFileWriterFactory) IOException(java.io.IOException) ExternalProcessFastqAligner(au.edu.wehi.idsv.alignment.ExternalProcessFastqAligner) GenomicProcessingContext(au.edu.wehi.idsv.GenomicProcessingContext)

Example 3 with GenomicProcessingContext

use of au.edu.wehi.idsv.GenomicProcessingContext in project gridss by PapenfussLab.

the class GenerateChromothripsis method doWork.

protected int doWork() {
    try {
        java.util.Locale.setDefault(Locale.ROOT);
        IOUtil.assertFileIsReadable(REFERENCE);
        GenomicProcessingContext pc = getProcessingContext();
        FragmentedChromosome fc;
        if (REPEATMASKER_OUTPUT == null) {
            fc = new FragmentedChromosome(pc, CHR, PADDING, FRAGMENT_SIZE, RANDOM_SEED);
        } else {
            fc = new RepeatFragmentedChromosome(pc, CHR, PADDING, FRAGMENT_SIZE, REPEATMASKER_OUTPUT, CLASS_FAMILY, RANDOM_SEED);
        }
        fc.assemble(FASTA, VCF, FRAGMENTS, INCLUDE_REFERENCE);
    } catch (Exception e) {
        e.printStackTrace();
        return 1;
    }
    return 0;
}
Also used : GenomicProcessingContext(au.edu.wehi.idsv.GenomicProcessingContext)

Example 4 with GenomicProcessingContext

use of au.edu.wehi.idsv.GenomicProcessingContext in project gridss by PapenfussLab.

the class GenerateSimpleVariants method doWork.

// private static Log log = Log.getInstance(GenerateSimpleVariants.class);
@Override
protected int doWork() {
    try {
        java.util.Locale.setDefault(Locale.ROOT);
        IOUtil.assertFileIsReadable(REFERENCE);
        GenomicProcessingContext pc = getProcessingContext();
        SimpleVariantChromosome gen = new SimpleVariantChromosome(pc, CHR, PADDING, RANDOM_SEED);
        gen.assemble(FASTA, VCF, INCLUDE_REFERENCE, TYPE, SIZE, COPIES == null ? Integer.MAX_VALUE : COPIES);
    } catch (Exception e) {
        e.printStackTrace();
        return 1;
    }
    return 0;
}
Also used : GenomicProcessingContext(au.edu.wehi.idsv.GenomicProcessingContext)

Example 5 with GenomicProcessingContext

use of au.edu.wehi.idsv.GenomicProcessingContext in project gridss by PapenfussLab.

the class SimulationGenerator method getProcessingContext.

protected GenomicProcessingContext getProcessingContext() {
    GenomicProcessingContext pc = new GenomicProcessingContext(new FileSystemContext(TMP_DIR.get(0), new File("."), MAX_RECORDS_IN_RAM), REFERENCE, null);
    pc.setCommandLineProgram(this);
    return pc;
}
Also used : FileSystemContext(au.edu.wehi.idsv.FileSystemContext) File(java.io.File) GenomicProcessingContext(au.edu.wehi.idsv.GenomicProcessingContext)

Aggregations

GenomicProcessingContext (au.edu.wehi.idsv.GenomicProcessingContext)5 FileSystemContext (au.edu.wehi.idsv.FileSystemContext)2 IdsvVariantContext (au.edu.wehi.idsv.IdsvVariantContext)1 IntervalCoverageAccumulator (au.edu.wehi.idsv.IntervalCoverageAccumulator)1 SplitReadRealigner (au.edu.wehi.idsv.SplitReadRealigner)1 VariantContextDirectedEvidence (au.edu.wehi.idsv.VariantContextDirectedEvidence)1 ExternalProcessFastqAligner (au.edu.wehi.idsv.alignment.ExternalProcessFastqAligner)1 ExternalProcessStreamingAligner (au.edu.wehi.idsv.alignment.ExternalProcessStreamingAligner)1 SAMFileWriterFactory (htsjdk.samtools.SAMFileWriterFactory)1 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)1 SamReaderFactory (htsjdk.samtools.SamReaderFactory)1 VariantContext (htsjdk.variant.variantcontext.VariantContext)1 VCFFileReader (htsjdk.variant.vcf.VCFFileReader)1 File (java.io.File)1 IOException (java.io.IOException)1