Search in sources :

Example 1 with ExternalProcessStreamingAligner

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

the class SplitReadRealignerTest method should_realign_multiple_times.

/**
 * TODO: Requires an aligner that will align 4 separate 100bp parts of a 400bp read
 */
// @Test
// @Category(ExternalAlignerTests.class)
public void should_realign_multiple_times() throws IOException {
    ExternalProcessStreamingAligner aligner = new ExternalProcessStreamingAligner(SamReaderFactory.make(), ExternalAlignerTests.COMMAND_LINE, ExternalAlignerTests.REFERENCE, 4);
    BufferedReferenceSequenceFile lookup = new BufferedReferenceSequenceFile(ReferenceSequenceFileFactory.getReferenceSequenceFile(ExternalAlignerTests.REFERENCE));
    ProcessingContext pc = new ProcessingContext(new FileSystemContext(testFolder.getRoot(), 500000), ExternalAlignerTests.REFERENCE, lookup, Lists.newArrayList(), getConfig(testFolder.getRoot()));
    SplitReadRealigner srr = new SplitReadRealigner(pc);
    SAMFileHeader header = new SAMFileHeader();
    header.setSequenceDictionary(lookup.getSequenceDictionary());
    header.setSortOrder(SortOrder.coordinate);
    SAMRecord r = new SAMRecord(header);
    r.setReferenceIndex(0);
    r.setAlignmentStart(1399998);
    r.setCigarString("301S103M");
    r.setReadBases(B("GGATATATAGGGATAGAAGCTTGAATAGTCTGGACATATATTTGTATTGAAATACAAATGTAAGATTTCAGTTAATCAATTTAAACATTTTTATTTTCAAGGGCTTCCAGCGTCCACTTCCTACGGCAAGCAGGAGGAGACAAGCGCCACCCTGCGCTCGCGGAGCCGACCCCGGCTCTCCCCTCCCGTGGCCGCAGGGGTCTGACAGAAAGGGGTCACTAATCTACTTGGCCTTTTGAGGACTGATCCTTAAGAATAATTTTTTTTTTTTTATGATCTTGAAGGCTGAGAAGTATTAGAGTAGGTTTTTTTCTCCTTCATAAGGCCAGATTCTTCTTTCTGTCACAGATTTCAAGTCCCCGCCTCAGCAGCCTTTCACTGTCAGTTCTTTCTCACGTGACCCT"));
    r.setBaseQualities(B("?????BBBB@DEDDDDGGGGGEIEHIHEFHIHIIEHHIEIIIIIIEHII?HHFHHHHDIHIHEHHFIIBCHI=GHIH@HFCEIGIHIDHHHGCIIHDHHFA?????BBBB@DEDDDDGGGGGEIEHIHEFHIHIIEHHIEIIIIIIEHII?HHFHHHHDIHIHEHHFIIBCHI=GHIH@HFCEIGIHIDHHHGCIIHDHHFA?????BBBB@DEDDDDGGGGGEIEHIHEFHIHIIEHHIEIIIIIIEHII?HHFHHHHDIHIHEHHFIIBCHI=GHIH@HFCEIGIHIDHHHGCIIHDHHFA?????BBBB@DEDDDDGGGGGEIEHIHEFHIHIIEHHIEIIIIIIEHII?HHFHHHHDIHIHEHHFIIBCHI=GHIH@HFCEIGIHIDHHHGCIIHDHHFA"));
    r.setReadName("four_way_split_read");
    createBAM(input, header, r);
    srr.createSupplementaryAlignments(aligner, input, output);
    List<SAMRecord> list = getRecords(output);
    assertEquals(4, list.size());
}
Also used : ExternalProcessStreamingAligner(au.edu.wehi.idsv.alignment.ExternalProcessStreamingAligner) SAMRecord(htsjdk.samtools.SAMRecord) BufferedReferenceSequenceFile(au.edu.wehi.idsv.picard.BufferedReferenceSequenceFile) SAMFileHeader(htsjdk.samtools.SAMFileHeader)

Example 2 with ExternalProcessStreamingAligner

use of au.edu.wehi.idsv.alignment.ExternalProcessStreamingAligner 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)

Aggregations

ExternalProcessStreamingAligner (au.edu.wehi.idsv.alignment.ExternalProcessStreamingAligner)2 GenomicProcessingContext (au.edu.wehi.idsv.GenomicProcessingContext)1 SplitReadRealigner (au.edu.wehi.idsv.SplitReadRealigner)1 ExternalProcessFastqAligner (au.edu.wehi.idsv.alignment.ExternalProcessFastqAligner)1 BufferedReferenceSequenceFile (au.edu.wehi.idsv.picard.BufferedReferenceSequenceFile)1 SAMFileHeader (htsjdk.samtools.SAMFileHeader)1 SAMFileWriterFactory (htsjdk.samtools.SAMFileWriterFactory)1 SAMRecord (htsjdk.samtools.SAMRecord)1 SamReaderFactory (htsjdk.samtools.SamReaderFactory)1 IOException (java.io.IOException)1