1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099 |
- <?php
- function tripal_chado_populate_chado_semweb_table() {
-
- $chado_tables = chado_get_table_names(TRUE);
- foreach ($chado_tables as $chado_table) {
- tripal_add_chado_semweb_table($chado_table);
- }
-
-
-
-
-
-
- tripal_chado_populate_vocab_EDAM();
- tripal_chado_populate_vocab_ERO();
- tripal_chado_populate_vocab_FOAF();
- tripal_chado_populate_vocab_IAO();
- tripal_chado_populate_vocab_LOCAL();
- tripal_chado_populate_vocab_NCBITAXON();
- tripal_chado_populate_vocab_OBI();
- tripal_chado_populate_vocab_OGI();
- tripal_chado_populate_vocab_RDFS();
- tripal_chado_populate_vocab_SBO();
- tripal_chado_populate_vocab_SCHEMA();
- tripal_chado_populate_vocab_SIO();
- tripal_chado_populate_vocab_SO();
- tripal_chado_populate_vocab_SWO();
- tripal_chado_populate_vocab_TAXRANK();
- tripal_chado_populate_vocab_TPUB();
- tripal_chado_populate_vocab_UO();
- }
- function tripal_chado_populate_vocab_FOAF() {
- tripal_insert_cv('foaf','Friend of a Friend');
- tripal_insert_db(array(
- 'name' => 'foaf',
- 'description' => 'Friend of a Friend',
- 'url' => 'http://www.foaf-project.org/',
- 'urlprefix' => 'http://xmlns.com/foaf/spec/#',
- ));
- tripal_insert_cv('foaf','Friend of a Friend. A dictionary of people-related terms that can be used in structured data).');
- }
- function tripal_chado_populate_vocab_RDFS() {
- tripal_insert_db(array(
- 'name' => 'rdfs',
- 'description' => 'Resource Description Framework Schema',
- 'url' => 'https://www.w3.org/TR/rdf-schema/',
- 'urlprefix' => 'https://www.w3.org/TR/rdf-schema/#ch_',
- ));
- tripal_insert_cv('rdfs','Resource Description Framework Schema');
- $name = tripal_insert_cvterm(array(
- 'id' => 'rdfs:type',
- 'name' => 'type',
- 'cv_name' => 'rdfs',
- 'definition' => 'The type of resource.',
- ));
- $name = tripal_insert_cvterm(array(
- 'id' => 'rdfs:label',
- 'name' => 'label',
- 'cv_name' => 'rdfs',
- 'definition' => 'A human-readable version of a resource\'s name.',
- ));
- }
- function tripal_chado_populate_vocab_SCHEMA() {
- tripal_insert_db(array(
- 'name' => 'schema',
- 'description' => 'Schema.org.',
- 'url' => 'https://schema.org/',
- 'urlprefix' => 'https://schema.org/{accession}',
- ));
- tripal_insert_cv('schema','Schema.org. Schema.org is sponsored by Google, Microsoft, Yahoo and Yandex. The vocabularies are developed by an open community process.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:name',
- 'name' => 'name',
- 'cv_name' => 'schema',
- 'definition' => 'The name of the item.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'name', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:alternateName',
- 'name' => 'alternateName',
- 'cv_name' => 'schema',
- 'definition' => 'An alias for the item.',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:comment',
- 'name' => 'comment',
- 'cv_name' => 'schema',
- 'definition' => 'Comments, typically from users.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'comment', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:description',
- 'name' => 'description',
- 'cv_name' => 'schema',
- 'definition' => 'A description of the item.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'description', $term);
- tripal_associate_chado_semweb_term('organism', 'comment', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:publication',
- 'name' => 'publication',
- 'cv_name' => 'schema',
- 'definition' => 'A publication event associated with the item.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'pub_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:url',
- 'name' => 'url',
- 'cv_name' => 'schema',
- 'definition' => 'URL of the item.',
- ));
- tripal_associate_chado_semweb_term('db', 'URL', $term);
- }
- function tripal_chado_populate_vocab_SIO() {
- tripal_insert_db(array(
- 'name' => 'SIO',
- 'description' => 'Semanticscience Integrated Ontology.',
- 'url' => 'http://sio.semanticscience.org/',
- 'urlprefix' => 'http://semanticscience.org/resource/{db}_{accession}',
- ));
- tripal_insert_cv('SIO',' The Semanticscience Integrated Ontology (SIO) provides a simple, integrated ontology of types and relations for rich description of objects, processes and their attributes.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'SIO:000493',
- 'name' => 'clause',
- 'cv_name' => 'SIO',
- 'definition' => 'A clause consists of a subject and a predicate.',
- ));
- }
- function tripal_chado_populate_vocab_EDAM() {
- tripal_insert_db(array(
- 'name' => 'data',
- 'description' => 'Bioinformatics operations, data types, formats, identifiers and topics.',
- 'url' => 'http://edamontology.org/page',
- 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
- ));
- tripal_insert_db(array(
- 'name' => 'EDAM',
- 'description' => 'Bioinformatics operations, data types, formats, identifiers and topics.',
- 'url' => 'http://edamontology.org/page',
- 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
- ));
- tripal_insert_cv('data','Bioinformatics operations, data types, formats, identifiers and topics.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1249',
- 'name' => 'Sequence length',
- 'cv_name' => 'EDAM',
- 'definition' => 'The size (length) of a sequence, subsequence or region in a sequence, or range(s) of lengths.',
- ));
- tripal_associate_chado_semweb_term('feature', 'seqlen', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:2190',
- 'name' => 'Sequence checksum',
- 'cv_name' => 'EDAM',
- 'definition' => 'A fixed-size datum calculated (by using a hash function) for a molecular sequence, typically for purposes of error detection or indexing.',
- ));
- tripal_associate_chado_semweb_term('feature', 'md5checksum', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:2091',
- 'name' => 'Accession',
- 'cv_name' => 'EDAM',
- 'definition' => 'A persistent (stable) and unique identifier, typically identifying an object (entry) from a database.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'dbxref_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:2044',
- 'name' => 'Sequence',
- 'cv_name' => 'EDAM',
- 'definition' => 'One or more molecular sequences, possibly with associated annotation..',
- ));
- tripal_associate_chado_semweb_term('feature', 'residues', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:0842',
- 'name' => 'Identifier',
- 'cv_name' => 'EDAM',
- 'definition' => 'A text token, number or something else which identifies an entity, but which may not be persistent (stable) or unique (the same identifier may identify multiple things).',
- ));
- tripal_associate_chado_semweb_term(NULL, 'uniquename', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:2968',
- 'name' => 'Image',
- 'cv_name' => 'EDAM',
- 'definition' => 'Biological or biomedical data has been rendered into an image, typically for display on screen.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'eimage_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1274',
- 'name' => 'Map',
- 'cv_name' => 'EDAM',
- 'definition' => 'A map of (typically one) DNA sequence annotated with positional or non-positional features.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'eimage_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1278',
- 'name' => 'Genetic map',
- 'cv_name' => 'EDAM',
- 'definition' => 'A map showing the relative positions of genetic markers in a nucleic acid sequence, based on estimation of non-physical distance such as recombination frequencies.',
- ));
- tripal_associate_chado_semweb_term('featuremap', 'featuremap_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1280',
- 'name' => 'Physical map',
- 'cv_name' => 'EDAM',
- 'definition' => 'A map of DNA (linear or circular) annotated with physical features or landmarks such as restriction sites, cloned DNA fragments, genes or genetic markers, along with the physical distances between them. Distance in a physical map is measured in base pairs. A physical map might be ordered relative to a reference map (typically a genetic map) in the process of genome sequencing.',
- ));
- tripal_associate_chado_semweb_term('featuremap', 'featuremap_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:2012',
- 'name' => 'Sequence coordinates',
- 'cv_name' => 'EDAM',
- 'definition' => 'A position in a map (for example a genetic map), either a single position (point) or a region / interval.',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1056',
- 'name' => 'Databse name',
- 'cv_name' => 'EDAM',
- 'definition' => 'The name of a biological or bioinformatics database.',
- ));
- tripal_associate_chado_semweb_term('db', 'name', $term);
- }
- function tripal_chado_populate_vocab_ERO() {
- tripal_insert_db(array(
- 'name' => 'ERO',
- 'description' => 'The Eagle-I Research Resource Ontology',
- 'url' => 'http://purl.bioontology.org/ontology/ERO',
- 'urlprefix' => 'http://purl.bioontology.org/ontology/ERO/{db}:{accession}',
- ));
- tripal_insert_cv('ero','The Eagle-I Research Resource Ontology models research resources such instruments. protocols, reagents, animal models and biospecimens. It has been developed in the context of the eagle-i project (http://eagle-i.net/).');
- $term = tripal_insert_cvterm(array(
- 'id' => 'ERO:0001716',
- 'name' => 'database',
- 'cv_name' => 'ero',
- 'definition' => 'A database is an organized collection of data, today typically in digital form.',
- ));
- }
- function tripal_chado_populate_vocab_OBI() {
- tripal_insert_db(array(
- 'name' => 'OBI',
- 'description' => 'The Ontology for Biomedical Investigation.',
- 'url' => 'http://obi-ontology.org/page/Main_Page',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
- ));
- tripal_insert_cv('obi','Ontology for Biomedical Investigation. The Ontology for Biomedical Investigations (OBI) is build in a collaborative, international effort and will serve as a resource for annotating biomedical investigations, including the study design, protocols and instrumentation used, the data generated and the types of analysis performed on the data. This ontology arose from the Functional Genomics Investigation Ontology (FuGO) and will contain both terms that are common to all biomedical investigations, including functional genomics investigations and those that are more domain specific.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'OBI:0100026',
- 'name' => 'organism',
- 'cv_name' => 'obi',
- 'definition' => 'A material entity that is an individual living system, such as animal, plant, bacteria or virus, that is capable of replicating or reproducing, growth and maintenance in the right environment. An organism may be unicellular or made up, like humans, of many billions of cells divided into specialized tissues and organs.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'organism_id', $term);
- }
- function tripal_chado_populate_vocab_OGI() {
- tripal_insert_db(array(
- 'name' => 'OGI',
- 'description' => 'Ontology for genetic interval.',
- 'url' => 'http://purl.bioontology.org/ontology/OGI',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
- ));
- tripal_insert_cv('obi','Ontology for Biomedical Investigation. The Ontology for Biomedical Investigations (OBI) is build in a collaborative, international effort and will serve as a resource for annotating biomedical investigations, including the study design, protocols and instrumentation used, the data generated and the types of analysis performed on the data. This ontology arose from the Functional Genomics Investigation Ontology (FuGO) and will contain both terms that are common to all biomedical investigations, including functional genomics investigations and those that are more domain specific.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'OGI:0000021',
- 'name' => 'location on map',
- 'cv_name' => 'ogi',
- 'definition' => '',
- ));
- tripal_associate_chado_semweb_term(NULL, 'organism_id', $term);
- }
- function tripal_chado_populate_vocab_IAO() {
- tripal_insert_db(array(
- 'name' => 'IAO',
- 'description' => 'The Information Artifact Ontology (IAO).',
- 'url' => 'https://github.com/information-artifact-ontology/IAO/',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/IAO_',
- ));
- tripal_insert_cv('IAO','Information Artifact Ontology is a new ' .
- 'ontology of information entities, originally driven by work by the ' .
- 'OBI digital entity and realizable information entity branch.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'IAO:0000115',
- 'name' => 'definition',
- 'cv_name' => 'iao',
- 'definition' => 'The official OBI definition, explaining the meaning of ' .
- 'a class or property. Shall be Aristotelian, formalized and normalized. ' .
- 'Can be augmented with colloquial definitions.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'definition', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'IAO:0000129',
- 'name' => 'version number',
- 'cv_name' => 'IAO',
- 'definition' => 'A version number is an ' .
- 'information content entity which is a sequence of characters ' .
- 'borne by part of each of a class of manufactured products or its ' .
- 'packaging and indicates its order within a set of other products ' .
- 'having the same name.',
- ));
- tripal_associate_chado_semweb_term('analysis', 'programversion', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'IAO:0000064',
- 'name' => 'algorithm',
- 'cv_name' => 'IAO',
- 'definition' => 'An algorithm is a set of instructions for performing a paticular calculation.',
- ));
- tripal_associate_chado_semweb_term('analysis', 'algorithm', $term);
- }
- function tripal_chado_populate_vocab_LOCAL() {
- tripal_insert_db(array(
- 'name' => 'local',
- 'description' => 'Terms created for this site.',
- 'url' => '/cv/lookup',
- 'urlprefix' => '/cv/lookup/{db}/{accession}',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:timelastmodified',
- 'name' => 'time_last_modified',
- 'cv_name' => 'local',
- 'definition' => 'The time at which the record was last modified.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'timelastmodified', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:timeaccessioned',
- 'name' => 'time_accessioned',
- 'cv_name' => 'local',
- 'definition' => 'The time at which the record was first added.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'timeaccessioned', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:timeexecuted',
- 'name' => 'time_executed',
- 'cv_name' => 'local',
- 'definition' => 'The time when the task was executed.',
- ));
- tripal_associate_chado_semweb_term(NULL, 'timeexecuted', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:infraspecific_type',
- 'name' => 'infraspecific_type',
- 'definition' => 'The connector type (e.g. subspecies, varietas, forma, etc.) for the infraspecific name',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term('organism', 'type_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:abbreviation',
- 'name' => 'abbreviation',
- 'cv_name' => 'local',
- 'definition' => 'A shortened name (or abbreviation) for the item.'
- ));
- tripal_associate_chado_semweb_term('organism', 'abbreviation', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:expression',
- 'name' => 'expression',
- 'definition' => 'Curated expression data',
- 'cv_name' => 'local',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:is_analysis',
- 'name' => 'is_analysis',
- 'definition' => 'Indicates if this feature was predicted computationally using another feature.',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term('feature', 'is_analysis', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:is_obsolete',
- 'name' => 'is_obsolete',
- 'definition' => 'Indicates if this record is obsolete.',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term(NULL, 'is_obsolete', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:relationship_subject',
- 'name' => 'clause subject',
- 'definition' => 'The subject of a relationship clause.',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term(NULL, 'subject_id', $term);
- tripal_associate_chado_semweb_term(NULL, 'subject_reagent_id', $term);
- tripal_associate_chado_semweb_term(NULL, 'subject_project_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:relationship_object',
- 'name' => 'clause predicate',
- 'definition' => 'The object of a relationship clause.',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term(NULL, 'object_id', $term);
- tripal_associate_chado_semweb_term(NULL, 'object_reagent_id', $term);
- tripal_associate_chado_semweb_term(NULL, 'object_project_id', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:relationship_type',
- 'name' => 'relationship type',
- 'definition' => 'The relationship type.',
- 'cv_name' => 'local',
- ));
- tripal_associate_chado_semweb_term('acquisition_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('biomaterial_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('cell_line_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('contact_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('element_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('elementresult_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('feature_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('nd_reagent_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('phylonode_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('project_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('pub_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('quantification_relationship', 'type_id', $term);
- tripal_associate_chado_semweb_term('stock_relationship', 'type_id', $term);
- }
- function tripal_chado_populate_vocab_SBO() {
- tripal_insert_db(array(
- 'name' => 'SBO',
- 'description' => 'Systems Biology.',
- 'url' => 'http://www.ebi.ac.uk/sbo/main/',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
- ));
- tripal_insert_cv('sbo','Systems Biology. Terms commonly used in Systems Biology, and in particular in computational modeling.');
- $dbxref = tripal_insert_cvterm(array(
- 'id' => 'SBO:0000358',
- 'name' => 'phenotype',
- 'cv_name' => 'sbo',
- 'definition' => 'A biochemical network can generate phenotypes or affects biological processes. Such processes can take place at different levels and are independent of the biochemical network itself.',
- ));
- $dbxref = tripal_insert_cvterm(array(
- 'id' => 'SBO:0000554',
- 'name' => 'database cross reference',
- 'cv_name' => 'sbo',
- 'definition' => 'An annotation which directs one to information contained within a database.',
- ));
- $relationship = tripal_insert_cvterm(array(
- 'id' => 'SBO:0000374',
- 'name' => 'relationship',
- 'cv_name' => 'sbo',
- 'definition' => 'Connectedness between entities and/or interactions representing their relatedness or influence.',
- ));
- }
- function tripal_chado_populate_vocab_SO() {
- tripal_insert_db(array(
- 'name' => 'SO',
- 'description' => 'Sequence Ontology',
- 'url' => 'http://www.sequenceontology.org',
- 'urlprefix' => 'http://www.sequenceontology.org/browser/current_svn/term/{db}:{accession}',
- ));
- tripal_insert_cv('sequence','The Sequence Ontology.');
- }
- function tripal_chado_populate_vocab_SWO() {
- tripal_insert_db(array(
- 'name' => 'SWO',
- 'description' => 'Software Ontology',
- 'url' => 'http://theswo.sourceforge.net/',
- 'urlprefix' => '',
- ));
- tripal_insert_cv('swo','Software Ontology. An ontology representation of the NCBI organismal taxonomy.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'SWO:0000001',
- 'name' => 'software',
- 'cv_name' => 'swo',
- 'definition' => 'Computer software, or generally just software, is any ' .
- 'set of machine-readable instructions (most often in the form of a ' .
- 'computer program) that conform to a given syntax (sometimes ' .
- 'referred to as a language) that is interpretable by a given ' .
- 'processor and that directs a computer\'s processor to perform ' .
- 'specific operations.',
- ));
- tripal_associate_chado_semweb_term('analysis', 'program', $term);
- }
- function tripal_chado_populate_vocab_TPUB() {
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000039'));
- tripal_associate_chado_semweb_term('pub', 'title', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000243'));
- tripal_associate_chado_semweb_term('pub', 'volumetitle', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000042'));
- tripal_associate_chado_semweb_term('pub', 'volume', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000256'));
- tripal_associate_chado_semweb_term('pub', 'series_name', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000043'));
- tripal_associate_chado_semweb_term('pub', 'issue', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000059'));
- tripal_associate_chado_semweb_term('pub', 'pyear', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000044'));
- tripal_associate_chado_semweb_term('pub', 'pages', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000244'));
- tripal_associate_chado_semweb_term('pub', 'publisher', $term);
- $term = tripal_get_cvterm(array('id' => 'TPUB:0000245'));
- tripal_associate_chado_semweb_term('pub', 'pubplace', $term);
- }
- function tripal_chado_populate_vocab_UO() {
- tripal_insert_db(array(
- 'name' => 'UO',
- 'description' => 'Units of Measurement Ontology',
- 'url' => 'http://purl.obolibrary.org/obo/uo',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/TAXRANK_',
- ));
- tripal_insert_cv('uo','Units of Measurement Ontology');
- $term = tripal_insert_cvterm(array(
- 'id' => 'UO:0000000',
- 'name' => 'unit',
- 'cv_name' => 'uo',
- 'description' => 'A unit of measurement is a standardized quantity of a physical quality.'
- ));
- tripal_associate_chado_semweb_term('featuremap', 'unittype_id', $term);
- }
- function tripal_chado_populate_vocab_TAXRANK() {
- tripal_insert_db(array(
- 'name' => 'TAXRANK',
- 'description' => 'Taxonomic rank vocabulary.',
- 'url' => 'https://github.com/phenoscape/taxrank',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/TAXRANK_',
- ));
- tripal_insert_cv('taxrank','Taxonomic rank vocabulary. A vocabulary of taxonomic ranks (species, family, phylum, etc).');
- $term = tripal_insert_cvterm(array(
- 'id' => 'TAXRANK:0000005',
- 'name' => 'genus',
- 'cv_name' => 'taxonomic_rank',
- 'description' => 'Taxonomic rank of Genus'
- ));
- tripal_associate_chado_semweb_term('organism', 'genus', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'TAXRANK:0000006',
- 'name' => 'species',
- 'cv_name' => 'taxonomic_rank',
- 'description' => 'Taxonomic rank of species.'
- ));
- tripal_associate_chado_semweb_term('organism', 'species', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'TAXRANK:0000045',
- 'name' => 'infraspecies',
- 'cv_name' => 'taxonomic_rank',
- 'description' => 'Taxonomic infraspecies name.'
- ));
- tripal_associate_chado_semweb_term('organism', 'infraspecific_name', $term);
- }
- function tripal_chado_populate_vocab_NCBITAXON() {
- tripal_insert_db(array(
- 'name' => 'NCBITaxon',
- 'description' => 'NCBI organismal classification.',
- 'url' => 'http://www.berkeleybop.org/ontologies/ncbitaxon/',
- 'urlprefix' => 'http://purl.obolibrary.org/obo/ncbitaxon#',
- ));
- tripal_insert_cv('ncbitaxon','NCBI organismal classification. An ontology representation of the NCBI organismal taxonomy.');
- $term = tripal_insert_cvterm(array(
- 'id' => 'NCBITaxon:common_name',
- 'name' => 'common name',
- 'cv_name' => 'ncbitaxon',
- ));
- tripal_associate_chado_semweb_term('organism', 'common_name', $term);
- }
- function tripal_chado_semweb_form($form, &$form_state, $chado_table = NULL) {
- if (array_key_exists('values', $form_state)) {
- $chado_table = $form_state['values']['chado_table'];
- }
- $chado_tables = chado_get_table_names(TRUE);
- $chado_tables = array_merge(array('Select a Chado Table'), $chado_tables);
-
- $chado_table = in_array($chado_table, $chado_tables) ? $chado_table: NULL;
- $form['chado_table'] = array(
- '#type' => 'select',
- '#title' => 'Chado Table',
- '#description' => t('Select a chado table to set web services terms used for its columns.'),
- '#options' => $chado_tables,
- '#default_value' => $chado_table,
- '#ajax' => array(
- 'callback' => "tripal_chado_semweb_form_ajax_callback",
- 'wrapper' => "tripal-chado-semweb-form",
- 'effect' => 'fade',
- 'method' => 'replace'
- ),
- );
-
-
- if ($chado_table) {
- $schema = chado_get_schema($chado_table);
- $pk = $schema['primary key'][0];
- $columns = $schema['fields'];
- $headers = array(
- 'Field Name',
- 'Vocabulary',
- array(
- 'data' => 'Name',
- 'nowrap' => TRUE,
- ),
- 'Term',
- 'Term Description',
- 'Action'
- );
- $rows = array();
- foreach ($columns AS $column => $detail) {
-
- if ($column != $pk && $column != $cv_default) {
- $cvterm_id =
- db_select('chado_semweb', 'cs')
- ->fields('cs', array('cvterm_id'))
- ->condition('chado_table', $chado_table)
- ->condition('chado_column', $column)
- ->execute()
- ->fetchField();
- $sw_voc = '';
- $sw_term = '';
- $sw_desc = '';
- $sw_accession = '';
- if($cvterm_id) {
- $term = chado_generate_var('cvterm', array('cvterm_id' => $cvterm_id));
- $sw_voc = $term->cv_id->name;
- $sw_term = $term->name;
- $sw_accession = l($term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession,
- 'cv/lookup/' . $term->dbxref_id->db_id->name . '/' . $term->dbxref_id->accession,
- array('attributes' => array('target' => '_blank')));
- $sw_desc = $term->definition;
- }
- $rows[] = array(
- $column,
- $sw_voc,
- $sw_term,
- $sw_accession,
- $sw_desc,
- array(
- 'data' => l('Edit', '/admin/tripal/storage/chado/semweb/edit/' . $chado_table . '/' . $column) . ' | ' .
- l('Reset', '/admin/tripal/storage/chado/semweb/reset/' . $chado_table . '/' . $column),
- 'nowrap' => TRUE,
- ),
- );
- }
- }
- $output = theme('table', array(
- 'header' => $headers,
- 'rows' => $rows,
- ));
- $form['table'] = array(
- '#markup' => $output
- );
- }
- $form['#prefix'] = '<div id="tripal-chado-semweb-form">';
- $form['#suffix'] = '</div>';
- return $form;
- }
- function tripal_chado_semweb_edit_form($form, &$form_state, $table = NULL, $column = NULL) {
- $term_name = array_key_exists('values', $form_state) ? $form_state['values']['term_name'] : '';
- $form['chado_table'] = array(
- '#markup' => 'Term used for the <strong>' . t($column) . '</strong> column of the chado <strong>' . t($table) . '</strong> table:',
- );
- $form['table_name'] = array(
- '#type' => 'value',
- '#value' => $table
- );
- $form['column'] = array(
- '#type' => 'value',
- '#value' => $column
- );
-
- $form['term_name'] = array(
- '#title' => t('Term'),
- '#type' => 'textfield',
- '#description' => t("The content type must be the name of a term in
- a controlled vocabulary and the controlled vocabulary should
- already be loaded into Tripal. For example, to create a content
- type for storing 'genes', use the 'gene' term from the
- Sequence Ontology (SO)."),
- '#required' => TRUE,
- '#default_value' => $term_name,
- '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
- );
- $form['select_button'] = array(
- '#type' => 'button',
- '#value' => t('Lookup Term'),
- '#name' => 'select_cvterm',
- '#ajax' => array(
- 'callback' => "tripal_chado_semweb_form_ajax_callback",
- 'wrapper' => "tripal-chado-semweb-edit-form",
- 'effect' => 'fade',
- 'method' => 'replace'
- ),
- );
- if ($term_name) {
- $form['terms_list'] = array(
- '#type' => 'fieldset',
- '#title' => t('Matching Terms'),
- '#description' => t('Please select the term the best matches the
- content type you want to create. If the same term exists in
- multiple vocabularies you will see more than one option below.')
- );
- $match = array(
- 'name' => $term_name,
- );
- $terms = chado_generate_var('cvterm', $match, array('return_array' => TRUE));
- $terms = chado_expand_var($terms, 'field', 'cvterm.definition');
- $num_terms = 0;
- foreach ($terms as $term) {
-
-
- $default = FALSE;
- $attrs = array();
- if ($num_terms == 0 and count($terms) == 1) {
- $default = TRUE;
- $attrs = array('checked' => 'checked');
- }
- $form['terms_list']['term-' . $term->cvterm_id] = array(
- '#type' => 'checkbox',
- '#title' => $term->name,
- '#default_value' => $default,
- '#attributes' => $attrs,
- '#description' => '<b>Vocabulary:</b> ' . $term->cv_id->name . ' (' . $term->dbxref_id->db_id->name . ') ' . $term->cv_id->definition .
- '<br><b>Term: </b> ' . $term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession . '. ' .
- '<br><b>Definition:</b> ' . $term->definition,
- );
- $num_terms++;
- }
- if ($num_terms == 0) {
- $form['terms_list']['none'] = array(
- '#type' => 'item',
- '#markup' => '<i>' . t('There is no term that matches the entered text.') . '</i>'
- );
- }
-
- $form['submit_button'] = array(
- '#type' => 'submit',
- '#value' => t('Use this term'),
- '#name' => 'use_cvterm'
- );
- }
- $form['cancel_button'] = array(
- '#type' => 'button',
- '#value' => t('Cancel'),
- '#name' => 'cancel_button',
- '#limit_validation_errors' => array()
- );
- $form['#prefix'] = '<div id = "tripal-chado-semweb-edit-form">';
- $form['#suffix'] = '</div>';
- return $form;
- }
- function tripal_chado_semweb_edit_form_validate($form, &$form_state) {
- if (array_key_exists('clicked_button', $form_state)) {
- if ($form_state['clicked_button']['#name'] =='use_cvterm') {
- $cvterm_id = NULL;
-
- $num_selected = 0;
- foreach ($form_state['values'] as $key => $value) {
- $matches = array();
- if (preg_match("/^term-(\d+)$/", $key, $matches) and
- $form_state['values']['term-' . $matches[1]]) {
- $cvterm_id = $matches[1];
- $num_selected++;
- }
- }
- if ($num_selected == 0) {
- form_set_error('', 'Please select at least one term.');
- }
- else if ($num_selected > 1) {
- form_set_error('term-' . $cvterm_id, 'Please select only one term from the list below.');
- }
- else {
- $form_state['values']['#selected_cvterm_id'] = $cvterm_id;
- }
- }
- else if ($form_state['clicked_button']['#name'] =='cancel_button') {
- $table_name = $form_state['values']['table_name'];
- drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
- }
- }
- }
- function tripal_chado_semweb_edit_form_submit($form, &$form_state) {
- if (array_key_exists('clicked_button', $form_state) && $form_state['clicked_button']['#name'] =='use_cvterm') {
- $table_name = $form_state['values']['table_name'];
- $column = $form_state['values']['column'];
- $cvterm_id = $form_state['values']['#selected_cvterm_id'];
-
- $record_id =
- db_select('chado_semweb', 'cs')
- ->fields('cs', array('chado_semweb_id'))
- ->condition('chado_table', $table_name)
- ->condition('chado_column', $column)
- ->execute()
- ->fetchField();
-
- if ($record_id) {
- db_update('chado_semweb')
- ->fields(array(
- 'cvterm_id' => $cvterm_id
- ))
- ->condition('chado_semweb_id', $record_id)
- ->execute();
- }
-
- else {
- db_insert('chado_semweb')
- ->fields(array(
- 'chado_table' => $table_name,
- 'chado_column' => $column,
- 'cvterm_id' => $cvterm_id
- ))
- ->execute();
- }
- drupal_set_message('The term settings have been saved.');
- drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
- }
- }
- function tripal_chado_semweb_reset_form($form, &$form_state, $table = NULL, $column = NULL) {
- $term_name = array_key_exists('values', $form_state) ? $form_state['values']['term_name'] : '';
- $form['chado_table'] = array(
- '#markup' => 'Are you sure you want to remove the use of this term? ',
- );
- $form['table_name'] = array(
- '#type' => 'value',
- '#value' => $table
- );
- $form['column'] = array(
- '#type' => 'value',
- '#value' => $column
- );
- $form['submit_button'] = array(
- '#type' => 'submit',
- '#value' => t('Reset'),
- '#name' => 'reset_term'
- );
- $form['cancel_button'] = array(
- '#type' => 'button',
- '#value' => t('Cancel'),
- '#name' => 'cancel_button',
- '#limit_validation_errors' => array()
- );
- return $form;
- }
- function tripal_chado_semweb_reset_form_validate($form, &$form_state) {
- if (array_key_exists('clicked_button', $form_state)) {
- if ($form_state['clicked_button']['#name'] =='use_cvterm') {
- $cvterm_id = NULL;
-
- $num_selected = 0;
- foreach ($form_state['values'] as $key => $value) {
- $matches = array();
- if (preg_match("/^term-(\d+)$/", $key, $matches) and
- $form_state['values']['term-' . $matches[1]]) {
- $cvterm_id = $matches[1];
- $num_selected++;
- }
- }
- if ($num_selected == 0) {
- form_set_error('', 'Please select at least one term.');
- }
- else if ($num_selected > 1) {
- form_set_error('term-' . $cvterm_id, 'Please select only one term from the list below.');
- }
- else {
- $form_state['values']['#selected_cvterm_id'] = $cvterm_id;
- }
- }
- else if ($form_state['clicked_button']['#name'] =='cancel_button') {
- $table_name = $form_state['values']['table_name'];
- drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
- }
- }
- }
- function tripal_chado_semweb_reset_form_submit($form, &$form_state) {
- if (array_key_exists('clicked_button', $form_state) && $form_state['clicked_button']['#name'] =='reset_term') {
- $table_name = $form_state['values']['table_name'];
- $column = $form_state['values']['column'];
-
- $record_id =
- db_select('chado_semweb', 'cs')
- ->fields('cs', array('chado_semweb_id'))
- ->condition('chado_table', $table_name)
- ->condition('chado_column', $column)
- ->execute()
- ->fetchField();
-
- if ($record_id) {
- db_update('chado_semweb')
- ->fields(array(
- 'cvterm_id' => NULL
- ))
- ->condition('chado_semweb_id', $record_id)
- ->execute();
- }
- drupal_set_message('The term settings have been reset.');
- drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
- }
- }
- function tripal_chado_semweb_form_ajax_callback($form, $form_state) {
- return $form;
- }
|