Пример #1
0
  @Override
  public int compareTo(HmmerResult o) {
    // 	sort  by the start position of the first domain

    if (emptyDomains(this) && emptyDomains(o)) {
      return 0;
    }

    if (!emptyDomains(this) && emptyDomains(o)) return -1;

    if (emptyDomains(this) && (!emptyDomains(o))) return 1;

    // ok when we are here, both domains are not empty

    HmmerDomain me = this.getDomains().first();
    HmmerDomain other = o.getDomains().first();

    // System.out.println(" domains: " + me.getHmmAcc() + " " + other.getHmmAcc()+ " " +
    // me.getSqFrom().compareTo(other.getSqFrom()));

    return (me.getSqFrom().compareTo(other.getSqFrom()));
  }
Пример #2
0
  private int getOverlap(HmmerDomain one, HmmerDomain other) {
    int xs = one.getSqFrom();
    int ys = one.getSqTo();
    int as = other.getSqFrom();
    int bs = other.getSqTo();

    int overlap = 0;
    // 1:

    if (((xs < as) && (as < ys)) || ((xs < bs) && (bs <= ys)) || (as < xs && ys < bs)) {

      // 2:

      if (xs < as) {
        if (ys < bs) overlap = ys - as;
        else overlap = bs - as;
      } else {
        if (ys < bs) overlap = ys - xs;
        else overlap = bs - xs;
      }
    }

    return overlap;
  }