示例#1
0
     }
 } elseif ($structSearchType === 'exact') {
     // exact search
     // we will do this by inchi
     $results_temp = array();
     if ($num_react + $num_prod > 0) {
         for ($i = 0; $i < $num_react; $i++) {
             $results_temp[] = exact_search($molecules[$i], 'rel_exp_structure_react', $results_id, 'exp_id');
         }
         for ($i = $num_react; $i < $num_react + $num_prod; $i++) {
             $results_temp[] = exact_search($molecules[$i], 'rel_exp_structure_prod', $results_id, 'exp_id');
         }
     } elseif (count($molecules) > 0) {
         for ($i = 0; $i < count($molecules); $i++) {
             $x = exact_search($molecules[$i], 'rel_exp_structure_react', $results_id, 'exp_id');
             $y = exact_search($molecules[$i], 'rel_exp_structure_prod', $results_id, 'exp_id');
             $results_temp[] = array_merge($x, $y);
         }
     }
 } elseif ($structSearchType === 'similarity') {
     // similarity search
     $results_temp = array();
     if ($num_react + $num_prod > 0) {
         for ($i = 0; $i < $num_react; $i++) {
             $results_temp[] = similarity_search($molecules[$i], 'rel_exp_structure_react', $results_id, $tanimoto, 'exp_id');
         }
         for ($i = $num_react; $i < $num_react + $num_prod; $i++) {
             $results_temp[] = similarity_search($molecules[$i], 'rel_exp_structure_prod', $results_id, $tanimoto, 'exp_id');
         }
     } elseif (count($molecules) > 0) {
         for ($i = 0; $i < count($molecules); $i++) {
示例#2
0
     $results_id[] = $get_id['id'];
 }
 // This counts the number of results - and if there wasn't any it gives them a little message explaining that
 $count = count($results_id);
 if ($count > 0) {
     // then, if necessary, do molecule-based search
     if (!empty($mol)) {
         if ($structSearchType === 'substructure') {
             $results_temp = array();
             $results_temp[] = substruc_search($mol, 'compound_registry', $results_id, 'id');
         } else {
             if ($structSearchType === 'exact') {
                 // exact search
                 // we will do this by inchi
                 $results_temp = array();
                 $results_temp[] = exact_search($mol, 'compound_registry', $results_id, 'id');
             } else {
                 if ($structSearchType === 'similarity') {
                     // similarity search
                     $results_temp = array();
                     $results_temp[] = similarity_search($mol, 'compound_registry', $results_id, $tanimoto, 'id');
                 }
             }
         }
         // where we have more than one results set, we treat the query as AND. So we find the intersection of the different
         // results arrays and return that as result.
         if (count($results_temp) > 1) {
             $results_id = call_user_func_array('array_intersect', $results_temp);
         } else {
             $results_id = array_intersect($results_id, $results_temp[0]);
         }