Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104499548
getVariantNames.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
Sun, Mar 9, 23:12
Size
972 B
Mime Type
text/x-php
Expires
Tue, Mar 11, 23:12 (2 d)
Engine
blob
Format
Raw Data
Handle
24798868
Attached To
R4897 i2b2-webclient
getVariantNames.php
View Options
<?php
// case insensitive with regex
//select variant_name
//from shrine_ont.variant_names
//where variant_name ~* '.*a1.*'
//LIMIT 20
$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
;
}
// escape the ? for regex query
$variant_name
=
str_replace
(
"?"
,
"
\?
"
,
$_GET
[
"variant_name"
]);
// get the row which contains all the values of the passed annotation
$query
=
"SELECT variant_name
FROM shrine_ont.genomic_annotations_new
WHERE variant_name ~* '.*"
.
$variant_name
.
".*'
LIMIT "
.
$_GET
[
"limit"
];
$result
=
pg_query
(
$conn
,
$query
);
if
(!
$result
)
{
echo
"An error occurred.
\n
"
;
exit
;
}
// In json format return the list of genes
$variantNames
=
""
;
while
(
$row
=
pg_fetch_row
(
$result
))
{
$variantNames
.=
"
\"
$row[0]
\"
,"
;
}
// drop the last comma and concatenate in json format
echo
"["
.
substr
(
$variantNames
,
0
,
-
1
)
.
"]"
;
Event Timeline
Log In to Comment