Overview

Namespaces

  • cli_db
    • propel
      • map
      • om
  • cli_import
  • LoggedPDO
  • None
  • PHP
  • webservices
    • cart
    • combisearch
    • details
      • annotations
        • feature
    • graphs
      • barplot
      • genome
    • listing
    • queue

Classes

  • Differential_expressions
  • Filters
  • Filters_diffexp
  • Isoforms
  • Multisearch
  • Organism_release
  • Searchbox
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace webservices\listing;
 4: 
 5: use \PDO as PDO;
 6: /*
 7:  * Web Service.
 8:  * Splits $querydata['longterm'] into words and searches for matching features and their associated features
 9:  */
10: 
11: class Multisearch extends \WebService {
12: 
13:     /**
14:      * @inheritDoc
15:      */
16:     public function execute($querydata) {
17:         global $db;
18:         $species = intval($querydata['species']);
19:         $import = $querydata['release'];
20:         $longterm = $querydata['longterm'];
21:         $terms = preg_split('/[,\s]+/m', $longterm, -1, PREG_SPLIT_NO_EMPTY);
22:         $qmarks = implode(',', array_fill(0, count($terms), '?'));
23:         $values = array_merge(array($species, $import), $terms);
24:         
25: #UI hint
26:         if (false)
27:             $db = new PDO();
28: 
29:         $query_get_features = <<<EOF
30: SELECT * FROM multisearch(?, ?, ARRAY[$qmarks]::varchar[])
31: EOF;
32: 
33:         $stm_get_features = $db->prepare($query_get_features);
34: 
35:         $data = array('results' => array());
36: 
37:         $stm_get_features->execute($values);
38:         while ($feature = $stm_get_features->fetch(PDO::FETCH_ASSOC)) {
39:             $data['results'][$feature['feature_id']] = array(
40:                 'name' => $feature['feature_name']
41:                 , 'type' => $feature['type_id'] == CV_UNIGENE ? 'unigene' :  (CV_ISOFORM ?  'isoform' : 'unknonwn')
42:                 , 'feature_id' => $feature['feature_id']
43:                 , 'alias' => $feature['synonym_name']
44:             );
45:         }
46: 
47:         return $data;
48:     }
49: 
50: }
51: 
52: ?>
53: 
54: 
55: 
tbro API documentation generated by ApiGen 2.8.0