-
Notifications
You must be signed in to change notification settings - Fork 0
/
godm.php
30 lines (23 loc) · 979 Bytes
/
godm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include "common.php";
$query = json_decode(getdef($_GET,'q','{}'),TRUE);
$ds1 = filteralpha(getdef($query, 'dataset1', ''));
$ds2 = filteralpha(getdef($query, 'dataset2', ''));
if($ds1=="" && $ds2==""){
$ps=pg_prepare($db, 'getgene',"SELECT DISTINCT * FROM godm NATURAL JOIN goinfo");
$rs=pg_execute($db, 'getgene', array());
} else {
$ps=pg_prepare($db, 'getgene',"SELECT DISTINCT * FROM godm NATURAL JOIN goinfo WHERE dataset1=$1 AND dataset2=$2 ORDER BY pvalue");
$rs=pg_execute($db, 'getgene', array($ds1,$ds2));
}
echo '"dataset1","dataset2","goid","goname","pvalue","tscore"'."\n";
while($line=pg_fetch_array($rs,null,PGSQL_ASSOC)){
echo '"' . $line["dataset1"] . '","' . $line["dataset2"] . '","' .
$line["goid"] . '","' . $line["goname"] . '","' . $line["pvalue"] . '","' . $line["tscore"] . "\"\n";
}
pg_free_result($rs);
### Return result
#header('Content-Type: application/json; ');
#header('filename="godm.json"; ');
include "end.php";
?>