Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116285952
getGenes.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jun 5, 23:47
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jun 7, 23:47 (2 d)
Engine
blob
Format
Raw Data
Handle
26619393
Attached To
R4897 i2b2-webclient
getGenes.php
View Options
<?php
// case sensitive % stands for .*
//select *
//from shrine_ont.gene_values
//where gene_value LIKE '%A1%' //
//LIMIT 20
// case insensitive with regex
//select *
//from shrine_ont.gene_values
//where gene_value ~* '.*a1.*'
//LIMIT 20
//$conn = pg_connect("host=localhost port=5432 dbname=i2b2 user=postgres password=admin");
$conn
=
pg_connect
(
"host=localhost port=5432 dbname=i2b2 user=shrine_ont password=demouser"
);
if
(!
$conn
)
{
echo
"Error while connecting to the postgres database"
;
exit
;
}
// get the row which contains all the values of the passed annotation
$query
=
"SELECT gene_value
FROM shrine_ont.gene_values
WHERE gene_value ~* '.*"
.
$_GET
[
"gene"
]
.
".*'
LIMIT "
.
$_GET
[
"limit"
];
$result
=
pg_query
(
$conn
,
$query
);
if
(!
$result
)
{
echo
"An error occurred.
\n
"
;
exit
;
}
// In json format return the list of genes
$geneList
=
""
;
while
(
$row
=
pg_fetch_row
(
$result
))
{
$geneList
.=
"
\"
$row[0]
\"
,"
;
}
// drop the last comma and concatenate in json format
echo
"["
.
substr
(
$geneList
,
0
,
-
1
)
.
"]"
;
Event Timeline
Log In to Comment