Example #1
0
 /**
  * Gets a list of the affected genes.
  *
  * @param selected is the list of selected genes.
  * @return the list of affected genes.
  */
 public ArrayList<ArrayList<Gene>> getAffected(ArrayList<Gene> selected) {
   ArrayList<ArrayList<Gene>> results = new ArrayList<ArrayList<Gene>>();
   for (ArrayList<Gene> x : causes) {
     boolean conditions = true;
     // check if the list of conditions are met.
     int j = 0;
     while (conditions == true && j < x.size()) {
       boolean gene_found = false;
       int i = 0;
       Gene gene_x = x.get(j);
       // check input list against condision
       while (gene_found == false && i < selected.size()) {
         if (gene_x.equals(selected.get(i))) {
           gene_found = true;
         }
         i++;
       }
       if (gene_found == false) {
         conditions = false;
       }
       j++;
     }
     if (conditions == true) {
       results.add(x);
     }
   }
   return results;
 }
Example #2
0
 /**
  * Checks if any of the conditions for the disease are met.
  *
  * @param selected is the list of selected genes.
  * @return true if conditions met.
  */
 public boolean isAffected(ArrayList<Gene> selected) {
   for (ArrayList<Gene> x : causes) {
     boolean conditions = true;
     // check if the list of conditions are met.
     int j = 0;
     while (conditions == true && j < x.size()) { // goes through sub list
       Gene gene_x = x.get(j); // gets current gene
       boolean gene_found = false;
       int i = 0;
       // check input list against condition
       while (gene_found == false && i < selected.size()) {
         if (gene_x.equals(selected.get(i))) {
           gene_found = true;
         }
         i++;
       }
       if (gene_found == false) {
         conditions = false;
       }
       j++;
     }
     if (conditions == true) {
       return true;
     }
   }
   return false;
 }