...
 
Commits (6)
<?php
require_once("config.php");
//$dbConn = mysql_connect($data[0],$data[1],$ps[$i])or die("Could not connect");
$dbConn = mysql_connect(
$config["db"]["host"],
$config["db"]["user"],
$config["db"]["password"]
)or die("Could not connect");
$db = mysql_select_db("plaza_complex", $dbConn) or die("Could not select DB");
try {
$db = new PDO('mysql:dbname='.$config['db']['database'].';host='.$config['db']['host'],
$config['db']['user'],
$config['db']['password']);
} catch (PDOException $e) {
echo 'Connection failed: '.$e->getMessage();
}
$spNames = array("pt" => "P. tremula", "at" => "A. thaliana", "os" => "Z. mays");
......
This diff is collapsed.
......@@ -25,12 +25,14 @@ DROP TABLE IF EXISTS `conservation`;
CREATE TABLE `conservation` (
`gene_id1` int(11) unsigned NOT NULL,
`gene_id2` int(11) unsigned NOT NULL,
`network_id1` int(11) unsigned NOT NULL,
`network_id2` int(11) unsigned NOT NULL,
`type` enum('conserved','diverged') NOT NULL DEFAULT 'conserved',
`pvalue` float DEFAULT NULL,
`th1` float NOT NULL,
`th2` float NOT NULL,
PRIMARY KEY (`gene_id1`,`gene_id2`),
UNIQUE KEY `gene_id1` (`gene_id1`,`gene_id2`,`type`,`th1`,`th2`)
`th1` decimal(10,10) NOT NULL,
`th2` decimal(10,10) NOT NULL,
PRIMARY KEY (`gene_id1`,`gene_id2`, `network_id1`, `network_id2`),
UNIQUE KEY `gene_id1` (`gene_id1`,`gene_id2`,`network_id1`,`network_id2`,`type`,`th1`,`th2`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
......@@ -74,12 +76,11 @@ DROP TABLE IF EXISTS `network_score`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `network_score` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`gene_id1` int(11) unsigned DEFAULT NULL,
`gene_id2` int(11) unsigned DEFAULT NULL,
`network_id` int(11) unsigned DEFAULT NULL,
`gene_id1` int(11) unsigned NOT NULL,
`gene_id2` int(11) unsigned NOT NULL,
`network_id` int(11) unsigned NOT NULL,
`score` float DEFAULT NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`gene_id1`,`gene_id2`,`network_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
......
This diff is collapsed.
<?php
require_once('../db.php');
$method = isset($_POST['method']) ? $_POST['method'] : 'get_networks';
function get_networks() {
global $db;
$stmt = $db->query('SELECT network.id AS id,
network.name AS name,
species.sciname AS species,
species.shortname AS shortname
FROM network
LEFT OUTER JOIN species
ON network.species_id = species.id');
if (!$stmt) {
echo 'Query failed';
}
$stmt->execute();
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($res);
}
call_user_func($method);
?>