Overview

Namespaces

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

Classes

  • Features
  • Isoform
  • Statistical_information
  • Unigene
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace webservices\details;
 4: 
 5: use \PDO as PDO;
 6: /**
 7:  * Web Service.
 8:  * Returns isoform details (feature.*, import, organism_name), parent unigene and textual annotations
 9:  */
10: class Isoform extends \WebService {
11: 
12:     /**
13:      * @inheritDoc
14:      */
15:     public function execute($querydata) {
16:         global $db;
17:         $constant = 'constant';
18: 
19: #UI hint
20:         if (false)
21:             $db = new PDO();
22: 
23:         //isoform details (feature.*, import, organism_name)
24:         $param_isoform_feature_id = $querydata['query1'];
25:         $param_isoform_id = null;
26:         $query_get_isoforms = <<<EOF
27: SELECT DISTINCT ON (isoform.feature_id, dbxref.dbxref_id)
28:         isoform.*, dbxref.accession AS import, organism.common_name AS organism_name
29:     FROM feature AS isoform
30:         JOIN dbxref ON (isoform.dbxref_id = dbxref.dbxref_id AND dbxref.db_id = {$constant('DB_ID_IMPORTS')})
31:         JOIN organism ON (isoform.organism_id = organism.organism_id)
32:     WHERE isoform.feature_id = :isoform_id
33:         AND isoform.type_id = {$constant('CV_ISOFORM')}
34:     LIMIT 1;
35: EOF;
36:         $stm_get_isoforms = $db->prepare($query_get_isoforms);
37:         $stm_get_isoforms->bindValue('isoform_id', $param_isoform_feature_id);
38: 
39:         
40:         
41: //all textual annotations
42:         $query_get_desc = <<<EOF
43: SELECT
44:   *
45: FROM
46:   featureprop
47: WHERE
48:   featureprop.feature_id = :isoform_id AND
49:   featureprop.type_id = {$constant('CV_ANNOTATION_DESC')}
50: EOF;
51: 
52:         $stm_get_desc = $db->prepare($query_get_desc);
53:         $stm_get_desc->bindParam('isoform_id', $param_isoform_id);
54: 
55: //parent unigene
56:         $query_get_unigene = <<<EOF
57: SELECT unigene.*
58:     FROM feature_relationship, feature AS unigene
59:     WHERE unigene.feature_id = feature_relationship.object_id
60:     AND :isoform_id = feature_relationship.subject_id    
61:     AND unigene.type_id = {$constant('CV_UNIGENE')}
62:     LIMIT 1
63: EOF;
64: 
65:         $stm_get_unigene = $db->prepare($query_get_unigene);
66:         $stm_get_unigene->bindParam('isoform_id', $param_isoform_id);
67:         $return = array();
68: 
69:         $stm_get_isoforms->execute();
70:         if (($isoform = $stm_get_isoforms->fetch(PDO::FETCH_ASSOC)) !== false) {
71:             $param_isoform_id = $isoform['feature_id'];
72: 
73: 
74:             $stm_get_unigene->execute();
75:             //set $isoform['unigene'] to parent
76:             if (($unigene = $stm_get_unigene->fetch(PDO::FETCH_ASSOC)) !== false) {
77:                 $isoform['unigene'] = $unigene;
78:             }
79: 
80:             $stm_get_desc->execute();
81:             //add all descriptions to array $isoform['description']
82:             while ($desc = $stm_get_desc->fetch(PDO::FETCH_ASSOC)) {
83:                 $isoform['description'][] = $desc;
84:             }
85: 
86:             $return['isoform'] = &$isoform;
87:         }
88: 
89:         return $return;
90:     }
91: 
92: }
93: 
94: ?>
95: 
tbro API documentation generated by ApiGen 2.8.0