예제 #1
0
파일: State.java 프로젝트: nver718/NZGOT
 /**
  * @param other another state to check for the quality with.
  * @return true if the other state is or possibly is equal to this state, taking ambiguities into
  *     account, i.e. if the ambiguity sets of this and the other state intersect.
  */
 public boolean possiblyEqual(State other) {
   for (State state : getCanonicalStates()) {
     for (State state1 : other.getCanonicalStates()) {
       if (state.equals(state1)) return true;
     }
   }
   return false;
 }
예제 #2
0
파일: State.java 프로젝트: nver718/NZGOT
 /**
  * Determine how much in common these potentially ambigous states have as a fraction between 0 and
  * 1 2 non-ambiguous states will return 0. 2 identical non-ambigoues states will 1. e.g. for
  * Nucleotides R,A = 0.5 R,G = 0.5 R,M = 0.25
  *
  * @param other another state to compare with
  * @return the fraction of canonical states that the 2 potentially ambiguous states have in common
  *     between 0 and 1.
  */
 public double fractionEqual(State other) {
   int totalStates = 0;
   int sameStates = 0;
   if (isGap() || other.isGap()) {
     return 1.0;
   }
   for (State state : getCanonicalStates()) {
     for (State state1 : other.getCanonicalStates()) {
       totalStates++;
       if (state.equals(state1)) {
         sameStates++;
       }
     }
   }
   return ((double) sameStates) / totalStates;
 }