tripal_chado.semweb.inc 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591
  1. <?php
  2. /**
  3. * Adds defaults to the chado_semweb table.
  4. */
  5. function tripal_chado_populate_chado_semweb_table() {
  6. // Add in all tables and fields into the chado_semweb table.
  7. $chado_tables = chado_get_table_names(TRUE);
  8. foreach ($chado_tables as $chado_table) {
  9. chado_add_semweb_table($chado_table);
  10. }
  11. // TODO: should this code be in the tripal_chado module? Some of these terms
  12. // are used solely by web services (e.g. rdfs:label) and are not used to
  13. // map chado terms to vocabularies.
  14. // Perhaps we should have an API for working with terms where these can be
  15. // inserted.
  16. // Now set defaults!
  17. tripal_chado_populate_vocab_CO_010();
  18. tripal_chado_populate_vocab_DC();
  19. tripal_chado_populate_vocab_EDAM();
  20. tripal_chado_populate_vocab_ERO();
  21. tripal_chado_populate_vocab_EFO();
  22. tripal_chado_populate_vocab_FOAF();
  23. tripal_chado_populate_vocab_HYDRA();
  24. tripal_chado_populate_vocab_IAO();
  25. tripal_chado_populate_vocab_LOCAL();
  26. tripal_chado_populate_vocab_NCIT();
  27. tripal_chado_populate_vocab_NCBITAXON();
  28. tripal_chado_populate_vocab_OBCS();
  29. tripal_chado_populate_vocab_OBI();
  30. tripal_chado_populate_vocab_OGI();
  31. tripal_chado_populate_vocab_RDFS();
  32. tripal_chado_populate_vocab_SBO();
  33. tripal_chado_populate_vocab_SCHEMA();
  34. tripal_chado_populate_vocab_SEP();
  35. tripal_chado_populate_vocab_SIO();
  36. tripal_chado_populate_vocab_SO();
  37. tripal_chado_populate_vocab_SWO();
  38. tripal_chado_populate_vocab_TAXRANK();
  39. tripal_chado_populate_vocab_TCONTACT();
  40. tripal_chado_populate_vocab_TPUB();
  41. tripal_chado_populate_vocab_UO();
  42. }
  43. /**
  44. * Adds the friend of a friend database and terms.
  45. */
  46. function tripal_chado_populate_vocab_FOAF() {
  47. chado_insert_db([
  48. 'name' => 'foaf',
  49. 'description' => 'Friend of a Friend',
  50. 'url' => 'http://www.foaf-project.org/',
  51. 'urlprefix' => 'http://xmlns.com/foaf/spec/#',
  52. ]);
  53. chado_insert_cv(
  54. 'foaf',
  55. 'Friend of a Friend. A dictionary of people-related terms that can be used in structured data).'
  56. );
  57. }
  58. /**
  59. * Adds the Hydra vocabulary
  60. */
  61. function tripal_chado_populate_vocab_HYDRA() {
  62. // For the HydraConsole to work with webservices the URL must be set as
  63. // http://www.w3.org/ns/hydra/core
  64. chado_insert_db([
  65. 'name' => 'hydra',
  66. 'description' => 'A Vocabulary for Hypermedia-Driven Web APIs',
  67. 'url' => 'http://www.w3.org/ns/hydra/core',
  68. 'urlprefix' => 'http://www.w3.org/ns/hydra/core#{accession}',
  69. ]);
  70. chado_insert_cv(
  71. 'hydra',
  72. 'A Vocabulary for Hypermedia-Driven Web APIs.'
  73. );
  74. $name = chado_insert_cvterm([
  75. 'id' => 'hydra:Collection',
  76. 'name' => 'Collection',
  77. 'cv_name' => 'hydra',
  78. 'definition' => 'A collection holding references to a number of related resources.',
  79. ]);
  80. $name = chado_insert_cvterm([
  81. 'id' => 'hydra:member',
  82. 'name' => 'member',
  83. 'cv_name' => 'hydra',
  84. 'definition' => 'A member of the collection',
  85. ]);
  86. $name = chado_insert_cvterm([
  87. 'id' => 'hydra:description',
  88. 'name' => 'description',
  89. 'cv_name' => 'hydra',
  90. 'definition' => 'A description.',
  91. ]);
  92. $name = chado_insert_cvterm([
  93. 'id' => 'hydra:totalItems',
  94. 'name' => 'totalItems',
  95. 'cv_name' => 'hydra',
  96. 'definition' => 'The total number of items referenced by a collection.',
  97. ]);
  98. $name = chado_insert_cvterm([
  99. 'id' => 'hydra:title',
  100. 'name' => 'title',
  101. 'cv_name' => 'hydra',
  102. 'definition' => 'A title, often used along with a description.',
  103. ]);
  104. $name = chado_insert_cvterm([
  105. 'id' => 'hydra:PartialCollectionView',
  106. 'name' => 'PartialCollectionView',
  107. 'cv_name' => 'hydra',
  108. 'definition' => 'A PartialCollectionView describes a partial view of a Collection. Multiple PartialCollectionViews can be connected with the the next/previous properties to allow a client to retrieve all members of the collection.',
  109. ]);
  110. }
  111. /**
  112. * Adds the RDFS database and terms.
  113. */
  114. function tripal_chado_populate_vocab_RDFS() {
  115. chado_insert_db([
  116. 'name' => 'rdf',
  117. 'description' => 'Resource Description Framework',
  118. 'url' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns',
  119. 'urlprefix' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
  120. ]);
  121. chado_insert_cv(
  122. 'rdf',
  123. 'Resource Description Framework'
  124. );
  125. chado_insert_db([
  126. 'name' => 'rdfs',
  127. 'description' => 'Resource Description Framework Schema',
  128. 'url' => 'https://www.w3.org/TR/rdf-schema/',
  129. 'urlprefix' => 'http://www.w3.org/2000/01/rdf-schema#{accession}',
  130. ]);
  131. chado_insert_cv(
  132. 'rdfs',
  133. 'Resource Description Framework Schema'
  134. );
  135. $name = chado_insert_cvterm([
  136. 'id' => 'rdfs:type',
  137. 'name' => 'type',
  138. 'cv_name' => 'rdfs',
  139. 'definition' => 'The type of resource.',
  140. ]);
  141. $name = chado_insert_cvterm([
  142. 'id' => 'rdfs:label',
  143. 'name' => 'label',
  144. 'cv_name' => 'rdfs',
  145. 'definition' => 'A human-readable version of a resource\'s name.',
  146. ]);
  147. $name = chado_insert_cvterm([
  148. 'id' => 'rdfs:comment',
  149. 'name' => 'comment',
  150. 'cv_name' => 'rdfs',
  151. 'definition' => 'A human-readable description of a resource\'s name.',
  152. ]);
  153. }
  154. /**
  155. * Adds the Schema.org database and terms.
  156. */
  157. function tripal_chado_populate_vocab_SCHEMA() {
  158. chado_insert_db([
  159. 'name' => 'schema',
  160. 'description' => 'Schema.org.',
  161. 'url' => 'https://schema.org/',
  162. 'urlprefix' => 'https://schema.org/{accession}',
  163. ]);
  164. chado_insert_cv(
  165. 'schema',
  166. 'Schema.org. Schema.org is sponsored by Google, Microsoft, Yahoo and Yandex. The vocabularies are developed by an open community process.'
  167. );
  168. $term = chado_insert_cvterm([
  169. 'id' => 'schema:name',
  170. 'name' => 'name',
  171. 'cv_name' => 'schema',
  172. 'definition' => 'The name of the item.',
  173. ]);
  174. chado_associate_semweb_term(NULL, 'name', $term);
  175. chado_associate_semweb_term('analysis', 'sourcename', $term);
  176. $term = chado_insert_cvterm([
  177. 'id' => 'schema:alternateName',
  178. 'name' => 'alternateName',
  179. 'cv_name' => 'schema',
  180. 'definition' => 'An alias for the item.',
  181. ]);
  182. chado_associate_semweb_term(NULL, 'synonym_id', $term);
  183. chado_associate_semweb_term('cvtermsynonym', 'synonym', $term);
  184. $term = chado_insert_cvterm([
  185. 'id' => 'schema:comment',
  186. 'name' => 'comment',
  187. 'cv_name' => 'schema',
  188. 'definition' => 'Comments, typically from users.',
  189. ]);
  190. chado_associate_semweb_term(NULL, 'comment', $term);
  191. $term = chado_insert_cvterm([
  192. 'id' => 'schema:description',
  193. 'name' => 'description',
  194. 'cv_name' => 'schema',
  195. 'definition' => 'A description of the item.',
  196. ]);
  197. chado_associate_semweb_term(NULL, 'description', $term);
  198. chado_associate_semweb_term('organism', 'comment', $term);
  199. chado_associate_semweb_term('protocol', 'protocoldescription', $term);
  200. $term = chado_insert_cvterm([
  201. 'id' => 'schema:publication',
  202. 'name' => 'publication',
  203. 'cv_name' => 'schema',
  204. 'definition' => 'A publication event associated with the item.',
  205. ]);
  206. chado_associate_semweb_term(NULL, 'pub_id', $term);
  207. $term = chado_insert_cvterm([
  208. 'id' => 'schema:url',
  209. 'name' => 'url',
  210. 'cv_name' => 'schema',
  211. 'definition' => 'URL of the item.',
  212. ]);
  213. chado_associate_semweb_term('db', 'url', $term);
  214. // Typically the type_id field is used for distinguishing between records
  215. // but in the case that it isn't then we need to associate a term with it
  216. // An entity already has a type so if that type is not dicated by the
  217. // type_id field then what is in the type_id should therefore be an
  218. // "additionalType". Therefore we need to add and map this term to all
  219. // of the appropriate type_id fields.
  220. $term = chado_insert_cvterm([
  221. 'id' => 'schema:additionalType',
  222. 'name' => 'additionalType',
  223. 'cv_name' => 'schema',
  224. 'definition' => '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.',
  225. ]);
  226. $tables = chado_get_table_names(TRUE);
  227. foreach ($tables as $table) {
  228. $schema = chado_get_schema($table);
  229. // The type_id for the organism is infraspecific type, so don't make
  230. // the association for that type.
  231. if ($table == 'organism') {
  232. continue;
  233. }
  234. if (in_array("type_id", array_keys($schema['fields']))) {
  235. chado_associate_semweb_term($table, 'type_id', $term);
  236. }
  237. }
  238. $term = chado_insert_cvterm([
  239. 'id' => 'schema:ItemPage',
  240. 'name' => 'ItemPage',
  241. 'cv_name' => 'schema',
  242. 'definition' => 'A page devoted to a single item, such as a particular product or hotel.',
  243. ]);
  244. }
  245. /**
  246. * Adds the Sample processing and separation techniques database and terms.
  247. */
  248. function tripal_chado_populate_vocab_SEP() {
  249. chado_insert_db([
  250. 'name' => 'sep',
  251. 'description' => 'Sample processing and separation techniques.',
  252. 'url' => 'http://psidev.info/index.php?q=node/312',
  253. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  254. ]);
  255. chado_insert_cv('sep', 'A structured controlled vocabulary for the annotation of sample processing and separation techniques in scientific experiments.');
  256. $term = chado_insert_cvterm([
  257. 'id' => 'sep:00195',
  258. 'name' => 'biological sample',
  259. 'cv_name' => 'sep',
  260. 'definition' => 'A biological sample analysed by a particular technology.',
  261. ]);
  262. chado_associate_semweb_term(NULL, 'biomaterial_id', $term);
  263. $term = tripal_insert_cvterm([
  264. 'id' => 'sep:00101',
  265. 'name' => 'protocol',
  266. 'cv_name' => 'sep',
  267. 'definition' => 'A protocol is a process which is a parameterizable description of a process.',
  268. ]);
  269. chado_associate_semweb_term(NULL, 'protocol_id', $term);
  270. chado_associate_semweb_term(NULL, 'nd_protocol_id', $term);
  271. }
  272. /**
  273. * Adds the SemanticScience database and terms.
  274. */
  275. function tripal_chado_populate_vocab_SIO() {
  276. chado_insert_db([
  277. 'name' => 'SIO',
  278. 'description' => 'Semanticscience Integrated Ontology.',
  279. 'url' => 'http://sio.semanticscience.org/',
  280. 'urlprefix' => 'http://semanticscience.org/resource/{db}_{accession}',
  281. ]);
  282. chado_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.');
  283. $term = chado_insert_cvterm([
  284. 'id' => 'SIO:000493',
  285. 'name' => 'clause',
  286. 'cv_name' => 'SIO',
  287. 'definition' => 'A clause consists of a subject and a predicate.',
  288. ]);
  289. $term = chado_insert_cvterm([
  290. 'id' => 'SIO:000631',
  291. 'name' => 'references',
  292. 'cv_name' => 'SIO',
  293. 'definition' => 'references is a relation between one entity and the entity that it makes reference to by name, but is not described by it.',
  294. ]);
  295. $term = chado_insert_cvterm([
  296. 'id' => 'SIO:000056',
  297. 'name' => 'position',
  298. 'cv_name' => 'SIO',
  299. 'definition' => 'A measurement of a spatial location relative to a frame of reference or other objects.',
  300. ]);
  301. chado_associate_semweb_term('featurepos', 'mappos', $term);
  302. $term = chado_insert_cvterm([
  303. 'id' => 'SIO:001166',
  304. 'name' => 'annotation',
  305. 'cv_name' => 'SIO',
  306. 'definition' => 'An annotation is a written explanatory or critical description, or other in-context information (e.g., pattern, motif, link), that has been associated with data or other types of information.',
  307. ]);
  308. chado_associate_semweb_term('feature_cvterm', 'cvterm_id', $term);
  309. chado_associate_semweb_term('analysis_cvterm', 'cvterm_id', $term);
  310. chado_associate_semweb_term('cell_line_cvterm', 'cvterm_id', $term);
  311. chado_associate_semweb_term('environment_cvterm', 'cvterm_id', $term);
  312. chado_associate_semweb_term('expression_cvterm', 'cvterm_id', $term);
  313. chado_associate_semweb_term('library_cvterm', 'cvterm_id', $term);
  314. chado_associate_semweb_term('organism_cvterm', 'cvterm_id', $term);
  315. chado_associate_semweb_term('phenotype_cvterm', 'cvterm_id', $term);
  316. chado_associate_semweb_term('stock_cvterm', 'cvterm_id', $term);
  317. chado_associate_semweb_term('stock_relationship_cvterm', 'cvterm_id', $term);
  318. $term = chado_insert_cvterm([
  319. 'id' => 'SIO:000281',
  320. 'name' => 'negation',
  321. 'cv_name' => 'SIO',
  322. 'definition' => 'NOT is a logical operator in that has the value true if its operand is false.',
  323. ]);
  324. chado_associate_semweb_term('feature_cvterm', 'is_not', $term);
  325. chado_associate_semweb_term('analysis_cvterm', 'is_not', $term);
  326. chado_associate_semweb_term('organism_cvterm', 'is_not', $term);
  327. chado_associate_semweb_term('stock_cvterm', 'is_not', $term);
  328. $term = chado_insert_cvterm([
  329. 'id' => 'SIO:001080',
  330. 'name' => 'vocabulary',
  331. 'cv_name' => 'SIO',
  332. 'definition' => 'A vocabulary is a collection of terms.',
  333. ]);
  334. chado_associate_semweb_term('cvterm', 'cv_id', $term);
  335. $term = chado_insert_cvterm([
  336. 'id' => 'SIO:001323',
  337. 'name' => 'email address',
  338. 'cv_name' => 'SIO',
  339. 'definition' => 'an email address is an identifier to send mail to particular electronic mailbox.',
  340. ]);
  341. $term = chado_insert_cvterm([
  342. 'id' => 'SIO:001007',
  343. 'name' => 'assay',
  344. 'cv_name' => 'SIO',
  345. 'definition' => 'An assay is an investigative (analytic) procedure in ' .
  346. 'laboratory medicine, pharmacology, environmental biology, and ' .
  347. 'molecular biology for qualitatively assessing or quantitatively ' .
  348. 'measuring the presence or amount or the functional activity of a ' .
  349. 'target entity (the analyte) which can be a drug or biochemical ' .
  350. 'substance or a cell in an organism or organic sample.',
  351. ]);
  352. chado_associate_semweb_term(NULL, 'assay_id', $term);
  353. $term = chado_insert_cvterm([
  354. 'id' => 'SIO:010054',
  355. 'name' => 'cell line',
  356. 'cv_name' => 'SIO',
  357. 'definition' => 'A cell line is a collection of genetically identifical cells.',
  358. ]);
  359. chado_associate_semweb_term(NULL, 'cell_line_id', $term);
  360. $term = chado_insert_cvterm([
  361. 'id' => 'SIO:001066',
  362. 'name' => 'study',
  363. 'cv_name' => 'SIO',
  364. 'definition' => 'A study is a process that realizes the steps of a study design.',
  365. ]);
  366. chado_associate_semweb_term(NULL, 'study_id', $term);
  367. }
  368. /**
  369. * Adds the details for the SO vocab and db.
  370. */
  371. function tripal_chado_populate_vocab_SO() {
  372. chado_insert_db([
  373. 'name' => 'SO',
  374. 'description' => 'The sequence ontology.',
  375. 'url' => 'http://www.sequenceontology.org/',
  376. 'urlprefix' => 'http://www.sequenceontology.org/browser/current_svn/term/{db}:{accession}',
  377. ]);
  378. chado_insert_cv('sequence', 'The sequence ontology.');
  379. $term = chado_get_cvterm([
  380. 'cv_id' => ['name' => 'sequence'],
  381. 'name' => 'sequence_feature',
  382. ]);
  383. chado_associate_semweb_term(NULL, 'feature_id', $term);
  384. }
  385. /**
  386. * Adds the Crop Ontology terms.
  387. */
  388. function tripal_chado_populate_vocab_CO_010() {
  389. chado_insert_db([
  390. 'name' => 'CO_010',
  391. 'description' => 'Crop Germplasm Ontology',
  392. 'url' => 'http://www.cropontology.org/get-ontology/CO_010',
  393. 'urlprefix' => 'http://www.cropontology.org/terms/CO_010:{accession}',
  394. ]);
  395. chado_insert_cv(
  396. 'germplasm_ontology',
  397. 'GCP germplasm ontology'
  398. );
  399. $term = chado_insert_cvterm([
  400. 'id' => 'CO_010:0000044',
  401. 'name' => 'accession',
  402. 'cv_name' => 'germplasm_ontology',
  403. 'definition' => '',
  404. ]);
  405. $term = chado_insert_cvterm([
  406. 'id' => 'CO_010:0000255',
  407. 'name' => 'generated germplasm',
  408. 'cv_name' => 'germplasm_ontology',
  409. 'definition' => '',
  410. ]);
  411. $term = chado_insert_cvterm([
  412. 'id' => 'CO_010:0000029',
  413. 'name' => 'cultivar',
  414. 'cv_name' => 'germplasm_ontology',
  415. 'definition' => '',
  416. ]);
  417. $term = chado_insert_cvterm([
  418. 'id' => 'CO_010:0000162',
  419. 'name' => '414 inbred line',
  420. 'cv_name' => 'germplasm_ontology',
  421. 'definition' => '',
  422. ]);
  423. }
  424. /**
  425. * Adds the DC database.
  426. */
  427. function tripal_chado_populate_vocab_DC() {
  428. chado_insert_db([
  429. 'name' => 'dc',
  430. 'description' => 'DCMI Metadata Terms.',
  431. 'url' => 'http://purl.org/dc/dcmitype/',
  432. 'urlprefix' => 'http://purl.org/dc/terms/{accession}',
  433. ]);
  434. chado_insert_cv(
  435. 'dc',
  436. 'DCMI Metadata Terms.'
  437. );
  438. $term = chado_insert_cvterm([
  439. 'id' => 'dc:Service',
  440. 'name' => 'Service',
  441. 'cv_name' => 'dc',
  442. 'definition' => 'A system that provides one or more functions.',
  443. ]);
  444. }
  445. /**
  446. * Adds the EDAM database and terms.
  447. */
  448. function tripal_chado_populate_vocab_EDAM() {
  449. chado_insert_db([
  450. 'name' => 'data',
  451. 'description' => 'Bioinformatics operations, data types, formats, identifiers and topics.',
  452. 'url' => 'http://edamontology.org/page',
  453. 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
  454. ]);
  455. chado_insert_db([
  456. 'name' => 'format',
  457. 'description' => 'A defined way or layout of representing and structuring data in a computer file, blob, string, message, or elsewhere. The main focus in EDAM lies on formats as means of structuring data exchanged between different tools or resources. ',
  458. 'url' => 'http://edamontology.org/page',
  459. 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
  460. ]);
  461. chado_insert_db([
  462. 'name' => 'operation',
  463. 'description' => 'A function that processes a set of inputs and results in a set of outputs, or associates arguments (inputs) with values (outputs). Special cases are: a) An operation that consumes no input (has no input arguments).',
  464. 'url' => 'http://edamontology.org/page',
  465. 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
  466. ]);
  467. chado_insert_db([
  468. 'name' => 'topic',
  469. 'description' => 'A category denoting a rather broad domain or field of interest, of study, application, work, data, or technology. Topics have no clearly defined borders between each other.',
  470. 'url' => 'http://edamontology.org/page',
  471. 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
  472. ]);
  473. chado_insert_db([
  474. 'name' => 'EDAM',
  475. 'description' => 'Bioinformatics operations, data types, formats, identifiers and topics.',
  476. 'url' => 'http://edamontology.org/page',
  477. 'urlprefix' => 'http://edamontology.org/{db}_{accession}',
  478. ]);
  479. chado_insert_cv(
  480. 'EDAM',
  481. 'EDAM is an ontology of well established, familiar concepts that are ' .
  482. 'prevalent within bioinformatics, including types of data and data ' .
  483. 'identifiers, data formats, operations and topics. EDAM is a simple ' .
  484. 'ontology - essentially a set of terms with synonyms and definitions - ' .
  485. 'organised into an intuitive hierarchy for convenient use by curators, ' .
  486. 'software developers and end-users. EDAM is suitable for large-scale ' .
  487. 'semantic annotations and categorization of diverse bioinformatics ' .
  488. 'resources. EDAM is also suitable for diverse application including ' .
  489. 'for example within workbenches and workflow-management systems, ' .
  490. 'software distributions, and resource registries.'
  491. );
  492. $term = chado_insert_cvterm([
  493. 'id' => 'data:1249',
  494. 'name' => 'Sequence length',
  495. 'cv_name' => 'EDAM',
  496. 'definition' => 'The size (length) of a sequence, subsequence or region in a sequence, or range(s) of lengths.',
  497. ]);
  498. chado_associate_semweb_term('feature', 'seqlen', $term);
  499. $term = chado_insert_cvterm([
  500. 'id' => 'data:2190',
  501. 'name' => 'Sequence checksum',
  502. 'cv_name' => 'EDAM',
  503. 'definition' => 'A fixed-size datum calculated (by using a hash function) for a molecular sequence, typically for purposes of error detection or indexing.',
  504. ]);
  505. chado_associate_semweb_term(NULL, 'md5checksum', $term);
  506. $term = chado_insert_cvterm([
  507. 'id' => 'data:2091',
  508. 'name' => 'Accession',
  509. 'cv_name' => 'EDAM',
  510. 'definition' => 'A persistent (stable) and unique identifier, typically identifying an object (entry) from a database.',
  511. ]);
  512. chado_associate_semweb_term(NULL, 'dbxref_id', $term);
  513. chado_associate_semweb_term('dbxref', 'accession', $term);
  514. $term = chado_insert_cvterm([
  515. 'id' => 'data:2044',
  516. 'name' => 'Sequence',
  517. 'cv_name' => 'EDAM',
  518. 'definition' => 'One or more molecular sequences, possibly with associated annotation..',
  519. ]);
  520. chado_associate_semweb_term('feature', 'residues', $term);
  521. $term = chado_insert_cvterm([
  522. 'id' => 'data:0842',
  523. 'name' => 'Identifier',
  524. 'cv_name' => 'EDAM',
  525. '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).',
  526. ]);
  527. chado_associate_semweb_term(NULL, 'uniquename', $term);
  528. chado_associate_semweb_term('assay', 'arrayidentifier', $term);
  529. $term = chado_insert_cvterm([
  530. 'id' => 'data:2976',
  531. 'name' => 'Protein sequence',
  532. 'cv_name' => 'EDAM',
  533. 'definition' => 'One or more protein sequences, possibly with associated annotation.',
  534. ]);
  535. $term = chado_insert_cvterm([
  536. 'id' => 'data:2968',
  537. 'name' => 'Image',
  538. 'cv_name' => 'EDAM',
  539. 'definition' => 'Biological or biomedical data has been rendered into an image, typically for display on screen.',
  540. ]);
  541. chado_associate_semweb_term(NULL, 'eimage_id', $term);
  542. $term = chado_insert_cvterm([
  543. 'id' => 'data:1274',
  544. 'name' => 'Map',
  545. 'cv_name' => 'EDAM',
  546. 'definition' => 'A map of (typically one) DNA sequence annotated with positional or non-positional features.',
  547. ]);
  548. chado_associate_semweb_term(NULL, 'featuremap_id', $term);
  549. $term = chado_insert_cvterm([
  550. 'id' => 'data:1278',
  551. 'name' => 'Genetic map',
  552. 'cv_name' => 'EDAM',
  553. '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.',
  554. ]);
  555. chado_associate_semweb_term('featuremap', 'featuremap_id', $term);
  556. $term = chado_insert_cvterm([
  557. 'id' => 'data:1280',
  558. 'name' => 'Physical map',
  559. 'cv_name' => 'EDAM',
  560. '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.',
  561. ]);
  562. chado_associate_semweb_term('featuremap', 'featuremap_id', $term);
  563. $term = chado_insert_cvterm([
  564. 'id' => 'data:2012',
  565. 'name' => 'Sequence coordinates',
  566. 'cv_name' => 'EDAM',
  567. 'definition' => 'A position in a map (for example a genetic map), either a single position (point) or a region / interval.',
  568. ]);
  569. $term = chado_insert_cvterm([
  570. 'id' => 'data:1056',
  571. 'name' => 'Database name',
  572. 'cv_name' => 'EDAM',
  573. 'definition' => 'The name of a biological or bioinformatics database.',
  574. ]);
  575. $term = chado_insert_cvterm([
  576. 'id' => 'data:1048',
  577. 'name' => 'Database ID',
  578. 'cv_name' => 'EDAM',
  579. 'definition' => 'An identifier of a biological or bioinformatics database.',
  580. ]);
  581. chado_associate_semweb_term('db', 'name', $term);
  582. $term = chado_insert_cvterm([
  583. 'id' => 'data:1047',
  584. 'name' => 'URI',
  585. 'cv_name' => 'EDAM',
  586. 'definition' => 'The name of a biological or bioinformatics database.',
  587. ]);
  588. chado_associate_semweb_term('analysis', 'sourceuri', $term);
  589. chado_associate_semweb_term(NULL, 'uri', $term);
  590. $term = chado_insert_cvterm([
  591. 'id' => 'data:2336',
  592. 'name' => 'Translation phase specification',
  593. 'cv_name' => 'EDAM',
  594. 'definition' => 'Phase for translation of DNA (0, 1 or 2) relative to a fragment of the coding sequence.',
  595. ]);
  596. chado_associate_semweb_term('featureloc', 'phase', $term);
  597. $term = chado_insert_cvterm([
  598. 'id' => 'data:0853',
  599. 'name' => 'DNA sense specification',
  600. 'cv_name' => 'EDAM',
  601. 'definition' => 'The strand of a DNA sequence (forward or reverse).',
  602. ]);
  603. chado_associate_semweb_term('featureloc', 'strand', $term);
  604. $term = chado_insert_cvterm([
  605. 'id' => 'data:3002',
  606. 'name' => 'Annotation track',
  607. 'cv_name' => 'EDAM',
  608. 'definition' => 'Annotation of one particular positional feature on a ' .
  609. 'biomolecular (typically genome) sequence, suitable for import and ' .
  610. 'display in a genome browser. Synonym: Sequence annotation track.',
  611. ]);
  612. chado_associate_semweb_term('featureloc', 'srcfeature_id', $term);
  613. $term = chado_insert_cvterm([
  614. 'id' => 'operation:2945',
  615. 'name' => 'Analysis',
  616. 'cv_name' => 'EDAM',
  617. 'definition' => 'Apply analytical methods to existing data of a specific type.',
  618. ]);
  619. chado_associate_semweb_term(NULL, 'analysis_id', $term);
  620. $term = chado_insert_cvterm([
  621. 'id' => 'data:0872',
  622. 'name' => 'Phylogenetic tree',
  623. 'cv_name' => 'EDAM',
  624. 'definition' => 'The raw data (not just an image) from which a phylogenetic tree is directly generated or plotted, such as topology, lengths (in time or in expected amounts of variance) and a confidence interval for each length.',
  625. ]);
  626. chado_associate_semweb_term(NULL, 'phylotree_id', $term);
  627. $term = chado_insert_cvterm([
  628. 'id' => 'data:3272',
  629. 'name' => 'Species tree',
  630. 'cv_name' => 'EDAM',
  631. 'definition' => 'A phylogenetic tree that reflects phylogeny of the taxa from which the characters (used in calculating the tree) were sampled.',
  632. ]);
  633. $term = chado_insert_cvterm([
  634. 'id' => 'data:3271',
  635. 'name' => 'Gene tree',
  636. 'cv_name' => 'EDAM',
  637. 'definition' => 'A phylogenetic tree that is an estimate of the character\'s phylogeny.',
  638. ]);
  639. $term = chado_insert_cvterm([
  640. 'id' => 'operation:0567',
  641. 'name' => 'Phylogenetic tree visualisation',
  642. 'cv_name' => 'EDAM',
  643. 'definition' => 'A phylogenetic tree that is an estimate of the character\'s phylogeny.',
  644. ]);
  645. $term = chado_insert_cvterm([
  646. 'id' => 'operation:0564',
  647. 'name' => 'Sequence visualisation',
  648. 'cv_name' => 'EDAM',
  649. 'definition' => 'Visualise, format or render a molecular sequence or sequences such as a sequence alignment, possibly with sequence features or properties shown.',
  650. ]);
  651. $term = chado_insert_cvterm([
  652. 'id' => 'operation:0525',
  653. 'name' => 'genome assembly',
  654. 'cv_name' => 'EDAM',
  655. 'definition' => '',
  656. ]);
  657. $term = chado_insert_cvterm([
  658. 'id' => 'operation:0362',
  659. 'name' => 'Genome annotation ',
  660. 'cv_name' => 'EDAM',
  661. 'definition' => '',
  662. ]);
  663. }
  664. /**
  665. * Adds the Experimental Factor Ontology and terms.
  666. */
  667. function tripal_chado_populate_vocab_EFO() {
  668. chado_insert_db([
  669. 'name' => 'EFO',
  670. 'description' => 'Experimental Factor Ontology',
  671. 'url' => 'http://www.ebi.ac.uk/efo/efo.owl',
  672. 'urlprefix' => 'http://www.ebi.ac.uk/efo/{db}_{accession}',
  673. ]);
  674. chado_insert_cv(
  675. 'efo',
  676. 'The Experimental Factor Ontology (EFO) provides a systematic description of many experimental variables available in EBI databases, and for external projects such as the NHGRI GWAS catalogue. It combines parts of several biological ontologies, such as anatomy, disease and chemical compounds. The scope of EFO is to support the annotation, analysis and visualization of data handled by many groups at the EBI and as the core ontology for OpenTargets.org'
  677. );
  678. $term = chado_insert_cvterm([
  679. 'id' => 'EFO:0000548',
  680. 'name' => 'instrument',
  681. 'cv_name' => 'efo',
  682. 'definition' => 'An instrument is a device which provides a mechanical or electronic function.',
  683. ]);
  684. chado_associate_semweb_term('protocol', 'hardwaredescription', $term);
  685. $term = chado_insert_cvterm([
  686. 'id' => 'EFO:0000269',
  687. 'name' => 'array design',
  688. 'cv_name' => 'efo',
  689. 'definition' => 'An instrument design which describes the design of the array.',
  690. ]);
  691. chado_associate_semweb_term('assay', 'arraydesign_id', $term);
  692. $term = chado_insert_cvterm([
  693. 'id' => 'EFO:0005522',
  694. 'name' => 'substrate type',
  695. 'cv_name' => 'efo',
  696. 'definition' => 'Controlled terms for descriptors of types of array substrates.',
  697. ]);
  698. chado_associate_semweb_term('arraydesign', 'substratetype_id', $term);
  699. $term = chado_insert_cvterm([
  700. 'id' => 'EFO:0001728',
  701. 'name' => 'array manufacturer',
  702. 'cv_name' => 'efo',
  703. 'definition' => '',
  704. ]);
  705. chado_associate_semweb_term('arraydesign', 'manufacturer_id', $term);
  706. $term = chado_insert_cvterm([
  707. 'id' => 'EFO:0000269',
  708. 'name' => 'array design',
  709. 'cv_name' => 'efo',
  710. 'definition' => 'An instrument design which describes the design of the array.',
  711. ]);
  712. chado_associate_semweb_term('element', 'arraydesign_id', $term);
  713. }
  714. /**
  715. * Adds the Eagle-i Resource Ontology database and terms.
  716. */
  717. function tripal_chado_populate_vocab_ERO() {
  718. chado_insert_db([
  719. 'name' => 'ERO',
  720. 'description' => 'The Eagle-I Research Resource Ontology',
  721. 'url' => 'http://purl.bioontology.org/ontology/ERO',
  722. 'urlprefix' => 'http://purl.bioontology.org/ontology/ERO/{db}:{accession}',
  723. ]);
  724. chado_insert_cv(
  725. 'ero',
  726. '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/).'
  727. );
  728. $term = chado_insert_cvterm([
  729. 'id' => 'ERO:0001716',
  730. 'name' => 'database',
  731. 'cv_name' => 'ero',
  732. 'definition' => 'A database is an organized collection of data, today typically in digital form.',
  733. ]);
  734. chado_associate_semweb_term(NULL, 'db_id', $term);
  735. $term = chado_insert_cvterm([
  736. 'id' => 'ERO:0000387',
  737. 'name' => 'data acquisition',
  738. 'cv_name' => 'ero',
  739. 'definition' => 'A technique that samples real world physical conditions and conversion of the resulting samples into digital numeric values that can be manipulated by a computer.',
  740. ]);
  741. chado_associate_semweb_term(NULL, 'acquisition_id', $term);
  742. }
  743. /**
  744. * Adds the Information Artifact Ontology database and terms.
  745. */
  746. function tripal_chado_populate_vocab_OBCS() {
  747. chado_insert_db([
  748. 'name' => 'OBCS',
  749. 'description' => 'Ontology of Biological and Clinical Statistics.',
  750. 'url' => 'https://github.com/obcs/obcs',
  751. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  752. ]);
  753. chado_insert_cv(
  754. 'OBCS',
  755. 'Ontology of Biological and Clinical Statistics.'
  756. );
  757. $term = chado_insert_cvterm([
  758. 'id' => 'OBCS:0000117',
  759. 'name' => 'rank order',
  760. 'cv_name' => 'OBCS',
  761. 'definition' => 'A data item that represents an arrangement according to a rank, i.e., the position of a particular case relative to other cases on a defined scale.',
  762. ]);
  763. chado_associate_semweb_term(NULL, 'rank', $term);
  764. }
  765. /**
  766. * Adds the Information Artifact Ontology database and terms.
  767. */
  768. function tripal_chado_populate_vocab_OBI() {
  769. chado_insert_db([
  770. 'name' => 'OBI',
  771. 'description' => 'The Ontology for Biomedical Investigation.',
  772. 'url' => 'http://obi-ontology.org/page/Main_Page',
  773. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  774. ]);
  775. chado_insert_cv(
  776. 'obi',
  777. '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.'
  778. );
  779. $term = chado_insert_cvterm([
  780. 'id' => 'OBI:0100026',
  781. 'name' => 'organism',
  782. 'cv_name' => 'obi',
  783. '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.',
  784. ]);
  785. chado_associate_semweb_term(NULL, 'organism_id', $term);
  786. chado_associate_semweb_term('biomaterial', 'taxon_id', $term);
  787. $term = chado_insert_cvterm([
  788. 'id' => 'OBI:0000070',
  789. 'name' => 'assay',
  790. 'cv_name' => 'obi',
  791. 'definition' => 'A planned process with the objective to produce information about the material entity that is the evaluant, by physically examining it or its proxies.',
  792. ]);
  793. }
  794. /**
  795. * Adds the Ontology for genetic interval database and terms.
  796. */
  797. function tripal_chado_populate_vocab_OGI() {
  798. chado_insert_db([
  799. 'name' => 'OGI',
  800. 'description' => 'Ontology for genetic interval.',
  801. 'url' => 'http://purl.bioontology.org/ontology/OGI',
  802. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  803. ]);
  804. chado_insert_cv(
  805. 'ogi',
  806. '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.'
  807. );
  808. $term = chado_insert_cvterm([
  809. 'id' => 'OGI:0000021',
  810. 'name' => 'location on map',
  811. 'cv_name' => 'ogi',
  812. 'definition' => '',
  813. ]);
  814. }
  815. /**
  816. * Adds the Information Artifact Ontology database and terms.
  817. */
  818. function tripal_chado_populate_vocab_IAO() {
  819. chado_insert_db([
  820. 'name' => 'IAO',
  821. 'description' => 'The Information Artifact Ontology (IAO).',
  822. 'url' => 'https://github.com/information-artifact-ontology/IAO/',
  823. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  824. ]);
  825. chado_insert_cv(
  826. 'IAO',
  827. 'Information Artifact Ontology is a new ' .
  828. 'ontology of information entities, originally driven by work by the ' .
  829. 'OBI digital entity and realizable information entity branch.'
  830. );
  831. $term = chado_insert_cvterm([
  832. 'id' => 'IAO:0000115',
  833. 'name' => 'definition',
  834. 'cv_name' => 'IAO',
  835. 'definition' => 'The official OBI definition, explaining the meaning of ' .
  836. 'a class or property. Shall be Aristotelian, formalized and normalized. ' .
  837. 'Can be augmented with colloquial definitions.',
  838. ]);
  839. chado_associate_semweb_term(NULL, 'definition', $term);
  840. $term = chado_insert_cvterm([
  841. 'id' => 'IAO:0000129',
  842. 'name' => 'version number',
  843. 'cv_name' => 'IAO',
  844. 'definition' => 'A version number is an ' .
  845. 'information content entity which is a sequence of characters ' .
  846. 'borne by part of each of a class of manufactured products or its ' .
  847. 'packaging and indicates its order within a set of other products ' .
  848. 'having the same name.',
  849. ]);
  850. chado_associate_semweb_term('analysis', 'programversion', $term);
  851. chado_associate_semweb_term('analysis', 'sourceversion', $term);
  852. chado_associate_semweb_term(NULL, 'version', $term);
  853. $term = chado_insert_cvterm([
  854. 'id' => 'IAO:0000064',
  855. 'name' => 'algorithm',
  856. 'cv_name' => 'IAO',
  857. 'definition' => 'An algorithm is a set of instructions for performing a paticular calculation.',
  858. ]);
  859. chado_associate_semweb_term('analysis', 'algorithm', $term);
  860. }
  861. /**
  862. * Adds terms to the 'local' database.
  863. *
  864. * These are terms where an appropriate match could not be found in any other
  865. * ontology.
  866. */
  867. function tripal_chado_populate_vocab_LOCAL() {
  868. global $base_path;
  869. chado_insert_db([
  870. 'name' => 'null',
  871. 'description' => 'No online database.',
  872. 'url' => $base_path . 'cv/lookup/null',
  873. 'urlprefix' => $base_path . 'cv/lookup/{db}/{accession}',
  874. ]);
  875. chado_insert_db([
  876. 'name' => 'local',
  877. 'description' => 'Terms created for this site.',
  878. 'url' => $base_path . 'cv/lookup/local',
  879. 'urlprefix' => $base_path . 'cv/lookup/{db}/{accession}',
  880. ]);
  881. // ----------------
  882. // Add the various CV's that fall under the local DB.
  883. // ----------------
  884. chado_insert_cv(
  885. 'local',
  886. 'Locally created terms.'
  887. );
  888. chado_insert_cv(
  889. 'organism_property',
  890. 'A local vocabulary that contains locally defined properties for organisms'
  891. );
  892. chado_insert_cv(
  893. 'analysis_property',
  894. 'A local vocabulary that contains locally defined properties for analyses'
  895. );
  896. chado_insert_cv(
  897. 'tripal_phylogeny',
  898. 'Terms used by the Tripal phylotree module for phylogenetic and taxonomic trees.'
  899. );
  900. // Add cv for relationship types
  901. chado_insert_cv(
  902. 'feature_relationship',
  903. 'A local vocabulary that contains types of relationships between features.'
  904. );
  905. // The feature_property CV may already exists. It comes with Chado, but
  906. // we need to add it just in case it doesn't get added before the feature
  907. // module is installed. But as of Tripal v3.0 the Chado version of this
  908. // vocabulary is no longer loaded by default.
  909. chado_insert_cv(
  910. 'feature_property',
  911. 'A local vocabulary that contains properties for genomic features'
  912. );
  913. // Add the cv for contact properties. This is a default vocabulary in the event
  914. // that a user does not want to use the tripal_contact vocabulary
  915. chado_insert_cv(
  916. 'contact_property',
  917. '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.'
  918. );
  919. // add the cv for the contact type. This is a default vocabulary in the event
  920. // that a user does not want to use the tripal_contact vocabulary
  921. chado_insert_cv(
  922. 'contact_type',
  923. '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.'
  924. );
  925. // Add the cv for the tripal_contact vocabulary which is loaded via the OBO
  926. chado_insert_cv(
  927. 'tripal_contact',
  928. '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.'
  929. );
  930. // add the cv for contact relationships
  931. chado_insert_cv(
  932. 'contact_relationship',
  933. 'A local vocabulary that contains types of relationships between contacts.'
  934. );
  935. chado_insert_cv(
  936. 'featuremap_units',
  937. 'A local vocabulary that contains map unit types for the unittype_id column of the featuremap table.'
  938. );
  939. chado_insert_cv(
  940. 'featurepos_property',
  941. 'A local vocabulary that contains terms map properties.'
  942. );
  943. chado_insert_cv(
  944. 'featuremap_property',
  945. 'A local vocabulary that contains positional types for the feature positions'
  946. );
  947. chado_insert_cv(
  948. 'library_property',
  949. 'A local vocabulary that contains properties for libraries.'
  950. );
  951. chado_insert_cv(
  952. 'library_type',
  953. 'A local vocabulary that contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
  954. );
  955. // Add the cv for project properties
  956. chado_insert_cv(
  957. 'project_property',
  958. 'A local vocabulary that contains properties for projects.'
  959. );
  960. // Add the cv for project properties
  961. chado_insert_cv(
  962. 'study_property',
  963. 'A local vocabulary that contains properties for studies.'
  964. );
  965. // Add cv for relationship types
  966. chado_insert_cv(
  967. 'project_relationship',
  968. 'A local vocabulary that contains Types of relationships between projects.'
  969. );
  970. // Add the cv for pub properties
  971. chado_insert_cv(
  972. 'tripal_pub',
  973. '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.'
  974. );
  975. // Add the cv for pub types
  976. chado_insert_cv(
  977. 'pub_type',
  978. '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.'
  979. );
  980. // Add the cv for pub properties
  981. chado_insert_cv(
  982. 'pub_property',
  983. '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.'
  984. );
  985. // Add cv for relationship types
  986. chado_insert_cv(
  987. 'pub_relationship',
  988. 'A local vocabulary that contains types of relationships between publications.'
  989. );
  990. // Add cv for relationship types
  991. chado_insert_cv(
  992. 'stock_relationship',
  993. 'A local vocabulary that contains types of relationships between stocks.'
  994. );
  995. chado_insert_cv(
  996. 'stock_property',
  997. 'A local vocabulary that contains properties for stocks.'
  998. );
  999. chado_insert_cv(
  1000. 'stock_type',
  1001. 'A local vocabulary that contains a list of types for stocks.'
  1002. );
  1003. chado_insert_cv(
  1004. 'tripal_analysis',
  1005. 'A local vocabulary that contains terms used for analyses.'
  1006. );
  1007. //-----------------------------
  1008. // Misc Terms
  1009. //-----------------------------
  1010. $term = chado_insert_cvterm([
  1011. 'id' => 'local:property',
  1012. 'name' => 'property',
  1013. 'cv_name' => 'local',
  1014. 'definition' => 'A generic term indicating that represents an attribute, quality or characteristic of something.',
  1015. ]);
  1016. //-----------------------------
  1017. // Terms for base table fields
  1018. //-----------------------------
  1019. $term = chado_insert_cvterm([
  1020. 'id' => 'local:timelastmodified',
  1021. 'name' => 'time_last_modified',
  1022. 'cv_name' => 'local',
  1023. 'definition' => 'The time at which the record was last modified.',
  1024. ]);
  1025. chado_associate_semweb_term(NULL, 'timelastmodified', $term);
  1026. $term = chado_insert_cvterm([
  1027. 'id' => 'local:timeaccessioned',
  1028. 'name' => 'time_accessioned',
  1029. 'cv_name' => 'local',
  1030. 'definition' => 'The time at which the record was first added.',
  1031. ]);
  1032. chado_associate_semweb_term(NULL, 'timeaccessioned', $term);
  1033. $term = chado_insert_cvterm([
  1034. 'id' => 'local:timeexecuted',
  1035. 'name' => 'time_executed',
  1036. 'cv_name' => 'local',
  1037. 'definition' => 'The time when the task was executed.',
  1038. ]);
  1039. chado_associate_semweb_term(NULL, 'timeexecuted', $term);
  1040. $term = chado_insert_cvterm([
  1041. 'id' => 'local:infraspecific_type',
  1042. 'name' => 'infraspecific_type',
  1043. 'definition' => 'The connector type (e.g. subspecies, varietas, forma, etc.) for the infraspecific name',
  1044. 'cv_name' => 'local',
  1045. ]);
  1046. chado_associate_semweb_term('organism', 'type_id', $term);
  1047. $term = chado_insert_cvterm([
  1048. 'id' => 'local:abbreviation',
  1049. 'name' => 'abbreviation',
  1050. 'cv_name' => 'local',
  1051. 'definition' => 'A shortened name (or abbreviation) for the item.',
  1052. ]);
  1053. chado_associate_semweb_term('organism', 'abbreviation', $term);
  1054. $term = chado_insert_cvterm([
  1055. 'id' => 'local:expression',
  1056. 'name' => 'expression',
  1057. 'definition' => 'Curated expression data',
  1058. 'cv_name' => 'local',
  1059. ]);
  1060. $term = chado_insert_cvterm([
  1061. 'id' => 'local:is_analysis',
  1062. 'name' => 'is_analysis',
  1063. 'definition' => 'Indicates if this feature was predicted computationally using another feature.',
  1064. 'cv_name' => 'local',
  1065. ]);
  1066. chado_associate_semweb_term('feature', 'is_analysis', $term);
  1067. $term = chado_insert_cvterm([
  1068. 'id' => 'local:is_obsolete',
  1069. 'name' => 'is_obsolete',
  1070. 'definition' => 'Indicates if this record is obsolete.',
  1071. 'cv_name' => 'local',
  1072. ]);
  1073. chado_associate_semweb_term(NULL, 'is_obsolete', $term);
  1074. $term = chado_insert_cvterm([
  1075. 'id' => 'local:is_current',
  1076. 'name' => 'is_current',
  1077. 'definition' => 'Indicates if this record is current.',
  1078. 'cv_name' => 'local',
  1079. ]);
  1080. chado_associate_semweb_term(NULL, 'is_current', $term);
  1081. $term = chado_insert_cvterm([
  1082. 'id' => 'local:is_internal',
  1083. 'name' => 'is_internal',
  1084. 'definition' => 'Indicates if this record is internal and not normally available outside of a local setting.',
  1085. 'cv_name' => 'local',
  1086. ]);
  1087. chado_associate_semweb_term(NULL, 'is_internal', $term);
  1088. $term = chado_insert_cvterm([
  1089. 'id' => 'local:miniref',
  1090. 'name' => 'Mini-ref',
  1091. 'definition' => 'A small in-house unique identifier for a publication.',
  1092. 'cv_name' => 'local',
  1093. ]);
  1094. chado_associate_semweb_term('pub', 'miniref', $term);
  1095. $term = chado_insert_cvterm([
  1096. 'id' => 'local:array_batch_identifier',
  1097. 'name' => 'Array Batch Identifier',
  1098. 'definition' => 'A unique identifier for an array batch.',
  1099. 'cv_name' => 'local',
  1100. ]);
  1101. chado_associate_semweb_term('assay', 'arraybatchidentifier', $term);
  1102. //-----------------------------
  1103. // Relationship Terms
  1104. //-----------------------------
  1105. $term = chado_insert_cvterm([
  1106. 'id' => 'local:relationship_subject',
  1107. 'name' => 'clause subject',
  1108. 'definition' => 'The subject of a relationship clause.',
  1109. 'cv_name' => 'local',
  1110. ]);
  1111. chado_associate_semweb_term(NULL, 'subject_id', $term);
  1112. chado_associate_semweb_term(NULL, 'subject_reagent_id', $term);
  1113. chado_associate_semweb_term(NULL, 'subject_project_id', $term);
  1114. $term = chado_insert_cvterm([
  1115. 'id' => 'local:relationship_object',
  1116. 'name' => 'clause predicate',
  1117. 'definition' => 'The object of a relationship clause.',
  1118. 'cv_name' => 'local',
  1119. ]);
  1120. chado_associate_semweb_term(NULL, 'object_id', $term);
  1121. chado_associate_semweb_term(NULL, 'object_reagent_id', $term);
  1122. chado_associate_semweb_term(NULL, 'object_project_id', $term);
  1123. $term = chado_insert_cvterm([
  1124. 'id' => 'local:relationship_type',
  1125. 'name' => 'relationship type',
  1126. 'definition' => 'The relationship type.',
  1127. 'cv_name' => 'local',
  1128. ]);
  1129. chado_associate_semweb_term('acquisition_relationship', 'type_id', $term);
  1130. chado_associate_semweb_term('biomaterial_relationship', 'type_id', $term);
  1131. chado_associate_semweb_term('cell_line_relationship', 'type_id', $term);
  1132. chado_associate_semweb_term('contact_relationship', 'type_id', $term);
  1133. chado_associate_semweb_term('element_relationship', 'type_id', $term);
  1134. chado_associate_semweb_term('elementresult_relationship', 'type_id', $term);
  1135. chado_associate_semweb_term('feature_relationship', 'type_id', $term);
  1136. chado_associate_semweb_term('nd_reagent_relationship', 'type_id', $term);
  1137. chado_associate_semweb_term('phylonode_relationship', 'type_id', $term);
  1138. chado_associate_semweb_term('project_relationship', 'type_id', $term);
  1139. chado_associate_semweb_term('pub_relationship', 'type_id', $term);
  1140. chado_associate_semweb_term('quantification_relationship', 'type_id', $term);
  1141. chado_associate_semweb_term('stock_relationship', 'type_id', $term);
  1142. chado_associate_semweb_term('cvterm_relationship', 'type_id', $term);
  1143. //-----------------------------
  1144. // NCBI Organism Property Terms
  1145. //-----------------------------
  1146. // TODO: these probably have real terms we can use.
  1147. $term = chado_insert_cvterm([
  1148. 'id' => 'local:rank',
  1149. 'name' => 'rank',
  1150. 'definition' => 'A taxonmic rank',
  1151. 'cv_name' => 'local',
  1152. ]);
  1153. $terms = [
  1154. 'lineage',
  1155. 'genetic_code',
  1156. 'genetic_code_name',
  1157. 'mitochondrial_genetic_code',
  1158. 'mitochondrial_genetic_code_name',
  1159. 'division',
  1160. 'genbank_common_name',
  1161. 'synonym',
  1162. 'other_name',
  1163. 'equivalent_name',
  1164. 'anamorph',
  1165. ];
  1166. $options = ['update_existing' => TRUE];
  1167. foreach ($terms as $term) {
  1168. $value = [
  1169. 'name' => $term,
  1170. 'definition' => '',
  1171. 'cv_name' => 'organism_property',
  1172. 'db_name' => 'local',
  1173. ];
  1174. chado_insert_cvterm($value, $options);
  1175. }
  1176. //---------------------
  1177. // Phylogeny Tree Terms
  1178. //---------------------
  1179. // Add the terms used to identify nodes in the tree.
  1180. chado_insert_cvterm([
  1181. 'name' => 'phylo_leaf',
  1182. 'definition' => 'A leaf node in a phylogenetic tree.',
  1183. 'cv_name' => 'tripal_phylogeny',
  1184. 'is_relationship' => 0,
  1185. 'db_name' => 'local',
  1186. ]);
  1187. // Add the terms used to identify nodes in the tree.
  1188. chado_insert_cvterm([
  1189. 'name' => 'phylo_root',
  1190. 'definition' => 'The root node of a phylogenetic tree.',
  1191. 'cv_name' => 'tripal_phylogeny',
  1192. 'is_relationship' => 0,
  1193. 'db_name' => 'local',
  1194. ]);
  1195. // Add the terms used to identify nodes in the tree.
  1196. chado_insert_cvterm([
  1197. 'name' => 'phylo_interior',
  1198. 'definition' => 'An interior node in a phylogenetic tree.',
  1199. 'cv_name' => 'tripal_phylogeny',
  1200. 'is_relationship' => 0,
  1201. 'db_name' => 'local',
  1202. ]);
  1203. // Add the terms used to identify nodes in the tree.
  1204. // DEPRECATED: use EDAM's data 'Species tree' term instead.
  1205. chado_insert_cvterm([
  1206. 'name' => 'taxonomy',
  1207. 'definition' => 'A term used to indicate if a phylotree is a taxonomic tree',
  1208. 'cv_name' => 'tripal_phylogeny',
  1209. 'is_relationship' => 0,
  1210. 'db_name' => 'local',
  1211. ]);
  1212. //--------------
  1213. // Project Terms
  1214. //--------------
  1215. // Insert cvterm 'Project Description' into cvterm table of chado
  1216. // database. This CV term is used to keep track of the project
  1217. // description in the projectprop table.
  1218. chado_insert_cvterm([
  1219. 'name' => 'Project Description',
  1220. 'definition' => 'Description of a project',
  1221. 'cv_name' => 'project_property',
  1222. 'db_name' => 'local',
  1223. ]);
  1224. chado_insert_cvterm([
  1225. 'name' => 'Project Type',
  1226. 'definition' => 'A type of project',
  1227. 'cv_name' => 'project_property',
  1228. 'db_name' => 'local',
  1229. ]);
  1230. //--------------
  1231. // Natural Diversity Terms
  1232. //--------------
  1233. // add cvterms for the nd_experiment_types
  1234. chado_insert_cvterm([
  1235. 'name' => 'Genotyping',
  1236. 'definition' => 'An experiment where genotypes of individuals are identified.',
  1237. 'cv_name' => 'nd_experiment_types',
  1238. 'db_name' => 'local',
  1239. ]);
  1240. chado_insert_cvterm([
  1241. 'name' => 'Phenotyping',
  1242. 'definition' => 'An experiment where phenotypes of individuals are identified.',
  1243. 'cv_name' => 'nd_experiment_types',
  1244. 'db_name' => 'local',
  1245. ]);
  1246. chado_insert_cvterm([
  1247. 'name' => 'Location',
  1248. 'definition' => 'The name of the location.',
  1249. 'cv_name' => 'nd_geolocation_property',
  1250. 'db_name' => 'local',
  1251. ]);
  1252. //--------------
  1253. // Library Terms
  1254. //--------------
  1255. $term = chado_insert_cvterm([
  1256. 'id' => 'local:library',
  1257. 'name' => 'Library',
  1258. 'definition' => 'A group of physical entities organized into a collection',
  1259. 'cv_name' => 'local',
  1260. 'db_name' => 'local',
  1261. ]);
  1262. chado_associate_semweb_term(NULL, 'library_id', $term);
  1263. // Insert cvterm 'library_description' into cvterm table of chado
  1264. // database. This CV term is used to keep track of the library
  1265. // description in the libraryprop table.
  1266. $term = chado_insert_cvterm([
  1267. 'id' => 'local:library_description',
  1268. 'name' => 'Library Description',
  1269. 'definition' => 'Description of a library',
  1270. 'cv_name' => 'library_property',
  1271. 'db_name' => 'local',
  1272. ]);
  1273. // add cvterms for the map unit types
  1274. $term = chado_insert_cvterm([
  1275. 'id' => 'local:cdna_library',
  1276. 'name' => 'cdna_library',
  1277. 'definition' => 'cDNA library',
  1278. 'cv_name' => 'library_type',
  1279. 'db_name' => 'local',
  1280. ]);
  1281. $term = chado_insert_cvterm([
  1282. 'id' => 'local:bac_library',
  1283. 'name' => 'bac_library',
  1284. 'definition' => 'Bacterial Artifical Chromsome (BAC) library',
  1285. 'cv_name' => 'library_type',
  1286. 'db_name' => 'local',
  1287. ]);
  1288. $term = chado_insert_cvterm([
  1289. 'id' => 'local:fosmid_library',
  1290. 'name' => 'fosmid_library',
  1291. 'definition' => 'Fosmid library',
  1292. 'cv_name' => 'library_type',
  1293. 'db_name' => 'local',
  1294. ]);
  1295. $term = chado_insert_cvterm([
  1296. 'id' => 'local:cosmid_library',
  1297. 'name' => 'cosmid_library',
  1298. 'definition' => 'Cosmid library',
  1299. 'cv_name' => 'library_type',
  1300. 'db_name' => 'local',
  1301. ]);
  1302. $term = chado_insert_cvterm([
  1303. 'id' => 'local:yac_library',
  1304. 'name' => 'yac_library',
  1305. 'definition' => 'Yeast Artificial Chromosome (YAC) library',
  1306. 'cv_name' => 'library_type',
  1307. 'db_name' => 'local',
  1308. ]);
  1309. $term = chado_insert_cvterm([
  1310. 'id' => 'local:genomic_library',
  1311. 'name' => 'genomic_library',
  1312. 'definition' => 'Genomic Library',
  1313. 'cv_name' => 'library_type',
  1314. 'db_name' => 'local',
  1315. ]);
  1316. //--------------
  1317. // Feature Map
  1318. //--------------
  1319. // add cvterms for the map unit types
  1320. $term = chado_insert_cvterm([
  1321. 'name' => 'cM',
  1322. 'definition' => 'Centimorgan units',
  1323. 'cv_name' => 'featuremap_units',
  1324. 'is_relationship' => 0,
  1325. 'db_name' => 'local',
  1326. ]);
  1327. $term = chado_insert_cvterm([
  1328. 'name' => 'bp',
  1329. 'definition' => 'Base pairs units',
  1330. 'cv_name' => 'featuremap_units',
  1331. 'is_relationship' => 0,
  1332. 'db_name' => 'local',
  1333. ]);
  1334. $term = chado_insert_cvterm([
  1335. 'name' => 'bin_unit',
  1336. 'definition' => 'The bin unit',
  1337. 'cv_name' => 'featuremap_units',
  1338. 'is_relationship' => 0,
  1339. 'db_name' => 'local',
  1340. ]);
  1341. $term = chado_insert_cvterm([
  1342. 'name' => 'marker_order',
  1343. 'definition' => 'Units simply to define marker order.',
  1344. 'cv_name' => 'featuremap_units',
  1345. 'is_relationship' => 0,
  1346. 'db_name' => 'local',
  1347. ]);
  1348. $term = chado_insert_cvterm([
  1349. 'name' => 'undefined',
  1350. 'definition' => 'A catch-all for an undefined unit type',
  1351. 'cv_name' => 'featuremap_units',
  1352. 'is_relationship' => 0,
  1353. 'db_name' => 'local',
  1354. ]);
  1355. // featurepos properties
  1356. $term = chado_insert_cvterm([
  1357. 'name' => 'start',
  1358. 'definition' => 'The start coordinate for a map feature.',
  1359. 'cv_name' => 'featurepos_property',
  1360. 'is_relationship' => 0,
  1361. 'db_name' => 'local',
  1362. ]);
  1363. $term = chado_insert_cvterm([
  1364. 'name' => 'stop',
  1365. 'definition' => 'The end coordinate for a map feature',
  1366. 'cv_name' => 'featurepos_property',
  1367. 'is_relationship' => 0,
  1368. 'db_name' => 'local',
  1369. ]);
  1370. // add cvterms for map properties
  1371. $term = chado_insert_cvterm([
  1372. 'name' => 'Map Dbxref',
  1373. 'definition' => 'A unique identifer for the map in a remote database. The '
  1374. . 'format is a database abbreviation and a unique accession separated '
  1375. . 'by a colon. (e.g. Gramene:tsh1996a)',
  1376. 'cv_name' => 'featuremap_property',
  1377. 'is_relationship' => 0,
  1378. 'db_name' => 'local',
  1379. ]);
  1380. $term = chado_insert_cvterm([
  1381. 'name' => 'Map Type',
  1382. 'definition' => 'The type of Map (e.g. QTL, Physical, etc.)',
  1383. 'cv_name' => 'featuremap_property',
  1384. 'is_relationship' => 0,
  1385. 'db_name' => 'local',
  1386. ]);
  1387. $term = chado_insert_cvterm([
  1388. 'name' => 'Genome Group',
  1389. 'definition' => '',
  1390. 'cv_name' => 'featuremap_property',
  1391. 'is_relationship' => 0,
  1392. 'db_name' => 'local',
  1393. ]);
  1394. $term = chado_insert_cvterm([
  1395. 'name' => 'URL',
  1396. 'definition' => 'A univeral resource locator (URL) reference where the '
  1397. . 'publication can be found. For maps found online, this would be '
  1398. . 'the web address for the map.',
  1399. 'cv_name' => 'featuremap_property',
  1400. 'is_relationship' => 0,
  1401. 'db_name' => 'local',
  1402. ]);
  1403. $term = chado_insert_cvterm([
  1404. 'name' => 'Population Type',
  1405. 'definition' => 'A brief description of the population type used to generate '
  1406. . 'the map (e.g. RIL, F2, BC1, etc).',
  1407. 'cv_name' => 'featuremap_property',
  1408. 'is_relationship' => 0,
  1409. 'db_name' => 'local',
  1410. ]);
  1411. $term = chado_insert_cvterm([
  1412. 'name' => 'Population Size',
  1413. 'definition' => 'The size of the population used to construct the map.',
  1414. 'cv_name' => 'featuremap_property',
  1415. 'is_relationship' => 0,
  1416. 'db_name' => 'local',
  1417. ]);
  1418. $term = chado_insert_cvterm([
  1419. 'name' => 'Methods',
  1420. 'definition' => 'A brief description of the methods used to construct the map.',
  1421. 'cv_name' => 'featuremap_property',
  1422. 'is_relationship' => 0,
  1423. 'db_name' => 'local',
  1424. ]);
  1425. $term = chado_insert_cvterm([
  1426. 'name' => 'Software',
  1427. 'definition' => 'The software used to construct the map.',
  1428. 'cv_name' => 'featuremap_property',
  1429. 'is_relationship' => 0,
  1430. 'db_name' => 'local',
  1431. ]);
  1432. $term = chado_insert_cvterm([
  1433. 'name' => 'Reference Feature',
  1434. 'definition' => 'A genomic or genetic feature on which other features are mapped.',
  1435. 'cv_name' => 'local',
  1436. 'is_relationship' => 0,
  1437. 'db_name' => 'local',
  1438. ]);
  1439. chado_associate_semweb_term('featurepos', 'map_feature_id', $term);
  1440. //--------------
  1441. // Featureloc Terms
  1442. //--------------
  1443. $term = chado_insert_cvterm([
  1444. 'id' => 'local:fmin',
  1445. 'name' => 'minimal boundary',
  1446. 'definition' => 'The leftmost, minimal boundary in the linear range ' .
  1447. 'represented by the feature location. Sometimes this is called ' .
  1448. 'start although this is confusing because it does not necessarily ' .
  1449. 'represent the 5-prime coordinate.',
  1450. 'cv_name' => 'local',
  1451. ]);
  1452. chado_associate_semweb_term('featureloc', 'fmin', $term);
  1453. $term = chado_insert_cvterm([
  1454. 'id' => 'local:fmax',
  1455. 'name' => 'maximal boundary',
  1456. 'definition' => 'The rightmost, maximal boundary in the linear range ' .
  1457. 'represented by the featureloc. Sometimes this is called end although ' .
  1458. 'this is confusing because it does not necessarily represent the ' .
  1459. '3-prime coordinate',
  1460. 'cv_name' => 'local',
  1461. ]);
  1462. chado_associate_semweb_term('featureloc', 'fmax', $term);
  1463. //--------------
  1464. // Analysis Terms
  1465. //--------------
  1466. // add analysis_date. This is no longer used (as far as we can tell) but we don't
  1467. // get rid of it in case it is used, so just keep it in the Tripal CV
  1468. $term = chado_insert_cvterm([
  1469. 'name' => 'analysis_date',
  1470. 'definition' => 'The date that an analysis was performed.',
  1471. 'cv_name' => 'tripal_analysis',
  1472. 'is_relationship' => 0,
  1473. 'db_name' => 'local',
  1474. ], ['update_existing' => TRUE]);
  1475. // add analysis_short_name. This is no longer used (as far as we can tell) but we don't
  1476. // get rid of it in case it is used, so just keep it in the Tripal CV
  1477. $term = chado_insert_cvterm([
  1478. 'name' => 'analysis_short_name',
  1479. 'definition' => 'A computer legible (no spaces or special characters) '
  1480. . 'abbreviation for the analysis.',
  1481. 'cv_name' => 'tripal_analysis',
  1482. 'is_relationship' => 0,
  1483. 'db_name' => 'local',
  1484. ], ['update_existing' => TRUE]);
  1485. // the 'analysis_property' vocabulary is for user definable properties wo we
  1486. // will add an 'Analysis Type' to this vocubulary
  1487. $term = chado_insert_cvterm([
  1488. 'id' => 'local:Analysis Type',
  1489. 'name' => 'Analysis Type',
  1490. 'definition' => 'The type of analysis that was performed.',
  1491. 'cv_name' => 'analysis_property',
  1492. 'is_relationship' => 0,
  1493. 'db_name' => 'local',
  1494. ], ['update_existing' => TRUE]);
  1495. // Add a term to be used for an inherent 'type_id' for the organism table.
  1496. $term = chado_insert_cvterm([
  1497. 'id' => 'local:analysis',
  1498. 'name' => 'analysis',
  1499. 'definition' => 'A process as a method of studying the nature of something ' .
  1500. 'or of determining its essential features and their relations. ' .
  1501. '(Random House Kernerman Webster\'s College Dictionary, © 2010 K ' .
  1502. 'Dictionaries Ltd).',
  1503. 'cv_name' => 'local',
  1504. ]);
  1505. $term = chado_insert_cvterm([
  1506. 'id' => 'local:source_data',
  1507. 'name' => 'source_data',
  1508. 'definition' => 'The location where data that is being used come from.',
  1509. 'cv_name' => 'local',
  1510. ]);
  1511. //--------------
  1512. // Terms for Content Types
  1513. //--------------
  1514. $term = chado_insert_cvterm([
  1515. 'id' => 'local:contact',
  1516. 'name' => 'contact',
  1517. 'definition' => 'An entity (e.g. individual or organization) through ' .
  1518. 'whom a person can gain access to information, favors, ' .
  1519. 'influential people, and the like.',
  1520. 'cv_name' => 'local',
  1521. ]);
  1522. chado_associate_semweb_term('biomaterial', 'biosourceprovider_id', $term);
  1523. chado_associate_semweb_term(NULL, 'contact_id', $term);
  1524. $term = chado_insert_cvterm([
  1525. 'id' => 'local:relationship',
  1526. 'name' => 'relationship',
  1527. 'definition' => 'The way in which two things are connected.',
  1528. 'cv_name' => 'local',
  1529. ]);
  1530. $term = chado_insert_cvterm([
  1531. 'id' => 'local:biomaterial',
  1532. 'name' => 'biomaterial',
  1533. 'definition' => 'A biomaterial represents the MAGE concept of BioSource, BioSample, ' .
  1534. 'and LabeledExtract. It is essentially some biological material (tissue, cells, serum) that ' .
  1535. 'may have been processed. Processed biomaterials should be traceable back to raw ' .
  1536. 'biomaterials via the biomaterialrelationship table.',
  1537. 'cv_name' => 'local',
  1538. ]);
  1539. //
  1540. // Terms for arraydesign table
  1541. //
  1542. $term = chado_insert_cvterm([
  1543. 'id' => 'local:array_dimensions',
  1544. 'name' => 'array_dimensions',
  1545. 'definition' => 'The dimensions of an array.',
  1546. 'cv_name' => 'local',
  1547. ]);
  1548. chado_associate_semweb_term('arraydesign', 'array_dimensions', $term);
  1549. $term = chado_insert_cvterm([
  1550. 'id' => 'local:element_dimensions',
  1551. 'name' => 'element_dimensions',
  1552. 'definition' => 'The dimensions of an element.',
  1553. 'cv_name' => 'local',
  1554. ]);
  1555. chado_associate_semweb_term('arraydesign', 'element_dimensions', $term);
  1556. $term = chado_insert_cvterm([
  1557. 'id' => 'local:num_of_elements',
  1558. 'name' => 'num_of_elements',
  1559. 'definition' => 'The number of elements.',
  1560. 'cv_name' => 'local',
  1561. ]);
  1562. chado_associate_semweb_term('arraydesign', 'num_of_elements', $term);
  1563. $term = chado_insert_cvterm([
  1564. 'id' => 'local:num_array_columns',
  1565. 'name' => 'num_array_columns',
  1566. 'definition' => 'The number of columns in an array.',
  1567. 'cv_name' => 'local',
  1568. ]);
  1569. chado_associate_semweb_term('arraydesign', 'num_array_columns', $term);
  1570. $term = chado_insert_cvterm([
  1571. 'id' => 'local:num_array_rows',
  1572. 'name' => 'num_array_rows',
  1573. 'definition' => 'The number of rows in an array.',
  1574. 'cv_name' => 'local',
  1575. ]);
  1576. chado_associate_semweb_term('arraydesign', 'num_array_rows', $term);
  1577. $term = chado_insert_cvterm([
  1578. 'id' => 'local:num_grid_columns',
  1579. 'name' => 'num_grid_columns',
  1580. 'definition' => 'The number of columns in a grid.',
  1581. 'cv_name' => 'local',
  1582. ]);
  1583. chado_associate_semweb_term('arraydesign', 'num_grid_columns', $term);
  1584. $term = chado_insert_cvterm([
  1585. 'id' => 'local:num_grid_rows',
  1586. 'name' => 'num_grid_rows',
  1587. 'definition' => 'The number of rows in a grid.',
  1588. 'cv_name' => 'local',
  1589. ]);
  1590. chado_associate_semweb_term('arraydesign', 'num_grid_rows', $term);
  1591. $term = chado_insert_cvterm([
  1592. 'id' => 'local:num_sub_columns',
  1593. 'name' => 'num_sub_columns',
  1594. 'definition' => 'The number of sub columns.',
  1595. 'cv_name' => 'local',
  1596. ]);
  1597. chado_associate_semweb_term('arraydesign', 'num_sub_columns', $term);
  1598. $term = chado_insert_cvterm([
  1599. 'id' => 'local:num_sub_rows',
  1600. 'name' => 'num_sub_rows',
  1601. 'definition' => 'The number of sub rows.',
  1602. 'cv_name' => 'local',
  1603. ]);
  1604. chado_associate_semweb_term('arraydesign', 'num_sub_rows', $term);
  1605. //
  1606. // Terms for Study
  1607. //
  1608. chado_insert_cvterm([
  1609. 'name' => 'Study Type',
  1610. 'definition' => 'A type of study',
  1611. 'cv_name' => 'study_property',
  1612. 'db_name' => 'local',
  1613. ]);
  1614. $term = chado_insert_cvterm([
  1615. 'id' => 'local:Genome Project',
  1616. 'name' => 'Genome Project',
  1617. 'definition' => 'A project for whole genome analysis that can include assembly and annotation.',
  1618. 'cv_name' => 'local',
  1619. ]);
  1620. }
  1621. /**
  1622. * Adds the Systems Biology Ontology database and terms.
  1623. */
  1624. function tripal_chado_populate_vocab_SBO() {
  1625. chado_insert_db([
  1626. 'name' => 'SBO',
  1627. 'description' => 'Systems Biology.',
  1628. 'url' => 'http://www.ebi.ac.uk/sbo/main/',
  1629. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  1630. ]);
  1631. chado_insert_cv(
  1632. 'sbo',
  1633. 'Systems Biology. Terms commonly used in Systems Biology, and in particular in computational modeling.'
  1634. );
  1635. $dbxref = chado_insert_cvterm([
  1636. 'id' => 'SBO:0000358',
  1637. 'name' => 'phenotype',
  1638. 'cv_name' => 'sbo',
  1639. '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.',
  1640. ]);
  1641. $dbxref = chado_insert_cvterm([
  1642. 'id' => 'SBO:0000554',
  1643. 'name' => 'database cross reference',
  1644. 'cv_name' => 'sbo',
  1645. 'definition' => 'An annotation which directs one to information contained within a database.',
  1646. ]);
  1647. $relationship = chado_insert_cvterm([
  1648. 'id' => 'SBO:0000374',
  1649. 'name' => 'relationship',
  1650. 'cv_name' => 'sbo',
  1651. 'definition' => 'Connectedness between entities and/or interactions representing their relatedness or influence.',
  1652. ]);
  1653. }
  1654. /**
  1655. * Adds the "Bioinformatics operations, data types, formats, identifiers and
  1656. * topics" database and terms.
  1657. */
  1658. function tripal_chado_populate_vocab_SWO() {
  1659. chado_insert_db([
  1660. 'name' => 'SWO',
  1661. 'description' => 'Bioinformatics operations, data types, formats, identifiers and topics',
  1662. 'url' => 'http://purl.obolibrary.org/obo/swo',
  1663. 'urlprefix' => 'http://www.ebi.ac.uk/swo/{db}_{accession}',
  1664. ]);
  1665. chado_insert_cv('swo', 'Bioinformatics operations, data types, formats, identifiers and topics.');
  1666. $term = chado_insert_cvterm([
  1667. 'id' => 'SWO:0000001',
  1668. 'name' => 'software',
  1669. 'cv_name' => 'swo',
  1670. 'definition' => 'Computer software, or generally just software, is any ' .
  1671. 'set of machine-readable instructions (most often in the form of a ' .
  1672. 'computer program) that conform to a given syntax (sometimes ' .
  1673. 'referred to as a language) that is interpretable by a given ' .
  1674. 'processor and that directs a computer\'s processor to perform ' .
  1675. 'specific operations.',
  1676. ]);
  1677. chado_associate_semweb_term('analysis', 'program', $term);
  1678. chado_associate_semweb_term('protocol', 'softwaredescription', $term);
  1679. }
  1680. /**
  1681. * Adds the contact table mapping.
  1682. */
  1683. function tripal_chado_populate_vocab_TCONTACT() {
  1684. chado_insert_db([
  1685. 'name' => 'TCONTACT',
  1686. 'description' => 'Tripal Contact Ontology. A temporary ontology until a more formal appropriate ontology an be identified.',
  1687. 'url' => 'cv/lookup/TCONTACT',
  1688. 'urlprefix' => 'cv/lookup/TCONTACT/{accession}',
  1689. ]);
  1690. chado_insert_cv('tripal_contact', 'Tripal Contact Ontology. A temporary ontology until a more formal appropriate ontology an be identified.');
  1691. }
  1692. /**
  1693. * Adds the pub table mappings.
  1694. */
  1695. function tripal_chado_populate_vocab_TPUB() {
  1696. chado_insert_db([
  1697. 'name' => 'TPUB',
  1698. 'description' => 'Tripal Publication Ontology. A temporary ontology until a more formal appropriate ontology an be identified.',
  1699. 'url' => 'cv/lookup/TPUB',
  1700. 'urlprefix' => 'cv/lookup/TPUB/{accession}',
  1701. ]);
  1702. chado_insert_cv('tripal_pub', 'Tripal Publication Ontology. A temporary ontology until a more formal appropriate ontology an be identified.');
  1703. // make sure we have our supported databases
  1704. chado_insert_db(
  1705. [
  1706. 'name' => 'PMID',
  1707. 'description' => 'PubMed',
  1708. 'url' => 'http://www.ncbi.nlm.nih.gov/pubmed',
  1709. 'urlprefix' => 'http://www.ncbi.nlm.nih.gov/pubmed/{accession}',
  1710. ],
  1711. ['update_existing' => TRUE]
  1712. );
  1713. chado_insert_db(
  1714. [
  1715. 'name' => 'AGL',
  1716. 'description' => 'USDA National Agricultural Library',
  1717. 'url' => 'http://agricola.nal.usda.gov/',
  1718. ],
  1719. ['update_existing' => TRUE]
  1720. );
  1721. $term = chado_get_cvterm(['id' => 'TPUB:0000039']);
  1722. chado_associate_semweb_term('pub', 'title', $term);
  1723. $term = chado_get_cvterm(['id' => 'TPUB:0000243']);
  1724. chado_associate_semweb_term('pub', 'volumetitle', $term);
  1725. $term = chado_get_cvterm(['id' => 'TPUB:0000042']);
  1726. chado_associate_semweb_term('pub', 'volume', $term);
  1727. $term = chado_get_cvterm(['id' => 'TPUB:0000256']);
  1728. chado_associate_semweb_term('pub', 'series_name', $term);
  1729. $term = chado_get_cvterm(['id' => 'TPUB:0000043']);
  1730. chado_associate_semweb_term('pub', 'issue', $term);
  1731. $term = chado_get_cvterm(['id' => 'TPUB:0000059']);
  1732. chado_associate_semweb_term('pub', 'pyear', $term);
  1733. $term = chado_get_cvterm(['id' => 'TPUB:0000044']);
  1734. chado_associate_semweb_term('pub', 'pages', $term);
  1735. $term = chado_get_cvterm(['id' => 'TPUB:0000244']);
  1736. chado_associate_semweb_term('pub', 'publisher', $term);
  1737. $term = chado_get_cvterm(['id' => 'TPUB:0000245']);
  1738. chado_associate_semweb_term('pub', 'pubplace', $term);
  1739. }
  1740. /**
  1741. * Adds the Uni Ontology database, terms and mappings.
  1742. */
  1743. function tripal_chado_populate_vocab_UO() {
  1744. chado_insert_db([
  1745. 'name' => 'UO',
  1746. 'description' => 'Units of Measurement Ontology',
  1747. 'url' => 'http://purl.obolibrary.org/obo/uo',
  1748. 'urlprefix' => 'http://purl.obolibrary.org/obo/TAXRANK_',
  1749. ]);
  1750. chado_insert_cv('uo', 'Units of Measurement Ontology');
  1751. $term = chado_insert_cvterm([
  1752. 'id' => 'UO:0000000',
  1753. 'name' => 'unit',
  1754. 'cv_name' => 'uo',
  1755. 'description' => 'A unit of measurement is a standardized quantity of a physical quality.',
  1756. ]);
  1757. chado_associate_semweb_term('featuremap', 'unittype_id', $term);
  1758. }
  1759. /**
  1760. * Adds the Taxonomic Rank Ontology database and terms.
  1761. */
  1762. function tripal_chado_populate_vocab_TAXRANK() {
  1763. chado_insert_db([
  1764. 'name' => 'TAXRANK',
  1765. 'description' => 'A vocabulary of taxonomic ranks (species, family, phylum, etc)',
  1766. 'url' => 'http://www.obofoundry.org/ontology/taxrank.html',
  1767. 'urlprefix' => 'http://purl.obolibrary.org/obo/{db}_{accession}',
  1768. ]);
  1769. chado_insert_cv('taxonomic_rank', 'A vocabulary of taxonomic ranks (species, family, phylum, etc)');
  1770. $term = chado_get_cvterm(['id' => 'TAXRANK:0000005']);
  1771. chado_associate_semweb_term('organism', 'genus', $term);
  1772. $term = chado_get_cvterm(['id' => 'TAXRANK:0000006']);
  1773. chado_associate_semweb_term('organism', 'species', $term);
  1774. $term = chado_get_cvterm(['id' => 'TAXRANK:0000045']);
  1775. chado_associate_semweb_term('organism', 'infraspecific_name', $term);
  1776. }
  1777. /**
  1778. * Adds the NCIT vocabulary database and terms.
  1779. */
  1780. function tripal_chado_populate_vocab_NCIT() {
  1781. chado_insert_db([
  1782. 'name' => 'NCIT',
  1783. 'description' => 'NCI Thesaurus OBO Edition.',
  1784. 'url' => 'http://purl.obolibrary.org/obo/ncit.owl',
  1785. 'urlprefix' => ' http://purl.obolibrary.org/obo/{db}_{accession}',
  1786. ]);
  1787. chado_insert_cv(
  1788. 'ncit',
  1789. 'The NCIt OBO Edition project aims to increase integration of the NCIt with OBO Library ontologies. NCIt is a reference terminology that includes broad coverage of the cancer domain, including cancer related diseases, findings and abnormalities. NCIt OBO Edition releases should be considered experimental.'
  1790. );
  1791. $term = chado_insert_cvterm([
  1792. 'id' => 'NCIT:C25164',
  1793. 'name' => 'Date',
  1794. 'cv_name' => 'ncit',
  1795. 'definition' => 'The particular day, month and year an event has happened or will happen.',
  1796. ]);
  1797. chado_associate_semweb_term('assay', 'assaydate', $term);
  1798. chado_associate_semweb_term('acquisition', 'acquisitiondate', $term);
  1799. chado_associate_semweb_term('quantification', 'quantificationdate', $term);
  1800. $term = chado_insert_cvterm([
  1801. 'id' => 'NCIT:C48036',
  1802. 'name' => 'Operator',
  1803. 'cv_name' => 'ncit',
  1804. 'definition' => 'A person that operates some apparatus or machine',
  1805. ]);
  1806. chado_associate_semweb_term(NULL, 'operator_id', $term);
  1807. $term = chado_insert_cvterm([
  1808. 'id' => 'NCIT:C45378',
  1809. 'name' => 'Technology Platform',
  1810. 'cv_name' => 'ncit',
  1811. 'definition' => 'The specific version (manufacturer, model, etc.) of a technology that is used to carry out a laboratory or computational experiment.',
  1812. ]);
  1813. chado_associate_semweb_term('arraydesign', 'platformtype_id', $term);
  1814. $term = chado_insert_cvterm([
  1815. 'id' => 'NCIT:C25712',
  1816. 'name' => 'Value',
  1817. 'cv_name' => 'ncit',
  1818. 'definition' => 'A numerical quantity measured or assigned or computed.',
  1819. ]);
  1820. chado_associate_semweb_term(NULL, 'value', $term);
  1821. $term = chado_insert_cvterm([
  1822. 'id' => 'NCIT:C44170',
  1823. 'name' => 'Channel',
  1824. 'cv_name' => 'ncit',
  1825. 'definition' => 'An independent acquisition scheme, i.e., a route or conduit through which flows data consisting of one particular measurement using one particular parameter.',
  1826. ]);
  1827. chado_associate_semweb_term(NULL, 'channel_id', $term);
  1828. $term = chado_insert_cvterm([
  1829. 'id' => 'NCIT:C48697',
  1830. 'name' => 'Controlled Vocabulary',
  1831. 'cv_name' => 'ncit',
  1832. 'definition' => 'A set of terms that are selected and defined based on the requirements set out by the user group, usually a set of vocabulary is chosen to promote consistency across data collection projects. [ NCI ]',
  1833. ]);
  1834. chado_associate_semweb_term(NULL, 'cv_id', $term);
  1835. $term = chado_insert_cvterm([
  1836. 'id' => 'NCIT:C45559',
  1837. 'name' => 'Term',
  1838. 'cv_name' => 'ncit',
  1839. 'definition' => 'A word or expression used for some particular thing. [ NCI ]',
  1840. ]);
  1841. chado_associate_semweb_term(NULL, 'cvterm_id', $term);
  1842. $term = chado_insert_cvterm([
  1843. 'id' => 'NCIT:C80488',
  1844. 'name' => 'Expression',
  1845. 'cv_name' => 'ncit',
  1846. 'definition' => 'A combination of symbols that represents a value. [ NCI ]',
  1847. ]);
  1848. chado_associate_semweb_term(NULL, 'expression_id', $term);
  1849. $term = chado_insert_cvterm([
  1850. 'id' => 'NCIT:C16977',
  1851. 'name' => 'Phenotype',
  1852. 'cv_name' => 'ncit',
  1853. 'definition' => 'The assemblage of traits or outward appearance of an individual. It is the product of interactions between genes and between genes and the environment. [ NCI ]',
  1854. ]);
  1855. chado_associate_semweb_term(NULL, 'phenotype_id', $term);
  1856. $term = chado_insert_cvterm([
  1857. 'id' => 'NCIT:C16631',
  1858. 'name' => 'Genotype',
  1859. 'cv_name' => 'ncit',
  1860. 'definition' => 'The genetic constitution of an organism or cell, as distinct from its expressed features or phenotype. [ NCI ]',
  1861. ]);
  1862. chado_associate_semweb_term(NULL, 'genotype_id', $term);
  1863. $term = chado_insert_cvterm([
  1864. 'id' => 'NCIT:C25341',
  1865. 'name' => 'Location',
  1866. 'cv_name' => 'ncit',
  1867. 'definition' => 'A position, site, or point in space where something can be found. [ NCI ]',
  1868. ]);
  1869. chado_associate_semweb_term(NULL, 'nd_geolocation_id', $term);
  1870. $term = chado_insert_cvterm([
  1871. 'id' => 'NCIT:C802',
  1872. 'name' => 'Reagent',
  1873. 'cv_name' => 'ncit',
  1874. 'definition' => 'Any natural or synthetic substance used in a chemical or biological reaction in order to produce, identify, or measure another substance. [ NCI ]',
  1875. ]);
  1876. chado_associate_semweb_term(NULL, 'nd_reagent_id', $term);
  1877. $term = chado_insert_cvterm([
  1878. 'id' => 'NCIT:C16551',
  1879. 'name' => 'Environment',
  1880. 'cv_name' => 'ncit',
  1881. 'definition' => 'The totality of surrounding conditions. [ NCI ]',
  1882. ]);
  1883. chado_associate_semweb_term(NULL, 'environment_id', $term);
  1884. $term = chado_insert_cvterm([
  1885. 'id' => 'NCIT:C42765',
  1886. 'name' => 'Tree Node',
  1887. 'cv_name' => 'ncit',
  1888. 'definition' => 'A term that refers to any individual item or entity in a hierarchy or pedigree. [ NCI ]',
  1889. ]);
  1890. chado_associate_semweb_term(NULL, 'phylonode_id', $term);
  1891. $term = chado_insert_cvterm([
  1892. 'id' => 'NCIT:C15320',
  1893. 'name' => 'Study Design',
  1894. 'cv_name' => 'ncit',
  1895. 'definition' => 'A plan detailing how a study will be performed in order to represent the phenomenon under examination, to answer the research questions that have been asked, and defining the methods of data analysis. Study design is driven by research hypothesis being posed, study subject/population/sample available, logistics/resources: technology, support, networking, collaborative support, etc. [ NCI ]',
  1896. ]);
  1897. chado_associate_semweb_term(NULL, 'studydesign_id', $term);
  1898. // The Company term is missing for the Tripal Contact ontology, but is
  1899. // useful for the arraydesign.manufacturer which is an FK to Contact.
  1900. // It seems better to use a term from a curated ontology than to add to
  1901. // Tripal Contact.
  1902. $term = chado_insert_cvterm([
  1903. 'id' => 'NCIT:C54131',
  1904. 'name' => 'Company',
  1905. 'cv_name' => 'ncit',
  1906. 'definition' => 'Any formal business entity for profit, which may be a corporation, a partnership, association or individual proprietorship.',
  1907. ]);
  1908. $term = chado_insert_cvterm([
  1909. 'id' => 'NCIT:C47885',
  1910. 'name' => 'Project',
  1911. 'cv_name' => 'ncit',
  1912. 'definition' => 'Any specifically defined piece of work that is undertaken or attempted to meet a single requirement.',
  1913. ]);
  1914. chado_associate_semweb_term(NULL, 'project_id', $term);
  1915. $term = chado_insert_cvterm([
  1916. 'id' => 'NCIT:C16223',
  1917. 'name' => 'DNA Library',
  1918. 'cv_name' => 'ncit',
  1919. 'definition' => 'A collection of DNA molecules that have been cloned in vectors.',
  1920. ]);
  1921. $term = chado_insert_cvterm([
  1922. 'id' => 'NCIT:C85496',
  1923. 'name' => 'Trait',
  1924. 'cv_name' => 'ncit',
  1925. 'definition' => 'Any genetically determined characteristic.',
  1926. ]);
  1927. $term = chado_insert_cvterm([
  1928. 'id' => 'NCIT:C25693',
  1929. 'name' => 'Subgroup',
  1930. 'cv_name' => 'ncit',
  1931. 'definition' => 'A subdivision of a larger group with members often exhibiting similar characteristics. [ NCI ]',
  1932. ]);
  1933. }
  1934. /**
  1935. * Adds the NCBI Taxon vocabulary database and terms.
  1936. */
  1937. function tripal_chado_populate_vocab_NCBITAXON() {
  1938. chado_insert_db([
  1939. 'name' => 'NCBITaxon',
  1940. 'description' => 'NCBI organismal classification.',
  1941. 'url' => 'http://www.berkeleybop.org/ontologies/ncbitaxon/',
  1942. 'urlprefix' => 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id={accession}',
  1943. ]);
  1944. chado_insert_cv(
  1945. 'ncbitaxon',
  1946. 'NCBI organismal classification. An ontology representation of the NCBI organismal taxonomy.'
  1947. );
  1948. $term = chado_insert_cvterm([
  1949. 'id' => 'NCBITaxon:common_name',
  1950. 'name' => 'common name',
  1951. 'cv_name' => 'ncbitaxon',
  1952. ]);
  1953. chado_associate_semweb_term('organism', 'common_name', $term);
  1954. }
  1955. /**
  1956. * Adds defaults to the chado_semweb table.
  1957. */
  1958. function tripal_chado_semweb_form($form, &$form_state, $chado_table = NULL) {
  1959. if (array_key_exists('values', $form_state)) {
  1960. $chado_table = $form_state['values']['chado_table'];
  1961. }
  1962. $chado_tables = chado_get_table_names(TRUE);
  1963. $chado_tables = array_merge(['Select a Chado Table'], $chado_tables);
  1964. // Make sure the table name exists. If not, reset it.
  1965. $chado_table = in_array($chado_table, $chado_tables) ? $chado_table : NULL;
  1966. $form['chado_table'] = [
  1967. '#type' => 'select',
  1968. '#title' => 'Chado Table',
  1969. '#description' => t('Select a chado table to set vocabulary terms used for its columns.'),
  1970. '#options' => $chado_tables,
  1971. '#default_value' => $chado_table,
  1972. '#ajax' => [
  1973. 'callback' => "tripal_chado_semweb_form_ajax_callback",
  1974. 'wrapper' => "tripal-chado-semweb-form",
  1975. 'effect' => 'fade',
  1976. 'method' => 'replace',
  1977. ],
  1978. ];
  1979. // If the user has selected a chado table, then we need to
  1980. // show the columns for setting terms.
  1981. if ($chado_table) {
  1982. $schema = chado_get_schema($chado_table);
  1983. $pk = $schema['primary key'][0];
  1984. // $cv_default = db_select('tripal_cv_defaults', 'tc')
  1985. // ->fields('tc', array('field_name'))
  1986. // ->condition('table_name', $chado_table)
  1987. // ->execute()
  1988. // ->fetchField();
  1989. $columns = $schema['fields'];
  1990. $headers = [
  1991. 'Field Name',
  1992. 'Vocabulary',
  1993. [
  1994. 'data' => 'Name',
  1995. 'nowrap' => TRUE,
  1996. ],
  1997. 'Term',
  1998. 'Term Description',
  1999. 'Action',
  2000. ];
  2001. $rows = [];
  2002. foreach ($columns AS $column => $detail) {
  2003. // Do not show column if it's the primary key or default cv
  2004. if ($column != $pk && $column != $cv_default) {
  2005. $cvterm_id =
  2006. db_select('chado_semweb', 'cs')
  2007. ->fields('cs', ['cvterm_id'])
  2008. ->condition('chado_table', $chado_table)
  2009. ->condition('chado_column', $column)
  2010. ->execute()
  2011. ->fetchField();
  2012. $sw_voc = '';
  2013. $sw_term = '';
  2014. $sw_desc = '';
  2015. $sw_accession = '';
  2016. if ($cvterm_id) {
  2017. $term = chado_generate_var('cvterm', ['cvterm_id' => $cvterm_id]);
  2018. $term = chado_expand_var($term, 'field', 'cvterm.definition');
  2019. $sw_voc = $term->cv_id->name;
  2020. $sw_term = $term->name;
  2021. $sw_accession = l($term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession,
  2022. 'cv/lookup/' . $term->dbxref_id->db_id->name . '/' . $term->dbxref_id->accession,
  2023. ['attributes' => ['target' => '_blank']]);
  2024. $sw_desc = $term->definition;
  2025. }
  2026. $rows[] = [
  2027. $column,
  2028. $sw_voc,
  2029. $sw_term,
  2030. $sw_accession,
  2031. $sw_desc,
  2032. [
  2033. 'data' => l('Edit', '/admin/tripal/storage/chado/semweb/edit/' . $chado_table . '/' . $column) . ' | ' .
  2034. l('Reset', '/admin/tripal/storage/chado/semweb/reset/' . $chado_table . '/' . $column),
  2035. 'nowrap' => TRUE,
  2036. ],
  2037. ];
  2038. }
  2039. }
  2040. $output = theme('table', [
  2041. 'header' => $headers,
  2042. 'rows' => $rows,
  2043. ]);
  2044. $form['table'] = [
  2045. '#markup' => $output,
  2046. ];
  2047. }
  2048. $form['#prefix'] = '<div id="tripal-chado-semweb-form">';
  2049. $form['#suffix'] = '</div>';
  2050. return $form;
  2051. }
  2052. /**
  2053. * Implements hook_form()
  2054. * Edit terms used by the semantic web
  2055. *
  2056. * @param $form
  2057. * @param $form_state
  2058. * @param $table
  2059. * @param $column
  2060. *
  2061. * @return $form
  2062. */
  2063. function tripal_chado_semweb_edit_form($form, &$form_state, $table = NULL, $column = NULL) {
  2064. $term_name = array_key_exists('values', $form_state) ? $form_state['values']['term_name'] : '';
  2065. $form['chado_table'] = [
  2066. '#markup' => 'Term used for the <strong>' . t($column) . '</strong> column of the chado <strong>' . t($table) . '</strong> table:',
  2067. ];
  2068. $form['table_name'] = [
  2069. '#type' => 'value',
  2070. '#value' => $table,
  2071. ];
  2072. $form['column'] = [
  2073. '#type' => 'value',
  2074. '#value' => $column,
  2075. ];
  2076. // If no term has been selected yet then provide the auto complete field.
  2077. $form['term_name'] = [
  2078. '#title' => t('Term'),
  2079. '#type' => 'textfield',
  2080. '#description' => t("The content type must be the name of a term in
  2081. a controlled vocabulary and the controlled vocabulary should
  2082. already be loaded into Tripal. For example, to create a content
  2083. type for storing 'genes', use the 'gene' term from the
  2084. Sequence Ontology (SO)."),
  2085. '#required' => TRUE,
  2086. '#default_value' => $term_name,
  2087. '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
  2088. ];
  2089. $form['select_button'] = [
  2090. '#type' => 'button',
  2091. '#value' => t('Lookup Term'),
  2092. '#name' => 'select_cvterm',
  2093. '#ajax' => [
  2094. 'callback' => "tripal_chado_semweb_form_ajax_callback",
  2095. 'wrapper' => "tripal-chado-semweb-edit-form",
  2096. 'effect' => 'fade',
  2097. 'method' => 'replace',
  2098. ],
  2099. ];
  2100. if ($term_name) {
  2101. $form['terms_list'] = [
  2102. '#type' => 'fieldset',
  2103. '#title' => t('Matching Terms'),
  2104. '#description' => t('Please select the term the best matches the
  2105. content type you want to create. If the same term exists in
  2106. multiple vocabularies you will see more than one option below.'),
  2107. ];
  2108. $match = [
  2109. 'name' => $term_name,
  2110. ];
  2111. $terms = chado_generate_var('cvterm', $match, ['return_array' => TRUE]);
  2112. $terms = chado_expand_var($terms, 'field', 'cvterm.definition');
  2113. $num_terms = 0;
  2114. foreach ($terms as $term) {
  2115. // Save the user a click by setting the default value as 1 if there's
  2116. // only one matching term.
  2117. $default = FALSE;
  2118. $attrs = [];
  2119. if ($num_terms == 0 and count($terms) == 1) {
  2120. $default = TRUE;
  2121. $attrs = ['checked' => 'checked'];
  2122. }
  2123. $form['terms_list']['term-' . $term->cvterm_id] = [
  2124. '#type' => 'checkbox',
  2125. '#title' => $term->name,
  2126. '#default_value' => $default,
  2127. '#attributes' => $attrs,
  2128. '#description' => '<b>Vocabulary:</b> ' . $term->cv_id->name . ' (' . $term->dbxref_id->db_id->name . ') ' . $term->cv_id->definition .
  2129. '<br><b>Term: </b> ' . $term->dbxref_id->db_id->name . ':' . $term->dbxref_id->accession . '. ' .
  2130. '<br><b>Definition:</b> ' . $term->definition,
  2131. ];
  2132. $num_terms++;
  2133. }
  2134. if ($num_terms == 0) {
  2135. $form['terms_list']['none'] = [
  2136. '#type' => 'item',
  2137. '#markup' => '<i>' . t('There is no term that matches the entered text.') . '</i>',
  2138. ];
  2139. }
  2140. // Add in the button for the cases of no terms or too many.
  2141. $form['submit_button'] = [
  2142. '#type' => 'submit',
  2143. '#value' => t('Use this term'),
  2144. '#name' => 'use_cvterm',
  2145. ];
  2146. }
  2147. $form['cancel_button'] = [
  2148. '#type' => 'button',
  2149. '#value' => t('Cancel'),
  2150. '#name' => 'cancel_button',
  2151. '#limit_validation_errors' => [],
  2152. ];
  2153. $form['#prefix'] = '<div id = "tripal-chado-semweb-edit-form">';
  2154. $form['#suffix'] = '</div>';
  2155. return $form;
  2156. }
  2157. /**
  2158. * Implements hook_form_validate()
  2159. *
  2160. * Validate function for editing the semantic web term
  2161. *
  2162. * @param unknown $form
  2163. * @param unknown $form_state
  2164. */
  2165. function tripal_chado_semweb_edit_form_validate($form, &$form_state) {
  2166. if (array_key_exists('clicked_button', $form_state)) {
  2167. if ($form_state['clicked_button']['#name'] == 'use_cvterm') {
  2168. $cvterm_id = NULL;
  2169. // Make sure we have a cvterm selected
  2170. $num_selected = 0;
  2171. foreach ($form_state['values'] as $key => $value) {
  2172. $matches = [];
  2173. if (preg_match("/^term-(\d+)$/", $key, $matches) and
  2174. $form_state['values']['term-' . $matches[1]]) {
  2175. $cvterm_id = $matches[1];
  2176. $num_selected++;
  2177. }
  2178. }
  2179. if ($num_selected == 0) {
  2180. form_set_error('', 'Please select at least one term.');
  2181. }
  2182. else {
  2183. if ($num_selected > 1) {
  2184. form_set_error('term-' . $cvterm_id, 'Please select only one term from the list below.');
  2185. }
  2186. else {
  2187. $form_state['values']['#selected_cvterm_id'] = $cvterm_id;
  2188. }
  2189. }
  2190. }
  2191. else {
  2192. if ($form_state['clicked_button']['#name'] == 'cancel_button') {
  2193. $table_name = $form_state['values']['table_name'];
  2194. drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
  2195. }
  2196. }
  2197. }
  2198. }
  2199. /**
  2200. * Implements hook_form_submit()
  2201. *
  2202. * Submit function for editing the semantic web term
  2203. *
  2204. * @param unknown $form
  2205. * @param unknown $form_state
  2206. */
  2207. function tripal_chado_semweb_edit_form_submit($form, &$form_state) {
  2208. if (array_key_exists('clicked_button', $form_state) && $form_state['clicked_button']['#name'] == 'use_cvterm') {
  2209. $table_name = $form_state['values']['table_name'];
  2210. $column = $form_state['values']['column'];
  2211. $cvterm_id = $form_state['values']['#selected_cvterm_id'];
  2212. // Check if there is already a record
  2213. $record_id =
  2214. db_select('chado_semweb', 'cs')
  2215. ->fields('cs', ['chado_semweb_id'])
  2216. ->condition('chado_table', $table_name)
  2217. ->condition('chado_column', $column)
  2218. ->execute()
  2219. ->fetchField();
  2220. // If the record exists, update it
  2221. if ($record_id) {
  2222. db_update('chado_semweb')
  2223. ->fields([
  2224. 'cvterm_id' => $cvterm_id,
  2225. ])
  2226. ->condition('chado_semweb_id', $record_id)
  2227. ->execute();
  2228. }
  2229. // Otherwise, insert a new record
  2230. else {
  2231. db_insert('chado_semweb')
  2232. ->fields([
  2233. 'chado_table' => $table_name,
  2234. 'chado_column' => $column,
  2235. 'cvterm_id' => $cvterm_id,
  2236. ])
  2237. ->execute();
  2238. }
  2239. drupal_set_message('The term settings have been saved.');
  2240. drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
  2241. }
  2242. }
  2243. /**
  2244. * Implements hook_form()
  2245. * Reset term used by semantic web
  2246. *
  2247. * @param $form
  2248. * @param $form_state
  2249. * @param $table
  2250. * @param $column
  2251. *
  2252. * @return $form
  2253. */
  2254. function tripal_chado_semweb_reset_form($form, &$form_state, $table = NULL, $column = NULL) {
  2255. $term_name = array_key_exists('values', $form_state) ? $form_state['values']['term_name'] : '';
  2256. $form['chado_table'] = [
  2257. '#markup' => 'Are you sure you want to remove the use of this term? ',
  2258. ];
  2259. $form['table_name'] = [
  2260. '#type' => 'value',
  2261. '#value' => $table,
  2262. ];
  2263. $form['column'] = [
  2264. '#type' => 'value',
  2265. '#value' => $column,
  2266. ];
  2267. $form['submit_button'] = [
  2268. '#type' => 'submit',
  2269. '#value' => t('Reset'),
  2270. '#name' => 'reset_term',
  2271. ];
  2272. $form['cancel_button'] = [
  2273. '#type' => 'button',
  2274. '#value' => t('Cancel'),
  2275. '#name' => 'cancel_button',
  2276. '#limit_validation_errors' => [],
  2277. ];
  2278. return $form;
  2279. }
  2280. /**
  2281. * Implements hook_form_validate()
  2282. *
  2283. * Validate function for resetting the semantic web term
  2284. *
  2285. * @param unknown $form
  2286. * @param unknown $form_state
  2287. */
  2288. function tripal_chado_semweb_reset_form_validate($form, &$form_state) {
  2289. if (array_key_exists('clicked_button', $form_state)) {
  2290. if ($form_state['clicked_button']['#name'] == 'use_cvterm') {
  2291. $cvterm_id = NULL;
  2292. // Make sure we have a cvterm selected
  2293. $num_selected = 0;
  2294. foreach ($form_state['values'] as $key => $value) {
  2295. $matches = [];
  2296. if (preg_match("/^term-(\d+)$/", $key, $matches) and
  2297. $form_state['values']['term-' . $matches[1]]) {
  2298. $cvterm_id = $matches[1];
  2299. $num_selected++;
  2300. }
  2301. }
  2302. if ($num_selected == 0) {
  2303. form_set_error('', 'Please select at least one term.');
  2304. }
  2305. else {
  2306. if ($num_selected > 1) {
  2307. form_set_error('term-' . $cvterm_id, 'Please select only one term from the list below.');
  2308. }
  2309. else {
  2310. $form_state['values']['#selected_cvterm_id'] = $cvterm_id;
  2311. }
  2312. }
  2313. }
  2314. else {
  2315. if ($form_state['clicked_button']['#name'] == 'cancel_button') {
  2316. $table_name = $form_state['values']['table_name'];
  2317. drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
  2318. }
  2319. }
  2320. }
  2321. }
  2322. /**
  2323. * Implements hook_form_submit()
  2324. *
  2325. * Submit function for editing the semantic web term
  2326. *
  2327. * @param unknown $form
  2328. * @param unknown $form_state
  2329. */
  2330. function tripal_chado_semweb_reset_form_submit($form, &$form_state) {
  2331. if (array_key_exists('clicked_button', $form_state) && $form_state['clicked_button']['#name'] == 'reset_term') {
  2332. $table_name = $form_state['values']['table_name'];
  2333. $column = $form_state['values']['column'];
  2334. // Check if there is already a record
  2335. $record_id =
  2336. db_select('chado_semweb', 'cs')
  2337. ->fields('cs', ['chado_semweb_id'])
  2338. ->condition('chado_table', $table_name)
  2339. ->condition('chado_column', $column)
  2340. ->execute()
  2341. ->fetchField();
  2342. // If the record exists, reset it
  2343. if ($record_id) {
  2344. db_update('chado_semweb')
  2345. ->fields([
  2346. 'cvterm_id' => NULL,
  2347. ])
  2348. ->condition('chado_semweb_id', $record_id)
  2349. ->execute();
  2350. }
  2351. drupal_set_message('The term settings have been reset.');
  2352. drupal_goto('/admin/tripal/storage/chado/semweb/' . $table_name);
  2353. }
  2354. }
  2355. /**
  2356. *
  2357. */
  2358. function tripal_chado_semweb_form_ajax_callback($form, $form_state) {
  2359. return $form;
  2360. }