Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112733993
getVariants.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
Mon, May 12, 16:30
Size
993 B
Mime Type
text/x-php
Expires
Wed, May 14, 16:30 (2 d)
Engine
blob
Format
Raw Data
Handle
26113062
Attached To
R4897 i2b2-webclient
getVariants.php
View Options
<?php
//select variant_id
//from shrine_ont.genomic_annotations
//where variant_annotations ->> 'Start_Position' = '5239176'
$conn
=
pg_connect
(
"host=localhost port=5432 dbname=i2b2 user=postgres password=admin"
);
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 variant_id
FROM shrine_ont.genomic_annotations
WHERE variant_annotations ->> '"
.
htmlspecialchars
(
$_GET
[
"annotation_name"
])
.
"' = '"
.
htmlspecialchars
(
$_GET
[
"annotation_value"
])
.
"'"
;
$result
=
pg_query
(
$conn
,
$query
);
if
(!
$result
)
{
echo
"An error occurred.
\n
"
;
exit
;
}
// In json format return both the panel number and the list of variants
echo
"{
\"
panel_number
\"
:"
.
$_GET
[
"panel_number"
]
.
",
\"
variants
\"
: "
;
$variantList
=
""
;
while
(
$row
=
pg_fetch_row
(
$result
))
{
$variantList
.=
"
\"
$row[0]
\"
,"
;
}
// drop the last comma
echo
"["
.
substr
(
$variantList
,
0
,
-
1
)
.
"]}"
;
Event Timeline
Log In to Comment