/** * Parse a single compound record from the compound xml file * handles the conversion of the raw XML to RDF. **/ function parse_compound_record(&$xml) { $root = $xml->GetXMLRoot(); $cid_array = $root->xpath('//PC-Compound_id/PC-CompoundType/PC-CompoundType_id/PC-CompoundType_id_cid'); if ($cid_array === FALSE) { trigger_error("Xpath did not work"); exit; } $cid = array_shift($cid_array); $pcid = $this->getPccNs() . $cid; $pcid_label = null; // AtomID/Type Information //$pc_atoms_aid = $root->xpath('//PC-Compound_atoms/PC-Atoms/PC-Atoms_aid/PC-Atoms_aid_E'); //$pc_atoms_element = $root->xpath('//PC-Compound_atoms/PC-Atoms/PC-Atoms_element/PC-Element'); //foreach($pc_atoms_aid as $i => $atom_aid) { //echo "atom: ".$pcid." element: ".$pc_atoms_element[$i]->attributes()->value."\n"; // $this->AddRDF($this->QQuad($pcid,)) //} // specific charge on an atom //$pc_atoms_charge = $root->xpath('//PC-Compound_atoms/PC-Atoms/PC-Atoms_charge/PC-AtomInt'); //foreach($pc_atoms_charge as $charge) { // $atom_id = $this->atom_id($pcid,array_shift($charge->xpath('//PC-AtomInt_aid'))); // $atom_charge = array_shift($charge->xpath('//PC-AtomInt_value')); //echo "atom_id: ".$atom_id." atom_charge: ".$atom_charge."\n"; //} // atomic bonds aid1 is one atom aid2 is the aid of the adjacent atom //$pc_bonds_aid1 = $root->xpath('//PC-Compound_bonds/PC-Bonds/PC-Bonds_aid1/PC-Bonds_aid1_E'); //$pc_bonds_aid2 = $root->xpath('//PC-Compound_bonds/PC-Bonds/PC-Bonds_ai2/PC-Bonds_aid2_E'); //$pc_bond_type = $root->xpath('//PC-Compound_bonds/PC-Bonds/PC-Bonds_order/PC-BondType'); //foreach($pc_bonds_aid1 as $i => $aid1) { // $atom_id1 = $this->atom_id($pcid,$aid1); // $atom_id2 = $this->atom_id($pcid,$pc_bonds_aid2[$i]); // $bond_id = $this->bond_id($id,$aid1,$pc_bonds_aid2[$i]); // $bond_type = $pc_bond_type[$i]; //} //PC-Compound_stero //PC-Compound_charge //PC-coords // Compound properties $property = $root->xpath('//PC-Compound_props/PC-InfoData'); foreach ($property as $prop) { $urn_label = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_label')); $urn_name = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_name')); $urn_implementation = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_implementation')); $urn_software = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_software')); $urn_version = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_version')); $urn_release = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_release')); $urn_data_type_value = array_shift($prop->xpath('./PC-InfoData_urn/PC-Urn/PC-Urn_datatype/PC-UrnDataType')); $urn_data_type = $urn_data_type_value->attributes()->value; $value = array_shift($prop->xpath('./PC-InfoData_value/*')); if ($urn_name == "Preferred" && $urn_label == "IUPAC Name") { $pcid_label = $value; } if ($value != "") { $urn_name = trim($urn_name); $urn_label = trim($urn_label); $pcid_type_string = ""; if ($urn_name != "") { $pcid_type_string .= $urn_name; } if ($urn_label != "") { $pcid_type_string .= $urn_label; } $prop_id = $this->getPccRes() . $this->info_id($cid, $prop->asXML()); $prop_type = $this->getPccVoc() . str_replace(" ", "_", $pcid_type_string); $prop_label = $urn_name . " " . $urn_label . " for PubChem compound " . $cid; parent::addRDF(parent::describeIndividual($prop_id, $prop_label, $prop_type) . parent::triplifyString($prop_id, "rdf:value", parent::safeLiteral($value))); $pcid_predicate_string = ""; if ($urn_name != "") { $pcid_predicate_string .= $urn_name; } if ($urn_label != "") { $pcid_predicate_string .= $urn_label; } $pcid_predicate_string = strtolower(str_replace(" ", "-", $pcid_predicate_string)); parent::addRDF(parent::triplify($pcid, $this->getPccVoc() . "has-" . $pcid_predicate_string, $prop_id) . parent::describeProperty($this->getPccVoc() . "has-" . $pcid_predicate_string, "Relationship between a PubChem compound and a {$pcid_type_string}")); $prov_id = $prop_id . "_provenance"; parent::addRDF(parent::triplify($prop_id, "prov:wasGeneratedBy", $prov_id)); if ($urn_implementation != "") { parent::addRDF(parent::triplifyString($prov_id, $this->getPccVoc() . "implementation", parent::safeLiteral($urn_implementation))); } if ($urn_software != "") { parent::addRDF(parent::triplifyString($prov_id, $this->getPccVoc() . "software", parent::safeLiteral($urn_software))); } if ($urn_version != "") { parent::addRDF(parent::triplifyString($prov_id, $this->getPccVoc() . "version", parent::safeLiteral($urn_version))); } if ($urn_release != "") { parent::addRDF(parent::triplifyString($prov_id, $this->getPccVoc() . "release", parent::safeLiteral($urn_release))); } } } parent::addRDF(parent::describeIndividual($pcid, $pcid_label, $this->getPccVoc() . "Compound")); }
function CTD_chem_go_enriched() { $first = true; while ($l = $this->GetReadFile()->Read()) { if ($l[0] == '#') { continue; } $a = explode("\t", $l); // check number of columns if ($first) { if (($c = count(explode("\t", $l))) != 13) { trigger_error("CTD_chem_go_enriched function expects 13 fields, found {$c}!" . PHP_EOL, E_USER_WARNING); return FALSE; } $first = false; } $this->getRegistry()->parseQName($a[5], $go_ns, $go_id); $rel = "involved-in"; if ($a[3] == "Biological Process") { $rel = "is-participant-in"; } elseif ($a[3] == "Molecular Function") { $rel = "has-function"; } elseif ($a[3] == "Cellular Component") { $rel = "is-located-in"; } $this->AddRDF(parent::triplify("mesh:" . $a[1], $this->getVoc() . $rel, $go_ns . ":" . $go_id) . parent::describeProperty($this->getVoc() . $rel, str_replace("-", " ", $rel))); parent::WriteRDFBufferToWriteFile(); } return TRUE; }
function process() { $header = $this->GetReadFile()->Read(200000); $header_arr = explode("\t", $header); $n = 41; $c = count($header_arr); if ($c != $n) { echo PHP_EOL; print_r($header_arr); trigger_error("Expected {$n} columns, found {$c} . please update the script", E_USER_ERROR); exit; } while ($l = $this->GetReadFile()->Read(4096)) { $fields = explode("\t", $l); $id = strtolower($fields[0]); $approved_symbol = $fields[1]; $approved_name = $fields[2]; $status = $fields[3]; $locus_type = $fields[4]; $locus_group = $fields[5]; $previous_symbols = $fields[6]; $previous_names = $fields[7]; $synonyms = $fields[8]; $name_synonyms = $fields[9]; $chromosome = $fields[10]; $date_approved = $fields[11]; $date_modified = $fields[12]; $date_symbol_changed = $fields[13]; $date_name_changed = $fields[14]; $accession_numbers = $fields[15]; $enzyme_ids = $fields[16]; $entrez_gene_id = $fields[17]; $ensembl_gene_id = $fields[18]; $mouse_genome_database_id = $fields[19]; $specialist_database_links = $fields[20]; $specialist_database_ids = $fields[21]; $pubmed_ids = $fields[22]; $refseq_ids = $fields[23]; $gene_family_tag = $fields[24]; $gene_family_description = $fields[25]; $record_type = $fields[26]; $primary_ids = $fields[27]; $secondary_ids = $fields[28]; $ccd_ids = $fields[29]; $vega_ids = $fields[30]; $locus_specific_databases = $fields[31]; $entrez_gene_id_mappeddatasuppliedbyNCBI = $fields[32]; $omim_id_mappeddatasuppliedbyNCBI = $fields[33]; $refseq_mappeddatasuppliedbyNCBI = $fields[34]; $uniprot_id_mappeddatasuppliedbyUniProt = $fields[35]; $ensembl_id_mappeddatasuppliedbyEnsembl = $fields[36]; $vega_id_mappeddatasuppliedbyVega = $fields[37]; $ucsc_id_mappeddatasuppliedbyUCSC = $fields[38]; $mouse_genome_database_id_mappeddatasuppliedbyMGI = $fields[39]; $rat_genome_database_id_mappeddatasuppliedbyRGD = $fields[40]; $id_res = $id; $id_label = "Gene Symbol for " . $approved_symbol; parent::AddRDF(parent::triplify($id_res, "rdf:type", $this->getVoc() . "Gene-Symbol") . parent::describeIndividual($id_res, $id_label, $this->getVoc() . "Gene-Symbol") . parent::describeClass($this->getVoc() . "Gene-Symbol", "HGNC Official Gene Symbol")); if (!empty($approved_symbol)) { $s = "hgnc.symbol:" . $approved_symbol; parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "approved-symbol", utf8_encode(htmlspecialchars($approved_symbol))) . parent::describeProperty($this->getVoc() . "approved-symbol", "HGNC approved gene symbol", "The official gene symbol that has been approved by the HGNC and is publicly available. Symbols are approved based on specific HGNC nomenclature guidelines. In the HTML results page this ID links to the HGNC Symbol Report for that gene") . parent::describeIndividual($s, $approved_symbol, parent::getVoc() . "Approved-Gene-Symbol") . parent::describeClass(parent::getVoc() . "Approved-Gene-Symbol", "Approved Gene Symbol") . parent::triplify($id_res, parent::getVoc() . "has-approved-symbol", $s) . parent::triplify($s, parent::getVoc() . "is-approved-symbol-of", $id_res)); } if (!empty($approved_name)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "approved-name", utf8_encode(htmlspecialchars($approved_name))) . parent::describeProperty($this->getVoc() . "approved-name", "HGNC approved name", "The official gene name that has been approved by the HGNC and is publicly available. Names are approved based on specific HGNC nomenclature guidelines.")); } if (!empty($status)) { $s = $this->getVoc() . str_replace(" ", "-", $status); parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "status", $s) . parent::describeProperty($this->getVoc() . "status", "HGNC status", "Indicates whether the gene is classified as: Approved - these genes have HGNC-approved gene symbols. Entry withdrawn - these previously approved genes are no longer thought to exist. Symbol withdrawn - a previously approved record that has since been merged into a another record.") . parent::describeClass($s, $status, $this->getVoc() . "Status")); } if (!empty($locus_id)) { $locus_res = $this->getRes() . $id . "_LOCUS"; parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "locus", $locus_res) . parent::triplifyString($locus_res, $this->getVoc() . "locus-type", utf8_encode(htmlspecialchars($locus_type))) . parent::triplifyString($locus_res, $this->getVoc() . "locus-group", utf8_encode(htmlspecialchars($locus_group))) . parent::describeProperty($this->getVoc() . "locus-type", "locus type", "Specifies the type of locus described by the given entry") . parent::describeProperty($this->getVoc() . "locus-group", "locus group", "Groups locus types together into related sets. Below is a list of groups and the locus types within the group")); } if (!empty($previous_symbols)) { $previous_symbols = explode(", ", $previous_symbols); foreach ($previous_symbols as $previous_symbol) { $previous_symbol_uri = "hgnc.symbol:" . $previous_symbol; parent::AddRDF(parent::describeIndividual($previous_symbol_uri, $previous_symbol, parent::getVoc() . "Previous-Symbol") . parent::describeClass(parent::getVoc() . "Previous-Symbol", "Previous Symbol") . parent::triplify($id_res, $this->getVoc() . "previous-symbol", $previous_symbol_uri) . parent::describeProperty($this->getVoc() . "previous-symbol", "HGNC previous symbol", "Symbols previously approved by the HGNC for this gene")); } } if (!empty($previous_names)) { $previous_names = explode(", ", $previous_names); foreach ($previous_names as $previous_name) { $previous_name = str_replace("\"", "", $previous_name); parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "previous-name", utf8_encode(htmlspecialchars($previous_name))) . parent::describeProperty($this->getVoc() . "previous-name", "HGNC previous name", "Gene names previously approved by the HGNC for this gene")); } } if (!empty($synonyms)) { $synonyms = explode(", ", $synonyms); foreach ($synonyms as $synonym) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "synonym", utf8_encode(htmlspecialchars($synonym))) . parent::describeProperty($this->getVoc() . "synonym", "synonym", "Other symbols used to refer to this gene")); } } if (!empty($name_synonyms)) { $name_synonyms = explode(", ", $name_synonyms); foreach ($name_synonyms as $name_synonym) { $name_synonym = str_replace("\"", "", $name_synonym); parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "name-synonym", utf8_encode(htmlspecialchars($name_synonym))) . parent::describeProperty($this->getVoc() . "name-synonym", "name synonym", "Other names used to refer to this gene")); } } if (!empty($chromosome)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "chromosome", utf8_encode(htmlspecialchars($chromosome))) . parent::describeProperty($this->getVoc() . "chromosome", "chromosome", "Indicates the location of the gene or region on the chromosome")); } if (!empty($date_approved)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "date-approved", $date_approved, "xsd:date") . parent::describeProperty($this->getVoc() . "date-approved", "date approved", "Date the gene symbol and name were approved by the HGNC")); } if (!empty($date_modified)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "date-modified", $date_modified, "xsd:date") . parent::describeProperty($this->getVoc() . "date-modified", "date modified", "the date the entry was modified by the HGNC")); } if (!empty($date_symbol_changed)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "date-symbol-changed", $date_symbol_changed, "xsd:date") . parent::describeProperty($this->getVoc() . "date-symbol-changed", "date symbol changed", "The date the gene symbol was last changed by the HGNC from a previously approved symbol. Many genes receive approved symbols and names which are viewed as temporary (eg C2orf#) or are non-ideal when considered in the light of subsequent information. In the case of individual genes a change to the name (and subsequently the symbol) is only made if the original name is seriously misleading")); } if (!empty($date_name_changed)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "date-name-changed", $date_name_changed, "xsd:date") . parent::describeProperty($this->getVoc() . "date-name-changed", "date name changed", "The date the gene name was last changed by the HGNC from a previously approved name")); } if (!empty($accession_numbers)) { $accession_numbers = explode(", ", $accession_numbers); foreach ($accession_numbers as $accession_number) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "accession", utf8_encode(htmlspecialchars($accession_number))) . parent::describeProperty($this->getVoc() . "accession", "accession number", "Accession numbers for each entry selected by the HGNC")); } } if (!empty($enzyme_ids)) { $enzyme_ids = explode(", ", $enzyme_ids); foreach ($enzyme_ids as $enzyme_id) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "x-ec", utf8_encode(htmlspecialchars($enzyme_id))) . parent::describeProperty($this->getVoc() . "x-ec", "Enzyme Commission (EC) number", "Enzyme entries have Enzyme Commission (EC) numbers associated with them that indicate the hierarchical functional classes to which they belong")); } } if (!empty($entrez_gene_id)) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ncbigene", "ncbigene:{$entrez_gene_id}") . parent::describeProperty($this->getVoc() . "x-ncbigene", "NCBI Gene", "NCBI Gene provides curated sequence and descriptive information about genetic loci including official nomenclature, synonyms, sequence accessions, phenotypes, EC numbers, MIM numbers, UniGene clusters, homology, map locations, and related web sites")); } if (!empty($ensembl_gene_id)) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ensembl", "ensembl:{$ensembl_gene_id}") . parent::describeProperty($this->getVoc() . "x-ensembl", "Ensembl Gene")); } if (!empty($mouse_genome_database_id)) { if (strpos($mouse_genome_database_id, "MGI:") !== FALSE) { $mouse_genome_database_id = substr($mouse_genome_database_id, 4); parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-mgi", "mgi:{$mouse_genome_database_id}") . parent::describeProperty($this->getVoc() . "x-mgi", "MGI entry")); } } if (!empty($specialist_database_links)) { $specialist_database_links = explode(", ", $specialist_database_links); foreach ($specialist_database_links as $specialist_database_link) { preg_match('/href="(\\S+)"/', $specialist_database_link, $matches); if (!empty($matches[1])) { parent::AddRDF(parent::QQuadO_URL($id_res, $this->getVoc() . "xref", $matches[1]) . parent::describeProperty($this->getVoc() . "xref", "Specialist database references.")); } } } if (!empty($pubmed_ids)) { $pubmed_ids = explode(", ", $pubmed_ids); foreach ($pubmed_ids as $pubmed_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-pubmed", "pubmed:" . trim($pubmed_id)) . parent::describeProperty($this->getVoc() . "x-pubmed", "NCBI PubMed entry", "Identifier that links to published articles relevant to the entry in the NCBI's PubMed database.")); } } if (!empty($refseq_ids)) { $refseq_ids = explode(", ", $refseq_ids); foreach ($refseq_ids as $refseq_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-refseq", "refseq:" . trim($refseq_id)) . parent::describeProperty($this->getVoc() . "x-refseq", "NCBI Refseq entry", "The Reference Sequence (RefSeq) identifier for that entry, provided by the NCBI. As we do not aim to curate all variants of a gene only one selected RefSeq is displayed per gene report. RefSeq aims to provide a comprehensive, integrated, non-redundant set of sequences, including genomic DNA, transcript (RNA), and protein products. RefSeq identifiers are designed to provide a stable reference for gene identification and characterization, mutation analysis, expression studies, polymorphism discovery, and comparative analyses. In the HTML results page this ID links to the RefSeq page for that entry.")); } } if (!empty($gene_family_tag)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "gene-family-tag", utf8_encode(htmlspecialchars($gene_family_tag))) . parent::describeProperty($this->getVoc() . "gene-family-tag", "Gene Family Tag", "Tag used to designate a gene family or group the gene has been assigned to, according to either sequence similarity or information from publications, specialist advisors for that family or other databases. Families/groups may be either structural or functional, therefore a gene may belong to more than one family/group. These tags are used to generate gene family or grouping specific pages at genenames.org and do not necessarily reflect an official nomenclature. Each gene family has an associated gene family tag and gene family description. If a particular gene is a member of more than one gene family, the tags and the descriptions will be shown in the same order.")); } if (!empty($gene_family_description)) { $gene_family_description = str_replace("\"", "", $gene_family_description); parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "gene-family-description", utf8_encode(htmlspecialchars($gene_family_description))) . parent::describeProperty($this->getVoc() . "gene-family-description", "gene family name", "Name given to a particular gene family. The gene family description has an associated gene family tag. Gene families are used to group genes according to either sequence similarity or information from publications, specialist advisors for that family or other databases. Families/groups may be either structural or functional, therefore a gene may belong to more than one family/group.")); } if (!empty($record_type)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "record-type", utf8_encode(htmlspecialchars($record_type)))); } if (!empty($primary_ids)) { $primary_ids = explode(", ", $primary_ids); foreach ($primary_ids as $primary_id) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "primary-id", utf8_encode(htmlspecialchars($primary_id))) . parent::describeProperty($this->getVoc() . "primary-id", "primary identifier")); } } if (!empty($secondary_ids)) { $secondary_ids = explode(", ", $secondary_ids); foreach ($secondary_ids as $secondary_id) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "secondary-id", utf8_encode(htmlspecialchars($secondary_id))) . parent::describeProperty($this->getVoc() . "secondary-id", "secondary identifier")); } } if (!empty($ccd_ids)) { $ccd_ids = explode(", ", $ccd_ids); foreach ($ccd_ids as $ccd_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ccds", "ccds:" . trim($ccd_id)) . parent::describeProperty($this->getVoc() . "x-ccds", "consensus CDS entry", "The Consensus CDS (CCDS) project is a collaborative effort to identify a core set of human and mouse protein coding regions that are consistently annotated and of high quality. The long term goal is to support convergence towards a standard set of gene annotations.")); } } if (!empty($vega_ids)) { $vega_ids = explode(", ", $vega_ids); foreach ($vega_ids as $vega_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-vega", "vega:" . trim($vega_id)) . parent::describeProperty($this->getVoc() . "x-vega", "VEGA gene entry")); } } if (!empty($locus_specific_databases)) { parent::AddRDF(parent::triplifyString($id_res, $this->getVoc() . "locus-specific-xref", utf8_encode(htmlspecialchars($locus_specific_databases))) . parent::describeProperty($this->getVoc() . "locus-specific-xref", "locus specific xref", "This contains a list of links to databases or database entries pertinent to the gene")); } if (!empty($entrez_gene_id_mappeddatasuppliedbyNCBI)) { $entrez_gene_id_mappeddatasuppliedbyNCBI = explode(", ", $entrez_gene_id_mappeddatasuppliedbyNCBI); foreach ($entrez_gene_id_mappeddatasuppliedbyNCBI as $gene_id) { if (strstr($gene_id, ":") !== FALSE) { $a = explode(":", $gene_id); $gene_id = $a[1]; } parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ncbigene", "ncbigene:" . trim($gene_id)) . parent::describeProperty($this->getVoc() . "x-ncbigene", "NCBI Gene entry")); } } if (!empty($omim_id_mappeddatasuppliedbyNCBI)) { $omim_id_mappeddatasuppliedbyNCBI = explode(", ", $omim_id_mappeddatasuppliedbyNCBI); foreach ($omim_id_mappeddatasuppliedbyNCBI as $omim_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-omim", "omim:" . trim($omim_id)) . parent::describeProperty($this->getVoc() . "x-omim", "OMIM entry", "Identifier provided by Online Mendelian Inheritance in Man (OMIM) at the NCBI. This database is described as a catalog of human genes and genetic disorders containing textual information and links to MEDLINE and sequence records in the Entrez system, and links to additional related resources at NCBI and elsewhere. In the HTML results page this ID links to the OMIM page for that entry.")); } } if (!empty($refseq_mappeddatasuppliedbyNCBI)) { $refseq_mappeddatasuppliedbyNCBI = explode(", ", $refseq_mappeddatasuppliedbyNCBI); foreach ($refseq_mappeddatasuppliedbyNCBI as $refseq_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-refseq", "refseq:" . trim($refseq_id)) . parent::describeProperty($this->getVoc() . "x-refseq", "NCBI Refseq entry", "The Reference Sequence (RefSeq) identifier for that entry, provided by the NCBI. As we do not aim to curate all variants of a gene only one selected RefSeq is displayed per gene report. RefSeq aims to provide a comprehensive, integrated, non-redundant set of sequences, including genomic DNA, transcript (RNA), and protein products. RefSeq identifiers are designed to provide a stable reference for gene identification and characterization, mutation analysis, expression studies, polymorphism discovery, and comparative analyses. In the HTML results page this ID links to the RefSeq page for that entry.")); } } if (!empty($uniprot_id_mappeddatasuppliedbyUniProt)) { $uniprot_id_mappeddatasuppliedbyUniProt = explode(", ", $uniprot_id_mappeddatasuppliedbyUniProt); foreach ($uniprot_id_mappeddatasuppliedbyUniProt as $uniprot_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-uniprot", "uniprot:" . trim($uniprot_id)) . parent::describeProperty($this->getVoc() . "x-uniprot", "Uniprot entry", "The UniProt identifier, provided by the EBI. The UniProt Protein Knowledgebase is described as a curated protein sequence database that provides a high level of annotation, a minimal level of redundancy and high level of integration with other databases. In the HTML results page this ID links to the UniProt page for that entry.")); } } if (!empty($ensembl_id_mappeddatasuppliedbyEnsembl)) { $ensembl_id_mappeddatasuppliedbyEnsembl = explode(", ", $ensembl_id_mappeddatasuppliedbyEnsembl); foreach ($ensembl_id_mappeddatasuppliedbyEnsembl as $ensembl_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ensembl", "ensembl:" . trim($refseq_id)) . parent::describeProperty($this->getVoc() . "x-ensembl", "Ensembl entry", "The Ensembl ID is derived from the current build of the Ensembl database and provided by the Ensembl team.")); } } if (!empty($ucsc_id_mappeddatasuppliedbyVega)) { $ucsc_id_mappeddatasuppliedbyVega = explode(", ", $ucsc_id_mappeddatasuppliedbyVega); foreach ($ucsc_id_mappeddatasuppliedbyVega as $vega_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-vega", "vega:" . trim($vega_id)) . parent::describeProperty($this->getVoc() . "x-vega", "Vega entry")); } } if (!empty($ucsc_id_mappeddatasuppliedbyUCSC)) { $ucsc_id_mappeddatasuppliedbyUCSC = explode(", ", $ucsc_id_mappeddatasuppliedbyUCSC); foreach ($ucsc_id_mappeddatasuppliedbyUCSC as $ucsc_id) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-ucsc", "ucsc:" . trim($ucsc_id)) . parent::describeProperty($this->getVoc() . "x-ucsc", "UCSC entry")); } } if (!empty($mouse_genome_database_id_mappeddatasuppliedbyMGI)) { $mouse_genome_database_id_mappeddatasuppliedbyMGI = explode(", ", $mouse_genome_database_id_mappeddatasuppliedbyMGI); foreach ($mouse_genome_database_id_mappeddatasuppliedbyMGI as $mgi_id) { if (strpos($mgi_id, "MGI:") !== FALSE) { $mgi_id = substr($mgi_id, 4); } parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-mgi", "mgi:" . trim($mgi_id)) . parent::describeProperty($this->getVoc() . "x-mgi", "MGI entry")); } } if (!empty($rat_genome_database_id_mappeddatasuppliedbyRGD)) { $rat_genome_database_id_mappeddatasuppliedbyRGD = explode(", ", trim($rat_genome_database_id_mappeddatasuppliedbyRGD)); foreach ($rat_genome_database_id_mappeddatasuppliedbyRGD as $rgd_id) { $rgd_id = trim($rgd_id); if (!empty($rgd_id)) { parent::AddRDF(parent::triplify($id_res, $this->getVoc() . "x-rgd", trim($rgd_id)) . parent::describeProperty($this->getVoc() . "x-rgd", "RGD entry")); } } } //write RDF to file $this->WriteRDFBufferToWriteFile(); } //while }
private function gene2go() { $this->GetReadFile()->Read(200000); while ($aLine = $this->GetReadFile()->Read(200000)) { $id = 1; $splitLine = explode("\t", $aLine); if (count($splitLine) == 8) { $taxid = "taxon:" . trim($splitLine[0]); if (isset($this->taxids) and !isset($this->taxids[trim($splitLine[0])])) { continue; } $aGeneId = trim($splitLine[1]); $goid = strtolower(trim($splitLine[2])); $evidenceCode = trim($splitLine[3]); $qualifier = trim($splitLine[4]); $golabel = trim($splitLine[5]); $pmids = explode("|", $splitLine[6]); $goCategory = strtolower(trim($splitLine[7])); $this->AddRDF(parent::triplify($this->getNamespace() . $aGeneId, $this->getVoc() . $goCategory, $goid) . parent::describeProperty($this->getVoc() . $goCategory, "Relationship between a NCBI Gene and a GO {$goCategory}")); $i = substr($goid, 3); //evidence if ($evidenceCode != "-") { // create an evidence object $eid = $this->getRes() . $aGeneId . "_" . $i; $this->AddRDF(parent::describeIndividual($eid, "association between " . $this->getNamespace() . $aGeneId . " and {$goid}", $this->getVoc() . "Gene-{$goCategory}-Association") . parent::triplify($this->getNamespace() . $aGeneId, $this->getVoc() . "gene-" . $goCategory . "-association", $eid) . parent::triplify($eid, $this->getVoc() . "evidence", "eco:{$evidenceCode}") . parent::triplify($eid, $this->getVoc() . "gene", $this->getNamespace() . $aGeneId) . parent::triplifyString($eid, $this->getVoc() . "go-category", $this->getVoc() . $goCategory) . parent::describeClass($this->getVoc() . $goCategory, $goCategory) . parent::triplify($eid, $this->getVoc() . "go-term", $goid)); foreach ($pmids as $pmid) { if ($pmid != '-') { $this->AddRDF(parent::triplify($eid, $this->getVoc() . "publication", "pubmed:" . $pmid)); } } } } //if parent::writeRDFBufferToWriteFile(); } //while }
function offsides() { $items = null; $z = 0; $this->GetReadFile()->Read(); while ($l = $this->GetReadFile()->Read(5096)) { list($stitch_id, $drug_name, $umls_id, $event_name, $rr, $log2rr, $t_statistic, $pvalue, $observed, $expected, $bg_correction, $sider, $future_aers, $medeffect) = explode("\t", $l); $z++; $id = 'offsides:' . $z; $cid = 'pubchemcompound:' . (int) sprintf("%d", substr($stitch_id, 4, -1)); $eid = 'umls:' . str_replace('"', '', $umls_id); $drug_name = str_replace('"', '', $drug_name); $event_name = str_replace('"', '', $event_name); $label = "{$event_name} as a predicted side-effect of {$drug_name}"; parent::addRDF(parent::describeIndividual($id, $label, parent::getVoc() . "Side-Effect") . parent::describeProperty(parent::getVoc() . "Side-Effect", "PharmGKB Offsides Side Effect")); parent::addRDF(parent::triplify($id, parent::getVoc() . "chemical", $cid) . parent::describeProperty(parent::getVoc() . "chemical", "Relationship between a PharmGKB entity and a chemical")); if (!isset($items[$cid])) { $items[$cid] = ''; parent::addRDF(parent::describeIndividual($cid, $drug_name, parent::getVoc() . "Chemical") . parent::describeClass(parent::getVoc() . "Chemical", "PharmGKB Chemical")); } $this->AddRDF($this->QQuad($id, "pharmgkb_vocabulary:event", $eid)); parent::addRDF(parent::triplify($id, parent::getVoc() . "event", $eid) . parent::describeProperty(parent::getVoc() . "event", "Relationship between a PharmGKB entity and an side effect event")); if (!isset($items[$eid])) { $items[$eid] = ''; parent::addRDF(parent::describeIndividual($eid, $event_name, parent::getVoc() . "Event") . parent::describeClass(parent::getVoc() . "Event", "PharmGKB side effect event")); } parent::addRDF(parent::triplifyString($id, parent::getVoc() . "p-value", $pvalue) . parent::triplifyString($id, parent::getVoc() . "in-sider", $sider == 0 ? "true" : "false") . parent::triplifyString($id, parent::getVoc() . "in-future-aers", $future_aers == 0 ? "true" : "false") . parent::triplifyString($id, parent::getVoc() . "in-medeffect", $medeffect == 0 ? "true" : "false") . parent::describeProperty(parent::getVoc() . "p-value", "Relationship between a side effect and its P value") . parent::describeProperty(parent::getVoc() . "in-sider", "Whether the side effect is in the SIDER resource") . parent::describeProperty(parent::getVoc() . "in-future-aers", "Whether the side effect is in the Future AERS resource") . parent::describeProperty(parent::getVoc() . "in-medeffect", "Whether the side effect is in the Med Effect resource")); } parent::writeRDFBufferToWriteFile(); }
function Parse($file) { parent::getReadFile()->read(); // skip the first comment line $line = 1; $first = true; while ($l = parent::getReadFile()->read(500000)) { if ($l[0] == "#") { // dataset attributes $a = explode('=', trim($l)); $r = $this->getVoc() . substr($a[0], 2); if (isset($a[1])) { $v = $a[1]; if ($r == "affymetrix_vocabulary:genome-version-create_date") { $x = explode("-", $a[1]); if ($x[2] == "00") { $x[2] = "01"; } $v = implode("-", $x); } parent::addRDF(parent::triplifyString(parent::getDatasetURI(), $r, $v) . parent::describe($r, "{$r}")); } continue; } if ($first == true) { $first = false; // header $header = explode(",", str_replace('"', '', trim($l))); // print_r($header);exit; $n = count($header); if ($n != 41) { trigger_error("Expecting 41 columns, found {$n} in header on line {$line}!", E_USER_ERROR); exit; } continue; } $a = explode('","', substr($l, 1, -2)); $n = count($a); if ($n != 41) { trigger_error("Expecting 41 columns, found {$n} on line {$line}!", E_USER_ERROR); exit; } parent::writeRDFBufferToWriteFile(); $id = $a[0]; $qname = "affymetrix:{$id}"; $label = "probeset {$a['0']} on GeneChip {$a['1']} ({$a['2']})"; parent::addRDF(parent::describeIndividual($qname, $label, $this->getVoc() . "Probeset") . parent::describeClass($this->getVoc() . "Probeset", "Affymetrix probeset")); trigger_error($id, E_USER_NOTICE); // now process the entries foreach ($a as $k => $v) { if (trim($v) == '---') { continue; } // multi-valued entries are separated by //// $b = explode(" /// ", $v); $r = $this->Map($k); if (isset($r)) { foreach ($b as $c) { $d = explode(" // ", $c); if ($r == 'symbol') { $d[0] = str_replace(" ", "-", $d[0]); } $s = $this->getRegistry()->getPreferredPrefix($r); if ($s == "ec") { $e = explode(":", $d[0]); $d[0] = $e[1]; } $this->addRDF(parent::triplify($qname, $this->getVoc() . "x-{$s}", "{$s}:" . $d[0]) . parent::describeProperty($this->getVoc() . "x-{$s}", "a relation to {$s}")); } } else { // we handle manually unset($rel); $label = $header[$k]; switch ($label) { case 'GeneChip Array': $array_id = parent::getRes() . str_replace(" ", "-", $v); parent::addRDF(parent::triplify($qname, $this->getVoc() . "genechip-array", $array_id) . parent::describeIndividual($array_id, "Affymetrix {$v} GeneChip array", $this->getVoc() . "Genechip-Array") . parent::describeClass($this->getVoc() . "Genechip-Array", "Affymetrix GeneChip array")); break; case 'Gene Ontology Biological Process': if (!isset($rel)) { $rel = 'go-process'; $prefix = "go"; } case 'Gene Ontology Cellular Component': if (!isset($rel)) { $rel = 'go-location'; $prefix = "go"; } case 'Gene Ontology Molecular Function': if (!isset($rel)) { $rel = 'go-function'; $prefix = "go"; } $b = explode(" /// ", $v); foreach ($b as $c) { $d = explode(" // ", $c); parent::addRDF($this->triplify($qname, $this->getVoc() . $rel, "{$prefix}:" . $d[0]) . $this->describeProperty($this->getVoc() . $rel, "{$rel}")); } break; case 'Transcript Assignments': $b = explode(" /// ", $v); foreach ($b as $c) { $d = explode(" // ", $c); $id = $d[0]; $prefix = $d[2]; if ($prefix == '---' || $id == '---') { continue; } else { if ($prefix == 'gb' || $prefix == 'gb_htc') { $prefix = 'genbank'; } else { if ($prefix == 'ncbibacterial') { $prefix = 'gi'; } else { if ($prefix == 'ncbi_bacterial') { $prefix = 'gi'; } else { if ($prefix == 'ens') { $prefix = 'ensembl'; } else { if ($prefix == 'ncbi_mito' || $prefix == 'ncbi_organelle' || $prefix == 'organelle') { $prefix = 'refseq'; } else { if ($prefix == 'affx' || $prefix == 'unknown' || $prefix == "prop") { $prefix = 'affymetrix'; } else { if ($prefix == 'tigr_2004_08') { $prefix = 'tigr'; } else { if ($prefix == 'tigr-plantta') { $prefix = 'genbank'; } else { if ($prefix == 'newrs.gi') { $prefix = 'gi'; } else { if ($prefix == 'newRS.gi') { $prefix = 'gi'; } else { if ($prefix == 'primate_viral') { $prefix = 'genbank'; } else { if ($prefix == 'jgi-bacterial') { $prefix = 'ncbigene'; } else { if ($prefix == 'tb') { $prefix = 'tuberculist'; } else { if ($prefix == 'pa') { $prefix = 'pseudomonas'; } else { if ($prefix == 'gi|53267') { $prefix = 'gi'; $id = '53267'; } else { if ($prefix == 'broad-tcup') { $e = explode("-", $id); $id = $e[0]; } else { if ($prefix == 'organelle') { $e = explode("-", $id); $prefix = 'genbank'; $id = $e[0]; } } } } } } } } } } } } } } } } } } parent::addRDF(parent::triplify($qname, $this->getVoc() . "transcript-assignment", "{$prefix}:{$id}") . parent::describeProperty($this->getVoc() . "transcript-assignment", "transcript assignment")); } break; case 'Annotation Transcript Cluster': /* $id = substr($v,0,strpos($v,"(")); $rel = str_replace(" ","-",strtolower($label)); $this->AddRDF($this->triplify($qname,parent::getVoc()."$rel", "refseq:$id")); */ break; case 'Annotation Date': // Jun 9, 2011 $rel = "annotation-date"; preg_match("/^([A-Za-z]+) ([0-9]+), ([0-9]{4})\$/", $v, $m); if (count($m) == 4) { array_shift($m); list($m, $day, $year) = $m; $month = $this->getMonth($m); if (!$day || $day == "0") { $day = "01"; } $date = $year . "-" . $month . "-" . str_pad($day, 2, "0", STR_PAD_LEFT) . "T00:00:00Z"; parent::addRDF(parent::triplifyString($qname, $this->getVoc() . $rel, $date, "xsd:dateTime") . parent::describeProperty($this->getVoc() . $rel, "{$rel}")); } else { trigger_error("could not match date from {$v}", E_USER_ERROR); } break; case 'Species Scientific Name': break; case 'Transcript ID(Array Design)': if (!isset($rel)) { $rel = 'transcript'; } case 'Sequence type': default: if (!isset($rel)) { $rel = str_replace(" ", "-", strtolower($label)); } $b = explode(" /// ", $v); foreach ($b as $c) { parent::addRDF(parent::triplifyString($qname, $this->getVoc() . $rel, stripslashes($c)) . parent::describeProperty($this->getVoc() . $rel, "{$rel}")); } break; } // switch } // else } $this->WriteRDFBufferToWriteFile(); } }
/** * add an RDF representation of the incoming param to the model. * @$qual_record_arr is an assoc array with the contents of one qualifier record */ private function makeQualifierRecordRDF($qual_record_arr) { //get the UI of the qualifier record $qr_ui = $qual_record_arr["UI"][0]; $qr_res = $this->getNamespace() . $qr_ui; $qr_label = $qual_record_arr['SH'][0]; parent::AddRDF(parent::describeIndividual($qr_res, $qr_label, $this->getVoc() . "Qualifier-Descriptor", $qr_label) . parent::describeClass($this->getVoc() . "Qualifier-Descriptor", "MeSH Qualifier Descriptor")); //now get the descriptor_data_elements $qde = $this->getQualifierDataElements(); //iterate over the properties foreach ($qual_record_arr as $k => $v) { if (array_key_exists($k, $qde)) { if ($k == "AN") { foreach ($v as $kv => $vv) { //explode by semicolon $vvrar = explode(";", $vv); foreach ($vvrar as $anAn) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde["AN"], $anAn) . parent::describeProperty($this->getVoc() . $qde["AN"], "Relationship between a qualifier record and its annotation")); } //foreach } //foreach } //if if ($k == "DA") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['DA'], $this->formatDate($vv), "xsd:date") . parent::describeProperty($this->getVoc() . $qde['DA'], "Relationship between a qualifier record and its date of entry")); } } //if if ($k == "DQ") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['DQ'], $this->formatDate($vv), "xsd:date") . parent::describeProperty($this->getVoc() . $qde['DQ'], "Relationship between a qualifier record and its date qualifier established")); } } //if if ($k == "GM") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['GM'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['GM'], "Relationship between a qualifier record and its grateful med note")); } } if ($k == "HN") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['HN'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['HN'], "Relationship between a qualifier record and its history note")); } } if ($k == "HN") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['HN'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['HN'], "Relationship between a qualifier record and its history note")); } } if ($k == "MED") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['MED'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['MED'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M94") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M94'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M94'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M90") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M90'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M90'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M85") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M85'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M85'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M80") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M80'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M80'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M75") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M75'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M75'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "M66") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['M66'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['M66'], "Relationship between a qualifier record and its backfile postings")); } } if ($k == "MR") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['MR'], $this->formatDate($vv), "xsd:date") . parent::describeProperty($this->getVoc() . $qde['MR'], "Relationship between a qualifier record and its major revision date")); } } //if if ($k == "MS") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['MS'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['MS'], "Relationship between a qualifier record and its MeSH scope note")); } } if ($k == "OL") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['OL'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['OL'], "Relationship between a qualifier record and its online note")); } } if ($k == "QA") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['QA'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['QA'], "Relationship between a qualifier record and its toplical qualifier abbreviation")); } } if ($k == "QE") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['QE'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['QE'], "Relationship between a qualifier record and its qualifier entry version")); } } if ($k == "QS") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['QS'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['QS'], "Relationship between a qualifier record and its qualifier sort version")); } } if ($k == "QT") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['QT'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['QT'], "Relationship between a qualifier record and its qualifier type")); } } if ($k == "QX") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['QX'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['QX'], "Relationship between a qualifier record and its qualifier cross reference")); } } if ($k == "RECTYPE") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['RECTYPE'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['RECTYPE'], "Relationship between a qualifier record and its record type")); } } if ($k == "SH") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['SH'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['SH'], "Relationship between a qualifier record and its subheading")); } } if ($k == "TN") { foreach ($v as $kv => $vv) { parent::AddRDF(parent::triplifyString($qr_res, $this->getVoc() . $qde['TN'], utf8_encode(htmlspecialchars($vv))) . parent::describeProperty($this->getVoc() . $qde['TN'], "Relationship between a qualifier record and its tree node allowed")); } } } else { trigger_error("Please add key to qualifier record map: " . $k . PHP_EOL, E_USER_ERROR); } //else $this->WriteRDFBufferToWriteFile(); } //foreach $this->WriteRDFBufferToWriteFile(); }
function process() { while ($aLine = $this->GetReadFile()->Read(200000)) { $parsed_line = $this->parse_homologene_tab_line($aLine); $hid = "homologene:" . $parsed_line["hid"]; $hid_label = "homologene group " . $parsed_line['hid']; parent::AddRDF(parent::describeIndividual($hid, $hid_label, $this->getVoc() . "Homologene-Group") . parent::describeClass($this->getVoc() . "Homologene-Group", "Homologene Group")); $geneid = "ncbigene:" . $parsed_line["geneid"]; $taxid = "taxid:" . $parsed_line["taxid"]; $gi = "gi:" . $parsed_line["gi"]; $genesymbol = str_replace("\\", "", $parsed_line["genesymbol"]); $refseq = "refseq:" . $parsed_line["refseq"]; parent::AddRDF(parent::triplify($hid, $this->getVoc() . "x-taxid", $taxid) . parent::describeProperty($this->getVoc() . "x-taxid", "Link to NCBI taxonomy")); parent::AddRDF(parent::triplify($hid, $this->getVoc() . "x-ncbigene", $geneid) . parent::describeProperty($this->getVoc() . "x-ncbigene", "Link to NCBI GeneId")); parent::AddRDF(parent::triplifyString($hid, $this->getVoc() . "gene-symbol", utf8_encode(htmlspecialchars($genesymbol)), "xsd:string") . parent::describeProperty($this->getVoc() . "gene-symbol", "Link to gene symbol")); parent::AddRDF(parent::triplify($hid, $this->getVoc() . "x-gi", $gi) . parent::describeProperty($this->getVoc() . "x-gi", "Link to NCBI GI")); parent::AddRDF(parent::triplify($hid, $this->getVoc() . "x-refseq", $refseq) . parent::describeProperty($this->getVoc() . "x-refseq", "Link to NCBI Refseq")); $this->WriteRDFBufferToWriteFile(); } }
function psiblast() { while ($l = $this->GetReadFile()->Read(2048)) { $a = explode("\t", trim($l)); $id1 = $a[0]; $id2 = $a[7]; $id = "aln_{$id1_}{$id2}"; $this->AddRDF(parent::describeIndividual($this->getRes() . $id, "psiblast alignment between {$id1} and {$id2}", $this->getVoc() . "PSI-BLAST-Alignment") . parent::describeClass($this->getVoc() . "PSI-BLAST-Alignment", "PSI-Blast Alignment") . parent::triplify($this->getRes() . $id, $this->getVoc() . "query", $this->getNamespace() . $id1) . parent::triplify($this->getRes() . $id, $this->getVoc() . "target", $this->getNamespace() . $id2) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "query-start", $a[1]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "query-stop", $a[2]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "target-start", $a[3]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "target-stop", $a[4]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "percent-aligned", $a[5]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "score", $a[6]) . parent::triplifyString($this->getRes() . $id, $this->getVoc() . "is-encoded-by", "taxon:" . $a[8]) . parent::describeProperty($this->getVoc() . "target-start", "Relationship between an SGD sequence alignment and its target sequence start position") . parent::describeProperty($this->getVoc() . "target-stop", "Relationship between an SGD sequence alignment and its target sequence stop position") . parent::describeProperty($this->getVoc() . "score", "Relationship between an SGD sequence alignment and its score") . parent::describeProperty($this->getVoc() . "percent-aligned", "Relationship between an SGD sequence alignment and its percent-aligned value") . parent::describeProperty($this->getVoc() . "is-encoded-by", "Relationship between an SGD sequence alignment and the taxon the aligned sequences are encoded by")); parent::writeRDFBufferToWriteFile(); } //while return TRUE; }