1: <?php
2:
3: namespace webservices\combisearch;
4:
5: use \PDO as PDO;
6:
7: 8: 9: 10:
11: class Hasgo extends \WebService {
12:
13: 14: 15: 16: 17: 18:
19: public function execute($querydata) {
20: global $db;
21: $constant = 'constant';
22:
23: $species = $querydata['species'];
24: $release = $querydata['release'];
25:
26: $term = trim($querydata['term']);
27:
28:
29: $query_get_features = <<<EOF
30: SELECT fd.feature_id
31: FROM
32: feature_dbxref fd,
33: (SELECT dbxref_id FROM dbxref WHERE dbxref.db_id = (SELECT db_id FROM db WHERE db.name = 'GO' LIMIT 1) AND trim(LEADING '0' FROM dbxref.accession) = trim(LEADING '0' FROM :accession)) AS dbxref,
34: (SELECT feature_id FROM feature WHERE feature.type_id={$constant('CV_ISOFORM')} AND feature.organism_id = :species AND feature.dbxref_id = (SELECT dbxref_id FROM dbxref WHERE db_id={$constant('DB_ID_IMPORTS')} AND accession=:release LIMIT 1)) as feature
35: WHERE
36: feature.feature_id = fd.feature_id
37: AND fd.dbxref_id = dbxref.dbxref_id
38: EOF;
39:
40: $stm_get_features = $db->prepare($query_get_features);
41:
42: $data = array('results' => array());
43:
44: $stm_get_features->execute(array(
45: 'accession' => $term,
46: 'species' => $species,
47: 'release' => $release
48: ));
49: while ($feature = $stm_get_features->fetch(PDO::FETCH_ASSOC)) {
50: $data['results'][] = $feature['feature_id'];
51: }
52:
53: return $data;
54: }
55:
56: }
57:
58: ?>
59: