tripal_pub.DEPRECATED.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal analysis api
  5. */
  6. /**
  7. * @deprecated Restructured API to make naming more readable and consistent.
  8. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  9. * This function has been replaced by tripal_search_publications().
  10. *
  11. * @see tripal_search_publications().
  12. */
  13. function pub_search($search_array, $offset, $limit, &$total_records) {
  14. tripal_report_error(
  15. 'tripal_deprecated',
  16. TRIPAL_NOTICE,
  17. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  18. array(
  19. '%old_function'=>'pub_search',
  20. '%new_function' => 'tripal_search_pubs'
  21. )
  22. );
  23. return tripal_search_publications($search_array, $offset, $limit, $total_records);
  24. }
  25. /**
  26. * @deprecated Restructured API to make naming more readable and consistent.
  27. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  28. * This function has been replaced by tripal_publication_exists().
  29. *
  30. * @see tripal_publication_exists().
  31. */
  32. function chado_does_pub_exist($pub_details) {
  33. tripal_report_error(
  34. 'tripal_deprecated',
  35. TRIPAL_NOTICE,
  36. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  37. array(
  38. '%old_function'=>'chado_does_pub_exist',
  39. '%new_function' => 'tripal_publication_exists'
  40. )
  41. );
  42. return tripal_publication_exists($pub_details);
  43. }
  44. /**
  45. * @deprecated Restructured API to make naming more readable and consistent.
  46. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  47. * This function has been replaced by tripal_get_remote_pubs().
  48. *
  49. * @see tripal_get_remote_pubs().
  50. */
  51. function tripal_pub_get_remote_search_results($remote_db, $search_array, $num_to_retrieve, $page = 0) {
  52. tripal_report_error(
  53. 'tripal_deprecated',
  54. TRIPAL_NOTICE,
  55. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  56. array(
  57. '%old_function'=>'tripal_pub_get_remote_search_results',
  58. '%new_function' => 'tripal_get_remote_pubs'
  59. )
  60. );
  61. return tripal_get_remote_pubs($remote_db, $search_array, $num_to_retrieve, $page);;
  62. }
  63. /**
  64. * @deprecated Restructured API to make naming more readable and consistent.
  65. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  66. * This function has been replaced by chado_get_remote_pub_record().
  67. *
  68. * @see chado_get_remote_pub_record().
  69. */
  70. function tripal_pub_get_raw_data($dbxref) {
  71. tripal_report_error(
  72. 'tripal_deprecated',
  73. TRIPAL_NOTICE,
  74. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  75. array(
  76. '%old_function'=>'tripal_pub_get_raw_data',
  77. '%new_function' => 'chado_get_remote_pub_record'
  78. )
  79. );
  80. return tripal_get_remote_pub($dbxref);
  81. }
  82. /**
  83. * @deprecated Restructured API to make naming more readable and consistent.
  84. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  85. * This function has been replaced by chado_update_multiple_publications().
  86. *
  87. * @see chado_update_multiple_publications().
  88. */
  89. function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db = NULL) {
  90. tripal_report_error(
  91. 'tripal_deprecated',
  92. TRIPAL_NOTICE,
  93. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  94. array(
  95. '%old_function'=>'tripal_pub_update_publications',
  96. '%new_function' => 'chado_reimport_publications'
  97. )
  98. );
  99. return chado_reimport_publications($do_contact, $dbxref, $db);
  100. }
  101. /**
  102. * @deprecated Restructured API to make naming more readable and consistent.
  103. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  104. * This function has been replaced by chado_import_multiple_publications().
  105. *
  106. * @see chado_import_multiple_publications().
  107. */
  108. function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL) {
  109. tripal_report_error(
  110. 'tripal_deprecated',
  111. TRIPAL_NOTICE,
  112. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  113. array(
  114. '%old_function'=>'tripal_pub_import_publications_by_import_id',
  115. '%new_function' => 'chado_execute_pub_importer'
  116. )
  117. );
  118. return chado_execute_pub_importer($import_id, TRUE, FALSE, $job_id);
  119. }
  120. /**
  121. * @deprecated Restructured API to make naming more readable and consistent.
  122. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  123. * This function has been replaced by chado_import_multiple_publications().
  124. *
  125. * @see chado_import_multiple_publications().
  126. */
  127. function tripal_pub_import_publications($report_email = FALSE, $do_update = FALSE) {
  128. tripal_report_error(
  129. 'tripal_deprecated',
  130. TRIPAL_NOTICE,
  131. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  132. array(
  133. '%old_function'=>'tripal_pub_import_publications',
  134. '%new_function' => 'tripal_execute_active_pub_importers'
  135. )
  136. );
  137. return tripal_execute_active_pub_importers($report_email, $do_update);
  138. }
  139. /**
  140. * @deprecated Restructured API to make naming more readable and consistent.
  141. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  142. * This function has been replaced by chado_import_multiple_publications().
  143. *
  144. * @see chado_import_multiple_publications().
  145. */
  146. function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_update) {
  147. tripal_report_error(
  148. 'tripal_deprecated',
  149. TRIPAL_NOTICE,
  150. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  151. array(
  152. '%old_function'=>'tripal_pub_import_by_dbxref',
  153. '%new_function' => 'chado_import_multiple_publications'
  154. )
  155. );
  156. return tripal_import_pub_by_dbxref($pub_dbxref, $do_contact, $do_udpate);
  157. }
  158. /**
  159. * @deprecated Restructured API to make naming more readable and consistent.
  160. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  161. * This function has been replaced by tripal_associate_dbxref().
  162. *
  163. * @see tripal_associate_dbxref().
  164. */
  165. function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
  166. tripal_report_error(
  167. 'tripal_deprecated',
  168. TRIPAL_NOTICE,
  169. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  170. array(
  171. '%old_function'=>'tripal_pub_add_pub_dbxref',
  172. '%new_function' => 'tripal_associate_dbxref'
  173. )
  174. );
  175. $dbxref = array();
  176. if(preg_match('/^(.*?):(.*?)$/', trim($pub_dbxref), $matches)) {
  177. $dbxref['db_name'] = $matches[1];
  178. $dbxref['accession'] = $matches[2];
  179. }
  180. return tripal_associate_dbxref('pub', $pub_id, $dbxref);
  181. }
  182. /**
  183. * @deprecated Restructured API to make naming more readable and consistent.
  184. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  185. * This function has been replaced by chado_get_publication().
  186. *
  187. * @see chado_get_publication().
  188. */
  189. function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
  190. tripal_report_error(
  191. 'tripal_deprecated',
  192. TRIPAL_NOTICE,
  193. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  194. array(
  195. '%old_function'=>'tripal_pub_get_pubs_by_dbxref',
  196. '%new_function' => 'chado_get_publication'
  197. )
  198. );
  199. $pub = chado_get_publication(array('dbxref' => $pub_dbxref));
  200. if ($pub) {
  201. // the original function returned an array of pub_ids
  202. return array($pub->pub_id);
  203. }
  204. else {
  205. return array();
  206. }
  207. }
  208. /**
  209. * @deprecated Restructured API to make naming more readable and consistent.
  210. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  211. * This function has been replaced by chado_get_publication().
  212. *
  213. * @see chado_get_publication().
  214. */
  215. function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) {
  216. tripal_report_error(
  217. 'tripal_deprecated',
  218. TRIPAL_NOTICE,
  219. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  220. array(
  221. '%old_function'=>'tripal_pub_get_pubs_by_title_type_pyear_series',
  222. '%new_function' => 'chado_get_publication'
  223. )
  224. );
  225. $pub_details = array(
  226. 'Title' => $title,
  227. 'Year' => $pyear,
  228. 'Series Name' => $series_name,
  229. 'Publication Type' => $type,
  230. );
  231. return chado_does_pub_exist($pub_details);
  232. }
  233. /**
  234. * @deprecated Restructured API to make naming more readable and consistent.
  235. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  236. * This function has been replaced by chado_get_publication().
  237. *
  238. * @see chado_get_publication().
  239. */
  240. function tripal_pub_get_pub_by_uniquename($uniquenname) {
  241. tripal_report_error(
  242. 'tripal_deprecated',
  243. TRIPAL_NOTICE,
  244. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  245. array(
  246. '%old_function'=>'tripal_pub_get_pub_by_uniquename',
  247. '%new_function' => 'chado_get_publication'
  248. )
  249. );
  250. $pub = chado_get_publication(array('uniquename' => $uniquenname));
  251. if ($pub) {
  252. // the original version of this function returned an array of matching pub_ids
  253. return array($pub->pub_id);
  254. }
  255. return array();
  256. }
  257. /**
  258. * @deprecated Restructured API to make naming more readable and consistent.
  259. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  260. * This function has been replaced by chado_get_property().
  261. *
  262. * @see chado_get_property().
  263. */
  264. function tripal_pub_get_property($pub_id, $property) {
  265. tripal_report_error(
  266. 'tripal_deprecated',
  267. TRIPAL_NOTICE,
  268. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  269. array(
  270. '%old_function'=>'tripal_pub_get_property',
  271. '%new_function' => 'chado_get_property'
  272. )
  273. );
  274. $record = array(
  275. 'table' => 'pub',
  276. 'id' => $pub_id,
  277. );
  278. $property = array(
  279. 'type_name' => $property,
  280. 'cv_name' => 'tripal_pub',
  281. );
  282. return chado_get_property($record, $property);
  283. }
  284. /**
  285. * @deprecated Restructured API to make naming more readable and consistent.
  286. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  287. * This function has been replaced by chado_insert_property().
  288. *
  289. * @see chado_insert_property().
  290. */
  291. function tripal_pub_insert_property($pub_id, $property, $value, $update_if_present = 0) {
  292. tripal_report_error(
  293. 'tripal_deprecated',
  294. TRIPAL_NOTICE,
  295. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  296. array(
  297. '%old_function'=>'tripal_pub_insert_property',
  298. '%new_function' => 'chado_insert_property'
  299. )
  300. );
  301. $record = array(
  302. 'table' => 'pub',
  303. 'id' => $pub_id,
  304. );
  305. $property = array(
  306. 'type_name' => $property,
  307. 'cv_name' => 'tripal_pub',
  308. 'value' => $value,
  309. );
  310. $options = array(
  311. 'insert_if_missing' => $insert_if_missing,
  312. );
  313. return chado_insert_property($record, $property, $options);
  314. }
  315. /**
  316. * @deprecated Restructured API to make naming more readable and consistent.
  317. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  318. * This function has been replaced by chado_update_property().
  319. *
  320. * @see chado_update_property().
  321. */
  322. function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missing = 0) {
  323. tripal_report_error(
  324. 'tripal_deprecated',
  325. TRIPAL_NOTICE,
  326. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  327. array(
  328. '%old_function'=>'tripal_pub_update_property',
  329. '%new_function' => 'chado_update_property'
  330. )
  331. );
  332. $record = array(
  333. 'table' => 'pub',
  334. 'id' => $pub_id,
  335. );
  336. $property = array(
  337. 'type_name' => $property,
  338. 'cv_name' => 'tripal_pub',
  339. 'value' => $value,
  340. );
  341. $options = array(
  342. 'update_if_present' => $update_if_present,
  343. );
  344. return chado_update_property($record, $property, $options);
  345. }
  346. /**
  347. * @deprecated Restructured API to make naming more readable and consistent.
  348. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  349. * This function has been replaced by chado_delete_property().
  350. *
  351. * @see chado_delete_property().
  352. */
  353. function tripal_pub_delete_property($pub_id, $property) {
  354. tripal_report_error(
  355. 'tripal_deprecated',
  356. TRIPAL_NOTICE,
  357. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  358. array(
  359. '%old_function'=>'tripal_pub_delete_property',
  360. '%new_function' => 'chado_delete_property'
  361. )
  362. );
  363. $record = array(
  364. 'table' => 'pub',
  365. 'id' => $pub_id,
  366. );
  367. $property = array(
  368. 'type_name' => $property,
  369. 'cv_name' => 'tripal_pub',
  370. );
  371. return chado_delete_property($record, $property);
  372. }