コード例 #1
0
  @Test(dataProvider = "trimmingData")
  public void testTrimTo(
      final Map<Haplotype, AssemblyResult> haplotypesAndResultSets, final AssemblyRegion original) {
    final AssemblyResultSet subject = new AssemblyResultSet();
    for (final Map.Entry<Haplotype, AssemblyResult> entry : haplotypesAndResultSets.entrySet())
      subject.add(entry.getKey(), entry.getValue());
    subject.setRegionForGenotyping(original);
    final GenomeLoc originalLocation = original.getExtendedSpan();
    final int length = originalLocation.size();
    final GenomeLoc newLocation =
        originalLocation.setStop(
            originalLocation.setStart(originalLocation, originalLocation.getStart() + length / 2),
            originalLocation.getStop() - length / 2);
    final AssemblyRegion newRegion = original.trim(newLocation);

    final Map<Haplotype, Haplotype> originalHaplotypesByTrimmed =
        new HashMap<>(haplotypesAndResultSets.size());
    for (final Haplotype h : haplotypesAndResultSets.keySet())
      originalHaplotypesByTrimmed.put(h.trim(newRegion.getExtendedSpan()), h);

    final AssemblyResultSet trimmed = subject.trimTo(newRegion);

    Assert.assertFalse(subject.wasTrimmed());
    Assert.assertTrue(trimmed.wasTrimmed());

    for (final Haplotype h : trimmed.getHaplotypeList()) {
      Assert.assertEquals(h.getGenomeLocation(), newLocation);
      Assert.assertEquals(h.getBases().length, newLocation.size());
    }
  }
コード例 #2
0
 public void initialize(final IndexedFastaSequenceFile referenceReader) {
   reference =
       referenceReader
           .getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getStop())
           .getBases();
 }
コード例 #3
0
 @Override
 public int hashCode() {
   return loc.hashCode();
 }
コード例 #4
0
 /**
  * Is this a proper overhang on the right side of the read?
  *
  * @param readLoc the read's loc
  * @param spliceLoc the split's loc
  * @return true if it's a right side overhang
  */
 protected static boolean isRightOverhang(final GenomeLoc readLoc, final GenomeLoc spliceLoc) {
   return readLoc.getStop() >= spliceLoc.getStart()
       && readLoc.getStop() < spliceLoc.getStop()
       && readLoc.getStart() < spliceLoc.getStart();
 }