use of au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile in project gridss by PapenfussLab.
the class SAMRecordUtilTest method unclipExactReferenceMatches_should_unclip_entire_read.
@Test
public void unclipExactReferenceMatches_should_unclip_entire_read() {
String refStr = "TAAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTCAGATGTTTCAGACATGTCTTATATACACAAGAGAATTTCATTTCTCTTT";
String readStr = "AAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTC";
InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "Contig" }, new byte[][] { B(refStr) });
SAMRecord r = new SAMRecord(new SAMFileHeader());
r.getHeader().setSequenceDictionary(ref.getSequenceDictionary());
r.setReferenceIndex(0);
r.setCigarString("97M34S");
r.setAlignmentStart(2);
r.setReadNegativeStrandFlag(false);
r.setReadBases(B(readStr));
SAMRecordUtil.unclipExactReferenceMatches(ref, r);
assertEquals("131M", r.getCigarString());
}
use of au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile in project gridss by PapenfussLab.
the class AssemblyEvidenceSourceTest method should_realign_very_poor_matches_to_the_reference.
@Test
// TODO: should we even do this? How much of this is covered by SingleReadEvidence.isReference()?
@Ignore("Enhancement")
public void should_realign_very_poor_matches_to_the_reference() {
String refStr = "TAAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTCAGATGTTTCAGACATGTCTTATATACACAAGAGAATTTCATTTCTCTTT";
String readStr = "AAATTGGAACACTATACCAAAACATTAACCAGCATAGCAGTATATAAGGTTAAACATTAAATAACCCCTGGCTTAACTAACTCTCCAATTGCACTTTCTATAAGTAATTGTTGTTTAGACTTTATTAATTC";
// 1234567890123456
// MMMMMSSSSSSSSSS
// sssssMMMMMMMMMM
InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "Contig" }, new byte[][] { B(refStr) });
SAMRecord r = new SAMRecord(new SAMFileHeader());
r.getHeader().setSequenceDictionary(ref.getSequenceDictionary());
r.setReferenceIndex(0);
r.setCigarString("97M34S");
r.setAlignmentStart(1);
r.setReadNegativeStrandFlag(false);
r.setReadBases(B(readStr));
r.setBaseQualities(B(refStr));
ProcessingContext pc = new ProcessingContext(new FileSystemContext(testFolder.getRoot(), 500000), reference, ref, Lists.newArrayList(), getConfig(testFolder.getRoot()));
AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(SES(pc)), assemblyFile);
SAMRecord ra = aes.transformAssembly(r);
assertEquals(2, ra.getAlignmentStart());
assertEquals("131M", ra.getCigarString());
}
use of au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile in project gridss by PapenfussLab.
the class SingleReadEvidenceTest method microhomology_match_bb.
public void microhomology_match_bb() {
// 1 2 3 4
// 1234567890123456789012345678901234567890123456789
// AAAACCGGGCCCCAAAAAAAAAGGGGCCCGGAAAAA
// <<<< <<<<<<<<<
String contig = "AAAACCGGGCCCCAAAAAAAAAGGGGCCCGGAAAAA";
InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "Contig" }, new byte[][] { B(contig) });
SAMRecord r = new SAMRecord(new SAMFileHeader());
r.getHeader().setSequenceDictionary(getSequenceDictionary());
r.setReferenceIndex(0);
r.setCigarString("9S4M");
r.setAlignmentStart(11);
r.setReadNegativeStrandFlag(true);
r.setReadBases(B("TTCCGGGCCCCA"));
r.setAttribute("SA", "Contig,36,+,4S9M,0,0");
SplitReadEvidence e = (SplitReadEvidence) asAssemblyEvidence(new MockSAMEvidenceSource(getContext(ref)), r);
assertEquals("CCGGGCCCC", e.getHomologySequence());
assertEquals(3, e.getHomologyAnchoredBaseCount());
assertEquals(11, e.getBreakendSummary().nominal);
assertEquals(26, e.getBreakendSummary().nominal2);
assertEquals(5, e.getBreakendSummary().start);
assertEquals(14, e.getBreakendSummary().end);
assertEquals(23, e.getBreakendSummary().start2);
assertEquals(32, e.getBreakendSummary().end2);
}
use of au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile in project gridss by PapenfussLab.
the class VcfBreakendSummaryTest method should_allow_colon_in_breakpoint_contig_name.
@Test
public void should_allow_colon_in_breakpoint_contig_name() {
InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "HLA-A*01:04N:1-HLA-A*02:95:3388" }, new byte[][] { B("ACGT") });
ProcessingContext pc = new ProcessingContext(getFSContext(), null, ref, new ArrayList<Header>(), getConfig());
IdsvVariantContextBuilder builder = new IdsvVariantContextBuilder(pc);
builder.chr("HLA-A*01:04N:1-HLA-A*02:95:3388").start(1).stop(1).alleles("A", "A.");
builder.breakpoint(new BreakpointSummary(0, FWD, 1, 1, 1, 0, BWD, 2, 2, 2), "");
IdsvVariantContext vc = builder.make();
VcfBreakendSummary summary = new VcfBreakendSummary(pc, vc);
Assert.assertEquals(0, summary.location.referenceIndex);
}
use of au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile in project gridss by PapenfussLab.
the class BreakpointHomologyTest method should_report_homology_on_both_sides.
@Test
public void should_report_homology_on_both_sides() {
InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCAATGGGCCC"), B("TTTAATGGGAAA") });
// 123456789012
// >
// <
BreakpointHomology bh = BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 6, 1, BWD, 7), "", 100, 0);
assertEquals(6, bh.getRemoteHomologyLength() + bh.getLocalHomologyLength());
assertEquals(3, bh.getLocalHomologyLength());
assertEquals(3, bh.getRemoteHomologyLength());
}
Aggregations