@DataProvider(name = "exonLookUpData")
 public Object[][] exonLookUpData() {
   final List<Object[]> result = new ArrayList<>();
   for (int i = 0; i < nonOverlappingExomeIntervals.size(); i++) {
     result.add(
         new Object[] {
           nonOverlappingExomeIntervals.get(i), nonOverlappingExomeIntervals.get(i), i
         });
   }
   for (int i = 0; i < nonOverlappingExomeIntervals.size(); i++) {
     final SimpleInterval interval = nonOverlappingExomeIntervals.get(i);
     result.add(
         new Object[] {
           new SimpleInterval(interval.getContig(), interval.getStart(), interval.getStart()),
           interval,
           i
         });
   }
   for (int i = 0; i < nonOverlappingExomeIntervals.size(); i++) {
     final SimpleInterval interval = nonOverlappingExomeIntervals.get(i);
     result.add(
         new Object[] {
           new SimpleInterval(interval.getContig(), interval.getEnd(), interval.getEnd()),
           interval,
           i
         });
   }
   for (int i = 1; i < nonOverlappingExomeIntervals.size(); i++) {
     final SimpleInterval previous = nonOverlappingExomeIntervals.get(i - 1);
     final SimpleInterval next = nonOverlappingExomeIntervals.get(i);
     final SimpleInterval query =
         previous.getContig().equals(next.getContig())
             ? ExomeToolsTestUtils.createInterval(
                 previous.getContig(), previous.getEnd() + 1, next.getStart() - 1)
             : ExomeToolsTestUtils.createInterval(next.getContig(), 1, next.getStart() - 1);
     result.add(new Object[] {query, null, -i - 1});
   }
   return result.toArray(new Object[result.size()][]);
 }
 /**
  * Target information string composer for the genomic coordinate part of the target.
  *
  * @param index the index of a target within the collection.
  * @param collection the containing target collection.
  * @return never {@code null}.
  */
 private static String coordinateComposer(
     final int index, final TargetCollection<Target> collection) {
   final SimpleInterval location = collection.location(index);
   if (location == null) {
     return String.join(COLUMN_SEPARATOR, NO_VALUE_STRING, NO_VALUE_STRING, NO_VALUE_STRING);
   } else {
     return String.format(
         String.join(COLUMN_SEPARATOR, "%s", "%d", "%d"),
         location.getContig(),
         location.getStart(),
         location.getEnd());
   }
 }
예제 #3
0
 // returns all the intervals that overlap with the query.
 // (use the optimized version instead, unless you're testing it and need something to compare
 // against)
 protected ArrayList<T> getOverlappingIgnoringIndex(SimpleInterval query) {
   if (!contig.equals(query.getContig())) {
     // different contig, so we know no one'll overlap.
     return new ArrayList<T>();
   }
   ArrayList<T> ret = new ArrayList<T>();
   for (T v : vs) {
     // they are sorted by start location, so if this one starts too late
     // then all of the others will, too.
     if (v.getStart() > query.getEnd()) {
       break;
     }
     if (query.overlaps(v)) {
       ret.add(v);
     }
   }
   return ret;
 }
예제 #4
0
 /**
  * Returns all the intervals that overlap with the query. The query doesn't *have* to be in the
  * same contig as the intervals we hold, but of course if it isn't you'll get an empty result. You
  * may modify the returned list.
  */
 public ArrayList<T> getOverlapping(SimpleInterval query) {
   if (!contig.equals(query.getContig())) {
     // different contig, so we know no one'll overlap.
     return new ArrayList<T>();
   }
   ArrayList<T> ret = new ArrayList<T>();
   // use index to skip early non-overlapping entries.
   int idx = firstPotentiallyReaching(query.getStart());
   if (idx < 0) {
     idx = 0;
   }
   for (; idx < vs.size(); idx++) {
     T v = vs.get(idx);
     // they are sorted by start location, so if this one starts too late
     // then all of the others will, too.
     if (v.getStart() > query.getEnd()) {
       break;
     }
     if (query.overlaps(v)) {
       ret.add(v);
     }
   }
   return ret;
 }
예제 #5
0
 /**
  * Determines the stop of the expanded reference window, bounded if necessary by the contig.
  *
  * @param locus The locus to expand.
  * @param windowTrailingBases number of bases to attempt to expand relative to the locus end (>=
  *     0)
  * @return The end of the expanded window.
  */
 private int calculateWindowStop(final SimpleInterval locus, final int windowTrailingBases) {
   final int sequenceLength =
       dataSource.getSequenceDictionary().getSequence(locus.getContig()).getSequenceLength();
   return Math.min(locus.getEnd() + windowTrailingBases, sequenceLength);
 }
예제 #6
0
 /**
  * Get the number of extra bases of context after the end of our interval, as configured by a call
  * to {@link #setWindow} or at construction time.
  *
  * <p>Actual number of bases may be less than originally requested if the interval is near a
  * contig boundary.
  *
  * @return number of extra bases of context after the end of our interval
  */
 public int numWindowTrailingBases() {
   return window == null ? 0 : window.getEnd() - interval.getEnd();
 }