Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116947825
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
Tue, Jun 10, 10:55
Size
972 B
Mime Type
text/x-php
Expires
Thu, Jun 12, 10:55 (2 d)
Engine
blob
Format
Raw Data
Handle
26697553
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