/** * Get the overlap between two HmmerResult objects * * @param other * @return 0 if no overlap, otherwise the length of the overlap */ public int getOverlapLength(HmmerResult other) { int overlap = 0; for (HmmerDomain d1 : getDomains()) { for (HmmerDomain d2 : other.getDomains()) { overlap += getOverlap(d1, d2); } } return overlap; }
@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())); }
private boolean emptyDomains(HmmerResult o) { if (o.getDomains() == null || o.getDomains().size() == 0) return true; return false; }