annotate db2dbRestClient.php @ 5:12f1daa213cd draft default tip

Uploaded
author cheanney
date Thu, 16 Jul 2015 11:02:34 -0400
parents ae43e2d7f68a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
1 {\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
2 {\fonttbl\f0\fnil\fcharset0 Monaco;}
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
3 {\colortbl;\red255\green255\blue255;\red255\green0\blue0;\red85\green127\blue95;\red0\green0\blue192;
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
4 \red127\green0\blue85;}
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
5 \margl1440\margr1440\vieww21520\viewh8280\viewkind0
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
6 \deftab720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
7 \pard\pardeftab720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
8
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
9 \f0\fs22 \cf2 <?php\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
10 \pard\pardeftab720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
11 \cf3 //$client = new SoapClient("http://biodbnet.abcc.ncifcrf.gov/webServices/bioDBnet.wsdl");\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
12 \cf3 /*\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
13 \cf3 $input = 'Ensembl Gene ID';\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
14 \cf3 $inputValues = 'ENSG00000121410, ENSG00000171428';\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
15 \cf3 $outputs = 'Gene Symbol, Ensembl Protein ID';\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
16 \cf3 $taxonId = '9606';\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
17 \cf3 $methods = array(\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
18 \cf3 'getInputs',\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
19 \cf3 'getOutputsForInput',XML: http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=getoutputsforinput&input=genesymbol\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
20 \cf3 'getDirectOutputsForInput',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=getdirectoutputsforinput&input=genesymbol&directOutput=1\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
21 \cf3 'getPathways', http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=getpathways&pathways=ncipid,kegg&taxonId=9606\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
22 \cf3 'db2db',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=db2db&input=geneid&inputValues=1,3&outputs=genesymbol,affyid&taxonId=9606&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
23 \cf3 'dbReport',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=dbreport&input=geneid&inputValues=1,3&taxonId=9606&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
24 \cf3 'dbWalk',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=dbwalk&inputValues=A1BG,MYC&dbPath=genesymbol-%3Egeneid-%3Eaffyid&taxonId=9606&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
25 \cf3 'dbFind',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=dbfind&inputValues=A1BG,MYC,1,3&output=geneid&taxonId=9606&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
26 \cf3 'dbOrtho',http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=dbortho&input=geneid&inputValues=1,3&inputTaxon=9606&outputTaxon=10090&output=genesymbol&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
27 \cf3 'dbAnnot'http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi?method=dbannot&inputValues=1,MYC,MTOR_HUMAN&taxonId=9606&annotations=Genes,Pathways&format=row\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
28 \cf3 )\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
29 \cf3 */\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
30 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
31 $taxonId = \cf4 ""\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
32 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
33 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
34 \cf3 //format='row' input='ensemblgeneid' inputValues='ENSG00000121410' outputs='genesymbol' taxonId='9606'\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
35 \cf3 //&format=row&input=genesymbol&inputValues=MYC,MTOR&outputs=geneid,affyid&taxonId=9606";\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
36 \cf3 //$biodbnetRestApiCall = "http://biodbnet.abcc.ncifcrf.gov/webServices/rest.php/biodbnetRestApi.json?method=getinputs";\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
37 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
38 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
39 \cf3 //print_r($argv);\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
40 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
41 $biodbnetRestApiCall = \cf4 ''\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
42 \pard\pardeftab720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
43 \cf5 foreach \cf0 ($argv \cf5 as \cf0 $val)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
44 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
45 $arr = preg_split(\cf4 "/=/"\cf0 , $val);\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
46 \cf5 if \cf0 (strcmp(\cf4 'input'\cf0 , $arr[0]) == 0)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
47 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
48 $input = $arr[1];\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
49 $biodbnetRestApiCall = $biodbnetRestApiCall . \cf4 "&input=" \cf0 . $input;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
50 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
51 \cf5 else if \cf0 (strcmp(\cf4 'taxonId'\cf0 , $arr[0]) == 0)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
52 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
53 $taxonId = $arr[1];\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
54 $biodbnetRestApiCall = $biodbnetRestApiCall . \cf4 "&taxonId=" \cf0 . $taxonId;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
55 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
56 \cf5 else if \cf0 (strcmp(\cf4 'inputValues'\cf0 , $arr[0]) == 0)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
57 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
58 $inputValues = $arr[1];\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
59 $biodbnetRestApiCall = $biodbnetRestApiCall . \cf4 "&inputValues=" \cf0 . $inputValues;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
60 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
61 \cf5 else if \cf0 (strcmp(\cf4 'outputs'\cf0 , $arr[0]) == 0)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
62 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
63 $outputs = $arr[1];\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
64 $biodbnetRestApiCall = $biodbnetRestApiCall . \cf4 "&outputs=" \cf0 . $outputs;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
65 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
66 \cf5 else if \cf0 (strcmp(\cf4 'fileType'\cf0 , $arr[0]) == 0)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
67 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
68 $fileType = strtolower($arr[1]);\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
69 \cf5 if \cf0 ($fileType == \cf4 'xml'\cf0 )\{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
70 $biodbnetRestApiCallCore = \cf4 "http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi.xml?method=db2db"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
71 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
72 \cf5 else\cf0 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
73 $biodbnetRestApiCallCore = \cf4 "http://fr-s-bsg-bdb-0.ncifcrf.gov/webServices/rest.php/biodbnetRestApi.json?method=db2db"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
74 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
75 \cf5 if \cf0 ($fileType == \cf4 'table'\cf0 )\{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
76 $biodbnetRestApiCall = $biodbnetRestApiCall . \cf4 "&format=row"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
77 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
78 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
79 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
80 $restApiCall = $biodbnetRestApiCallCore . $biodbnetRestApiCall;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
81 $response = file_get_contents($restApiCall);\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
82 \cf5 if \cf0 ($fileType == \cf4 'xml' \cf0 || $fileType == \cf4 'json'\cf0 )\{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
83 print_r($response);\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
84 \}\cf5 elseif \cf0 ($fileType == \cf4 'table'\cf0 )\{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
85 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
86 $formattedResponse = json_decode($response, \cf5 true\cf0 );\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
87 \cf3 //print_r($formattedResponse);\cf0 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
88 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
89 \cf5 echo \cf4 "<html>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
90 \cf5 echo \cf4 "<br/><br/><b>bioDBnet: db2db results</b><br/>"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
91 \cf5 echo \cf4 "<table border=1>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
92 $colNames = array_keys($formattedResponse[0]);\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
93 \cf5 echo \cf4 "<tr>"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
94 \cf5 foreach \cf0 ($colNames \cf5 as \cf0 $col)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
95 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
96 \cf5 if \cf0 ($col == \cf4 'InputValue'\cf0 )\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
97 $col = $input;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
98 \cf5 echo \cf4 "<th>\cf0 $col\cf4 </th>"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
99 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
100 \cf5 echo \cf4 "</tr>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
101 \cf5 foreach \cf0 ($formattedResponse \cf5 as \cf0 $row)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
102 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
103 \cf5 echo \cf4 "<tr>"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
104 \cf5 foreach \cf0 ($row \cf5 as \cf0 $key => $col)\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
105 \{\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
106 \cf5 echo \cf4 "<td>\cf0 $col\cf4 </td>"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
107 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
108 \cf5 echo \cf4 "</tr>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
109 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
110 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
111 \cf5 echo \cf4 "</table>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
112 \cf5 echo \cf4 "</html>\\n"\cf0 ;\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
113 \}\
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
114 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
115 \
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
116 \pard\pardeftab720
ae43e2d7f68a Uploaded
cheanney
parents:
diff changeset
117 \cf2 ?>}