コード例 #1
0
ファイル: compounds_ls_ebi.php プロジェクト: egonw/chembl.rdf
$mastervoid = $rooturi . "void.ttl#";
$masterset = $mastervoid . "ChEMBLRDF";
$thisset = $mastervoid . "ChEMBLChEBIMapping";
$thisSetTitle = "ChEMBL - ChEBI OWL mappings";
$thisSetDescription = "Mappings between ChEMBL compounds and the ChEBI ontology.";
$sourceSet = $mastervoid . "ChEMBLCompound";
$sourceSpace = $CHEMBL;
$targetSet = $mastervoid . "ChEBI";
$targetSpace = "http://purl.obolibrary.org/obo/";
$linkPredicate = $SKOS . "exactMatch";
$expresses = $CHEMINF . "CHEMINF_000407";
$current_date = gmDate("Y-m-d\\TH:i:s");
echo triple($thisset, $PAV . "createdBy", $importedBy);
echo typeddata_triple($thisset, $PAV . "createdOn", $current_date, $XSD . "dateTime");
echo triple($thisset, $PAV . "authoredBy", $importedBy);
echo typeddata_triple($thisset, $PAV . "authoredOn", $current_date, $XSD . "dateTime");
echo triple($thisset, $RDF . "type", $VOID . "Linkset");
echo triple($masterset, $VOID . "subset", $thisset);
# echo triple( $molset, $RDF . "type", $VOID . "Dataset" );
echo data_triple($sourceSet, $VOID . "uriSpace", $sourceSpace);
echo triple($masterset, $VOID . "subset", $sourceSet);
# echo triple( $chebiset, $RDF . "type", $VOID . "Dataset" );
echo data_triple($targetSet, $VOID . "uriSpace", $targetSpace);
echo triple($masterset, $VOID . "subset", $thisset);
echo "\n";
echo data_triple($thisset, $DCT . "title", $thisSetTitle);
echo data_triple($thisset, $DCT . "description", $thisSetDescription);
echo triple($thisset, $VOID . "subjectsTarget", $sourceSet);
echo triple($thisset, $VOID . "objectsTarget", $targetSet);
echo triple($thisset, $VOID . "linkPredicate", $linkPredicate);
echo triple($thisset, $DCT . "license", $ini["license"]);
コード例 #2
0
ファイル: functions.php プロジェクト: egonw/chembl.rdf
function data_triple($subject, $predicate, $object)
{
    $XSD = "http://www.w3.org/2001/XMLSchema#";
    return typeddata_triple($subject, $predicate, $object, $XSD . "string");
}
コード例 #3
0
ファイル: assays.php プロジェクト: egonw/chembl.rdf
        $description = str_replace("\\", "\\\\", $description);
        $description = str_replace("\"", "\\\"", $description);
        echo data_triple($assay, $ONTO . "hasDescription", $description);
    }
    if ($row['doc_id']) {
        $docProps = mysqli_query($con, "SELECT DISTINCT chembl_id FROM docs WHERE doc_id = " . $row['doc_id']);
        while ($docProp = mysqli_fetch_assoc($docProps)) {
            echo triple($assay, $CITO . "citesAsDataSource", $CHEMBL . $docProp['chembl_id']);
        }
    }
    $props = mysqli_query($con, "SELECT DISTINCT * FROM assay2target WHERE assay_id = " . $row['assay_id']);
    while ($prop = mysqli_fetch_assoc($props)) {
        if ($prop['tid']) {
            $targetURI = $TRG . "t" . $prop['tid'];
            if ($prop['confidence_score']) {
                $targetScore = $assay . "/score/t" . $prop['tid'];
                echo triple($assay, $ONTO . "hasTargetScore", $targetScore);
                echo triple($targetScore, $ONTO . "forTarget", $targetURI);
                echo typeddata_triple($targetScore, $ONTO . "hasRelationshipType", $prop['relationship_type'], $XSD . "string");
                echo typeddata_triple($targetScore, $ONTO . "isComplex", $prop['complex'], $XSD . "int");
                echo typeddata_triple($targetScore, $ONTO . "isMulti", $prop['multi'], $XSD . "int");
            }
        }
    }
    if ($row['assay_type']) {
        $props = mysqli_query($con, "SELECT DISTINCT * FROM assay_type WHERE assay_type = '" . $row['assay_type'] . "'");
        while ($prop = mysqli_fetch_assoc($props)) {
            echo triple($assay, $ONTO . "hasAssayType", $ONTO . $prop['assay_desc']);
        }
    }
}
コード例 #4
0
<?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]);
        }
    }
}