123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722 |
- <?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_SWO();
- tripal_chado_populate_vocab_TAXRANK();
- tripal_chado_populate_vocab_TCONTACT();
- tripal_chado_populate_vocab_TPUB();
- tripal_chado_populate_vocab_UO();
- }
- function tripal_chado_populate_vocab_FOAF() {
- 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);
-
-
-
-
-
-
- $term = tripal_insert_cvterm(array(
- 'id' => 'schema:additionalType',
- 'name' => 'additionalType',
- 'cv_name' => 'An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in.',
- 'definition' => 'URL of the item.',
- ));
- $tables = chado_get_table_names(TRUE);
- foreach ($tables as $table) {
- $schema = chado_get_schema($table);
-
-
- if ($table == 'organism') {
- continue;
- }
- if (in_array("type_id", array_keys($schema['fields']))) {
- tripal_associate_chado_semweb_term($table, 'type_id', $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.',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'SIO:000631',
- 'name' => 'references',
- 'cv_name' => 'SIO',
- 'definition' => 'references is a relation between one entity and the entity that it makes reference to by name, but is not described by it.',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'SIO:000056',
- 'name' => 'position',
- 'cv_name' => 'SIO',
- 'definition' => 'A measurement of a spatial location relative to a frame of reference or other objects.',
- ));
- tripal_associate_chado_semweb_term('featurepos', 'mappos', $term);
- }
- 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' => 'Database name',
- 'cv_name' => 'EDAM',
- 'definition' => 'The name of a biological or bioinformatics database.',
- ));
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1048',
- 'name' => 'Database ID',
- 'cv_name' => 'EDAM',
- 'definition' => 'An identifier of a biological or bioinformatics database.',
- ));
- tripal_associate_chado_semweb_term('db', 'name', $term);
- $term = tripal_insert_cvterm(array(
- 'id' => 'data:1047',
- 'name' => 'URI',
- 'cv_name' => 'EDAM',
- 'definition' => 'The name of a biological or bioinformatics database.',
- ));
- tripal_associate_chado_semweb_term('analysis', 'sourceuri', $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(
- 'ogi',
- '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' => '',
- ));
- }
- 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' => 'null',
- 'description' => 'No online database.'
- ));
- tripal_insert_db(array(
- 'name' => 'local',
- 'description' => 'Terms created for this site.',
- 'url' => '/cv/lookup',
- 'urlprefix' => '/cv/lookup/{db}/{accession}',
- ));
-
-
-
- tripal_insert_cv(
- 'local',
- 'Locally created terms.'
- );
- tripal_insert_cv(
- 'organism_property',
- 'A local vocabulary that contains locally defined properties for organisms'
- );
- tripal_insert_cv(
- 'tripal_phylogeny',
- 'Terms used by the Tripal phylotree module for phylogenetic and taxonomic trees.'
- );
-
- tripal_insert_cv(
- 'feature_relationship',
- 'A local vocabulary that contains types of relationships between features.'
- );
-
-
-
-
- tripal_insert_cv(
- 'feature_property',
- 'A local vocabulary that contains properties for genomic features'
- );
-
-
- tripal_insert_cv(
- 'contact_property',
- 'A local vocabulary that contains properties for contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
- );
-
-
- tripal_insert_cv(
- 'contact_type',
- 'A local vocabulary that contains types of contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
- );
-
- tripal_insert_cv(
- 'tripal_contact',
- 'A local vocabulary that contains a heirarchical set of terms for describing a contact. It is intended to be used as the default vocabularies in Tripal for contact types and contact properties.'
- );
-
- tripal_insert_cv(
- 'contact_relationship',
- 'A local vocabulary that contains types of relationships between contacts.'
- );
- tripal_insert_cv(
- 'featuremap_units',
- 'A local vocabulary that contains map unit types for the unittype_id column of the featuremap table.'
- );
- tripal_insert_cv(
- 'featurepos_property',
- 'A local vocabulary that contains terms map properties.'
- );
- tripal_insert_cv(
- 'featuremap_property',
- 'A local vocabulary that contains positional types for the feature positions'
- );
- tripal_insert_cv(
- 'library_property',
- 'A local vocabulary that contains properties for libraries.'
- );
- tripal_insert_cv(
- 'library_type',
- 'A local vocabulary that contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
- );
-
- tripal_insert_cv(
- 'project_property',
- 'A local vocabulary that contains properties for projects'
- );
-
- tripal_insert_cv(
- 'project_relationship',
- 'A local vocabulary that contains Types of relationships between projects.'
- );
-
- tripal_insert_cv(
- 'tripal_pub',
- 'A local vocabulary that contains a heirarchical set of terms for describing a publication. It is intended to be used as the default vocabularies in Tripal for publication types and contact properties.'
- );
-
- tripal_insert_cv(
- 'pub_type',
- 'A local vocabulary that contains types of publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
- );
-
- tripal_insert_cv(
- 'pub_property',
- 'A local vocabulary that contains properties for publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
- );
-
- tripal_insert_cv(
- 'pub_relationship',
- 'A local vocabulary that contains types of relationships between publications.'
- );
-
- tripal_insert_cv(
- 'stock_relationship',
- 'A local vocabulary that contains types of relationships between stocks.'
- );
- tripal_insert_cv(
- 'stock_property',
- 'A local vocabulary that contains properties for stocks.'
- );
- tripal_insert_cv(
- 'stock_type',
- 'A local vocabulary that contains a list of types for stocks.'
- );
- tripal_insert_cv(
- 'tripal_analysis',
- 'A local vocabulary that contains terms used for analyses.'
- );
-
-
-
- $term = tripal_insert_cvterm(array(
- 'id' => 'local:property',
- 'name' => 'property',
- 'cv_name' => 'local',
- 'definition' => 'A generic term indicating that represents an attribute, quality or characteristic of something.',
- ));
-
-
-
- $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);
-
-
-
-
- $term = tripal_insert_cvterm(array(
- 'id' => 'locak:rank',
- 'name' => 'rank',
- 'definition' => 'A taxonmic rank',
- 'cv_name' => 'local',
- ));
- $terms = array(
- 'lineage',
- 'genetic_code',
- 'genetic_code_name',
- 'mitochondrial_genetic_code',
- 'mitochondrial_genetic_code_name',
- 'division',
- 'genbank_common_name',
- 'synonym',
- 'other_name',
- 'equivalent_name',
- 'anamorph'
- );
- $options = array('update_existing' => TRUE);
- foreach ($terms as $term) {
- $value = array(
- 'name' => $term,
- 'definition' => '',
- 'cv_name' => 'organism_property',
- 'db_name' => 'local'
- );
- tripal_insert_cvterm($value, $options);
- }
-
-
-
-
- tripal_insert_cvterm(array(
- 'name' => 'phylo_leaf',
- 'definition' => 'A leaf node in a phylogenetic tree.',
- 'cv_name' => 'tripal_phylogeny',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'name' => 'phylo_root',
- 'definition' => 'The root node of a phylogenetic tree.',
- 'cv_name' => 'tripal_phylogeny',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'name' => 'phylo_interior',
- 'definition' => 'An interior node in a phylogenetic tree.',
- 'cv_name' => 'tripal_phylogeny',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'name' => 'taxonomy',
- 'definition' => 'A term used to indicate if a phylotree is a taxonomic tree',
- 'cv_name' => 'tripal_phylogeny',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
-
-
-
-
-
- tripal_insert_cvterm(array(
- 'name' => 'Project Description',
- 'definition' => 'Description of a project',
- 'cv_name' => 'project_property',
- 'db_name' => 'local'
- ));
-
-
-
-
- tripal_insert_cvterm(array(
- 'name' => 'Genotyping',
- 'definition' => 'An experiment where genotypes of individuals are identified.',
- 'cv_name' => 'nd_experiment_types',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Phenotyping',
- 'definition' => 'An experiment where phenotypes of individuals are identified.',
- 'cv_name' => 'nd_experiment_types',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Location',
- 'definition' => 'The name of the location.',
- 'cv_name' => 'nd_geolocation_property',
- 'db_name' => 'local'
- ));
-
-
-
-
-
-
- tripal_insert_cvterm(array(
- 'id' => 'local:library_description',
- 'name' => 'Library Description',
- 'definition' => 'Description of a library',
- 'cv_name' => 'library_property',
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'id' => 'local:cdna_library',
- 'name' => 'cdna_library',
- 'definition' => 'cDNA library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:bac_library',
- 'name' => 'bac_library',
- 'definition' => 'Bacterial Artifical Chromsome (BAC) library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:fosmid_library',
- 'name' => 'fosmid_library',
- 'definition' => 'Fosmid library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:cosmid_library',
- 'name' => 'cosmid_library',
- 'definition' => 'Cosmid library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:yac_library',
- 'name' => 'yac_library',
- 'definition' => 'Yeast Artificial Chromosome (YAC) library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:genomic_library',
- 'name' => 'genomic_library',
- 'definition' => 'Genomic Library',
- 'cv_name' => 'library_type',
- 'db_name' => 'local'
- ));
-
-
-
-
- tripal_insert_cvterm(array(
- 'name' => 'cM',
- 'definition' => 'Centimorgan units',
- 'cv_name' => 'featuremap_units',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'bp',
- 'definition' => 'Base pairs units',
- 'cv_name' => 'featuremap_units',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'bin_unit',
- 'definition' => 'The bin unit',
- 'cv_name' => 'featuremap_units',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'marker_order',
- 'definition' => 'Units simply to define marker order.',
- 'cv_name' => 'featuremap_units',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'undefined',
- 'definition' => 'A catch-all for an undefined unit type',
- 'cv_name' => 'featuremap_units',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'name' => 'start',
- 'definition' => 'The start coordinate for a map feature.',
- 'cv_name' => 'featurepos_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'stop',
- 'definition' => 'The end coordinate for a map feature',
- 'cv_name' => 'featurepos_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
- tripal_insert_cvterm(array(
- 'name' => 'Map Dbxref',
- 'definition' => 'A unique identifer for the map in a remote database. The '
- . 'format is a database abbreviation and a unique accession separated '
- . 'by a colon. (e.g. Gramene:tsh1996a)',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Map Type',
- 'definition' => 'The type of Map (e.g. QTL, Physical, etc.)',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Genome Group',
- 'definition' => '',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'URL',
- 'definition' => 'A univeral resource locator (URL) reference where the '
- . 'publication can be found. For maps found online, this would be '
- . 'the web address for the map.',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Population Type',
- 'definition' => 'A brief description of the population type used to generate '
- . 'the map (e.g. RIL, F2, BC1, etc).',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Population Size',
- 'definition' => 'The size of the population used to construct the map.',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Methods',
- 'definition' => 'A brief description of the methods used to construct the map.',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
- tripal_insert_cvterm(array(
- 'name' => 'Software',
- 'definition' => 'The software used to construct the map.',
- 'cv_name' => 'featuremap_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ));
-
-
-
-
-
- tripal_insert_cvterm(array(
- 'name' => 'analysis_date',
- 'definition' => 'The date that an analysis was performed.',
- 'cv_name' => 'tripal_analysis',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ), array('update_existing' => TRUE));
-
-
- tripal_insert_cvterm(array(
- 'name' => 'analysis_short_name',
- 'definition' => 'A computer legible (no spaces or special characters) '
- . 'abbreviation for the analysis.',
- 'cv_name' => 'tripal_analysis',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ), array('update_existing' => TRUE));
-
-
- tripal_insert_cvterm(array(
- 'name' => 'Analysis Type',
- 'definition' => 'The type of analysis that was performed.',
- 'cv_name' => 'analysis_property',
- 'is_relationship' => 0,
- 'db_name' => 'local'
- ), array('update_existing' => TRUE));
-
- tripal_insert_cvterm(array(
- 'id' => 'local:analysis',
- 'name' => 'analysis',
- 'definition' => 'A process as a method of studying the nature of something ' .
- 'or of determining its essential features and their relations. ' .
- '(Random House Kernerman Webster\'s College Dictionary, © 2010 K ' .
- 'Dictionaries Ltd).',
- 'cv_name' => 'local',
- ));
-
- tripal_insert_cvterm(array(
- 'id' => 'local:project',
- 'name' => 'project',
- 'definition' => 'A plan or proposal for accomplishing something. ' .
- '(American Heritage® Dictionary of the English Language, Fifth Edition. ' .
- 'Copyright © 2011 by Houghton Mifflin Harcourt Publishing Company).',
- 'cv_name' => 'local',
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:source_data',
- 'name' => 'source_data',
- 'definition' => 'The location where data that is being used come from.',
- 'cv_name' => 'local',
- ));
-
-
-
- tripal_insert_cvterm(array(
- 'id' => 'local:contact',
- 'name' => 'contact',
- 'definition' => 'An entity (e.g. individual or organization) through ' .
- 'whom a person can gain access to information, favors, ' .
- 'influential people, and the like.',
- 'cv_name' => 'local',
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:relationship',
- 'name' => 'relationship',
- 'definition' => 'The way in which two things are connected.',
- 'cv_name' => 'local',
- ));
- tripal_insert_cvterm(array(
- 'id' => 'local:biomaterial',
- 'name' => 'biomaterial',
- 'definition' => 'A biomaterial represents the MAGE concept of BioSource, BioSample, ' .
- 'and LabeledExtract. It is essentially some biological material (tissue, cells, serum) that ' .
- 'may have been processed. Processed biomaterials should be traceable back to raw ' .
- 'biomaterials via the biomaterialrelationship table.',
- 'cv_name' => 'local',
- ));
- }
- 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_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);
- $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_TCONTACT() {
- }
- function tripal_chado_populate_vocab_TPUB() {
-
-
- tripal_insert_db(
- array(
- 'name' => 'PMID',
- 'description' => 'PubMed',
- 'url' => 'http://www.ncbi.nlm.nih.gov/pubmed',
- 'urlprefix' => 'http://www.ncbi.nlm.nih.gov/pubmed/{accession}'
- ),
- array('update_existing' => TRUE)
- );
- tripal_insert_db(
- array(
- 'name' => 'AGL',
- 'description' => 'USDA National Agricultural Library',
- 'url' => 'http://agricola.nal.usda.gov/'
- ),
- array('update_existing' => TRUE)
- );
- $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() {
- $term = tripal_get_cvterm(array('id' => 'TAXRANK:0000005'));
- tripal_associate_chado_semweb_term('organism', 'genus', $term);
- $term = tripal_get_cvterm(array('id' => 'TAXRANK:0000006'));
- tripal_associate_chado_semweb_term('organism', 'species', $term);
- $term = tripal_get_cvterm(array('id' => 'TAXRANK:0000045'));
- 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;
- }
|