/
compounds_properties.php
65 lines (57 loc) · 1.97 KB
/
compounds_properties.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php header('Content-type: text/n3');
include 'namespaces.php';
include 'functions.php';
$ini = parse_ini_file("vars.properties");
$rooturi = $ini["rooturi"];
$db = $ini["dbprefix"] . $ini["version"];
$con = mysqli_connect(ini_get("mysqli.default_host"), ini_get("mysqli.default_user"), ini_get("mysqli.default_pw"), $db);
if (mysqli_connect_errno($con)) die(mysqli_connect_errno($con));
$allIDs = mysqli_query($con,
"SELECT * FROM chembl_id_lookup, compound_properties WHERE chembl_id_lookup.entity_id = compound_properties.molregno " . $ini["limit"]
);
# CHEMINF mappings
$descs = array(
"alogp" => "CHEMINF_000305",
"hba" => "CHEMINF_000309",
"hbd" => "CHEMINF_000310",
"psa" => "CHEMINF_000308",
"rtb" => "CHEMINF_000311",
"acd_most_apka" => "CHEMINF_000324",
"acd_most_bpka" => "CHEMINF_000325",
"acd_logp" => "CHEMINF_000321",
"acd_logd" => "CHEMINF_000323",
"num_ro5_violations" => "CHEMINF_000314",
"ro3_pass" => "CHEMINF_000317",
"med_chem_friendly" => "CHEMINF_000319",
"full_mwt" => "CHEMINF_000198",
"mw_freebase" => "CHEMINF_000350",
);
$descTypes = array(
"alogp" => "double",
"hba" => "nonNegativeInteger",
"hbd" => "nonNegativeInteger",
"psa" => "double",
"rtb" => "nonNegativeInteger",
"acd_most_apka" => "double",
"acd_most_bpka" => "double",
"acd_logp" => "double",
"acd_logd" => "double",
"num_ro5_violations" => "nonNegativeInteger",
"ro3_pass" => "string",
"med_chem_friendly" => "string",
"full_mwt" => "double",
"mw_freebase" => "double",
);
while ($row = mysqli_fetch_assoc($allIDs)) {
$molregno = $row['molregno'];
$molecule = $CHEMBL . $row['chembl_id'];
foreach ($descs as $value => $cheminf) {
if ($row[$value]) {
$molprop = $molecule. "/$value";
echo triple($molecule, $CHEMINF . "CHEMINF_000200", $molprop);
echo triple($molprop, $RDF . "type", $CHEMINF . "$cheminf");
echo typeddata_triple($molprop, $CHEMINF . "SIO_000300", $row[$value], $XSD . $descTypes[$value] );
}
}
}
?>