Example #1
0
 }
 if ($strucSearch) {
     if ($structSearchType === 'substructure') {
         // first let us deconstruct our rxn string into products and reagents.
         $results_temp = array();
         if ($num_react + $num_prod > 0) {
             for ($i = 0; $i < $num_react; $i++) {
                 $results_temp[] = substruc_search($molecules[$i], 'rel_exp_structure_react', $results_id, 'exp_id');
             }
             for ($i = $num_react; $i < $num_react + $num_prod; $i++) {
                 $results_temp[] = substruc_search($molecules[$i], 'rel_exp_structure_prod', $results_id, 'exp_id');
             }
         } elseif (count($molecules) > 0) {
             for ($i = 0; $i < count($molecules); $i++) {
                 $x = substruc_search($molecules[$i], 'rel_exp_structure_react', $results_id, 'exp_id');
                 $y = substruc_search($molecules[$i], 'rel_exp_structure_prod', $results_id, 'exp_id');
                 $results_temp[] = array_merge($x, $y);
             }
         }
     } 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) {
Example #2
0
 }
 $req = $bdd->prepare($sql);
 $req->execute($sqlArgs);
 $results_id = array();
 // make array of results id
 while ($get_id = $req->fetch()) {
     $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