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: /**
 8:  * Web Service.
 9:  * returns up to 20+20 features, searching by start of featurename or synonym
10:  */
11: class Searchbox extends \WebService {
12: 
13:     /**
14:      * @inheritDoc
15:      */
16:     public function execute($querydata) {
17:         global $db;
18:         $constant = 'constant';
19: 
20:         $species = $querydata['species'];
21:         $import = $querydata['release'];
22: 
23:         $term = trim($querydata['term']) . '%';
24: 
25: 
26: #UI hint
27:         if (false)
28:             $db = new PDO();
29: 
30:         $query_get_features = <<<EOF
31:     (SELECT 
32:         synonym.name, 
33:         feature_synonym.feature_id, 
34:         cvterm.name AS type
35:     FROM 
36:         feature_synonym, 
37:         synonym, 
38:         feature,
39:         cvterm
40:     WHERE 
41:         feature.dbxref_id = (SELECT dbxref_id FROM dbxref WHERE db_id = {$constant('DB_ID_IMPORTS')} AND accession = ?)
42:         AND synonym.name LIKE ?
43:         AND feature_synonym.feature_id = feature.feature_id
44:         AND synonym.synonym_id = feature_synonym.synonym_id
45:         AND feature.organism_id = ?
46:         AND synonym.type_id=cvterm.cvterm_id
47:     LIMIT 20
48: )
49: UNION 
50:     (SELECT feature.name, feature.feature_id, cvterm.name AS type
51:     FROM feature, cvterm
52:     WHERE 
53:         feature.dbxref_id = (SELECT dbxref_id FROM dbxref WHERE db_id = {$constant('DB_ID_IMPORTS')} AND accession = ?)
54:         AND feature.name LIKE ?        
55:         AND feature.organism_id = ?
56:         AND (feature.type_id = {$constant('CV_UNIGENE')} OR feature.type_id = {$constant('CV_ISOFORM')})
57:         AND feature.type_id=cvterm.cvterm_id    
58:     LIMIT 20)
59: EOF;
60: 
61:         $stm_get_features = $db->prepare($query_get_features);
62: 
63:         $data = array('results' => array());
64: 
65:         $stm_get_features->execute(array($import, $term, $species, $import, $term, $species));
66:         while ($feature = $stm_get_features->fetch(PDO::FETCH_ASSOC)) {
67:             $data['results'][] = array('name' => $feature['name']
68:                 , 'type' => $feature['type']
69:                 , 'id' => $feature['feature_id']);
70:         }
71: 
72: 
73: 
74:         return $data;
75:     }
76: 
77: }
78: 
79: ?>
80: 
tbro API documentation generated by ApiGen 2.8.0