Пример #1
0
  /**
   * Valid values for <tt>s1</tt> and <tt>s2</tt> are [0, ordering.size()-1]
   *
   * @param s1 The serial number of the sequence (<tt>s1</tt>) whose coordinate we wish to map
   *     against that of (<tt>s2</tt>)
   * @param s2 The other sequence
   * @param ugidx The ungapped coordinate of (<tt>s1</tt>)
   * @return The ungapped coordinate of (<tt>s2</tt>) corresponding to <tt>ugidx</tt>
   * @see GappedAlignmentString
   */
  public int mapUngapped(int s1, int s2, int ugidx) throws IndexOutOfBoundsException {
    if ((s1 < 0 || s1 >= ordering.size()) || (s2 < 0 || s2 >= ordering.size()))
      throw new IndexOutOfBoundsException("Valid values for s1 and s2 are [0, ordering.size()-1]");

    GappedAlignmentString str1 = gappedAlignments.get(ordering.get(s1));
    GappedAlignmentString str2 = gappedAlignments.get(ordering.get(s2));
    int gidx = str1.ungappedToGapped(ugidx);
    int ugidx2 = str2.gappedToUngapped(gidx);
    if (str2.isGap(gidx)) {
      return -1;
    }
    return ugidx2;
  }