tripal_feature.DEPRECATED.inc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal feature 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 chado_get_property().
  10. *
  11. * @see chado_get_property().
  12. */
  13. function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
  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'=>'tripal_feature_analysis_get_property',
  20. '%new_function' => 'chado_get_property'
  21. )
  22. );
  23. // check that the incoming arguments are correct
  24. if (($analysis_id and !$feature_id) or
  25. (!$analysis_id and $feature_id)) {
  26. tripal_report_error('tripal_feature', TRIPAL_WARNING,
  27. 'tripal_feature_analysis_get_property: Both an analysis ID and feature ID should be specified',
  28. array());
  29. }
  30. // get the analysisfeature_id if one is not provided
  31. if (!$analysisfeature_id) {
  32. $columns = array('analysisfeature_id');
  33. $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
  34. $result = chado_select_record('analysisfeature', $columns, $values);
  35. $analysisfeature_id = $result[0]->analysisfeature_id;
  36. }
  37. $record = array(
  38. 'table' => 'analysisfeature',
  39. 'id' => $analysisfeature_id,
  40. );
  41. $property = array(
  42. 'type_name' => $property,
  43. 'cv_name' => $cv_name,
  44. );
  45. // get the property.
  46. return chado_get_property($record, $property);
  47. }
  48. /**
  49. * @deprecated Restructured API to make naming more readable and consistent.
  50. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  51. * This function has been replaced by chado_insert_property().
  52. *
  53. * @see chado_insert_property().
  54. */
  55. function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {
  56. tripal_report_error(
  57. 'tripal_deprecated',
  58. TRIPAL_NOTICE,
  59. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  60. array(
  61. '%old_function'=>'tripal_feature_analysis_insert_property',
  62. '%new_function' => 'chado_insert_property'
  63. )
  64. );
  65. // check that the incoming arguments are correct
  66. if (($analysis_id and !$feature_id) or
  67. (!$analysis_id and $feature_id)) {
  68. tripal_report_error('tripal_feature', TRIPAL_WARNING,
  69. 'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified',
  70. array());
  71. }
  72. // get the analysisfeature_id if one is not provided
  73. if (!$analysisfeature_id) {
  74. $columns = array('analysisfeature_id');
  75. $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
  76. $result = chado_select_record('analysisfeature', $columns, $values);
  77. $analysisfeature_id = $result[0]->analysisfeature_id;
  78. }
  79. $record = array(
  80. 'table' => 'analysisfeature',
  81. 'id' => $analysisfeature_id,
  82. );
  83. $property = array(
  84. 'type_name' => $property,
  85. 'cv_name' => $cv_name,
  86. 'value' => $value
  87. );
  88. $options = array(
  89. 'update_if_present' => $update_if_present,
  90. );
  91. // insert the property.
  92. return chado_insert_property($record, $property, $options);
  93. }
  94. /**
  95. * @deprecated Restructured API to make naming more readable and consistent.
  96. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  97. * This function has been replaced by chado_update_property().
  98. *
  99. * @see chado_update_property().
  100. */
  101. function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $insert_if_missing = 0, $cv_name = 'tripal') {
  102. tripal_report_error(
  103. 'tripal_deprecated',
  104. TRIPAL_NOTICE,
  105. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  106. array(
  107. '%old_function'=>'tripal_feature_analysis_update_property',
  108. '%new_function' => 'chado_update_property'
  109. )
  110. );
  111. // check that the incoming arguments are correct
  112. if (($analysis_id and !$feature_id) or
  113. (!$analysis_id and $feature_id)) {
  114. tripal_report_error('tripal_feature', TRIPAL_WARNING,
  115. 'tripal_feature_analysis_update_property: Both an analysis ID and feature ID should be specified',
  116. array());
  117. }
  118. // get the analysisfeature_id if one is not provided
  119. if (!$analysisfeature_id) {
  120. $columns = array('analysisfeature_id');
  121. $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
  122. $result = chado_select_record('analysisfeature', $columns, $values);
  123. $analysisfeature_id = $result[0]->analysisfeature_id;
  124. }
  125. $record = array(
  126. 'table' => 'analysisfeature',
  127. 'id' => $analysisfeature_id,
  128. );
  129. $property = array(
  130. 'type_name' => $property,
  131. 'cv_name' => $cv_name,
  132. 'value' => $value
  133. );
  134. $options = array(
  135. 'insert_if_missing' => $insert_if_missing,
  136. );
  137. // update the property.
  138. return chado_update_property($record, $property, $options);
  139. }
  140. /**
  141. * @deprecated Restructured API to make naming more readable and consistent.
  142. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  143. * This function has been replaced by chado_update_property().
  144. *
  145. * @see chado_update_property().
  146. */
  147. function tripal_feature_analysis_update_property_by_id($analysisfeatureprop_id, $property, $value, $cv_name = 'tripal') {
  148. tripal_report_error(
  149. 'tripal_deprecated',
  150. TRIPAL_NOTICE,
  151. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  152. array(
  153. '%old_function'=>'tripal_feature_analysis_update_property_by_id',
  154. '%new_function' => 'chado_update_property'
  155. )
  156. );
  157. $record = array(
  158. 'table' => 'analysisfeature',
  159. 'prop_id' => $analysisfeatureprop_id,
  160. );
  161. $property = array(
  162. 'type_name' => $property,
  163. 'cv_name' => $cv_name,
  164. 'value' => $value
  165. );
  166. // update the property.
  167. return chado_update_property($record, $property);
  168. }
  169. /**
  170. * @deprecated Restructured API to make naming more readable and consistent.
  171. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  172. * This function has been replaced by chado_delete_property().
  173. *
  174. * @see chado_delete_property().
  175. */
  176. function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $cv_name = 'tripal') {
  177. tripal_report_error(
  178. 'tripal_deprecated',
  179. TRIPAL_NOTICE,
  180. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  181. array(
  182. '%old_function'=>'tripal_feature_analysis_delete_property',
  183. '%new_function' => 'chado_delete_property'
  184. )
  185. );
  186. // check that the incoming arguments are correct
  187. if (($analysis_id and !$feature_id) or
  188. (!$analysis_id and $feature_id)) {
  189. tripal_report_error('tripal_feature', TRIPAL_WARNING,
  190. 'tripal_feature_analysis_delete_property: Both an analysis ID and feature ID should be specified',
  191. array());
  192. }
  193. // get the analysisfeature_id if one is not provided
  194. if (!$analysisfeature_id) {
  195. $columns = array('analysisfeature_id');
  196. $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
  197. $result = chado_select_record('analysisfeature', $columns, $values);
  198. $analysisfeature_id = $result[0]->analysisfeature_id;
  199. }
  200. $record = array(
  201. 'table' => 'analysisfeature',
  202. 'id' => $analysisfeature_id,
  203. );
  204. $property = array(
  205. 'type_name' => $property,
  206. 'cv_name' => $cv_name,
  207. );
  208. // get the property.
  209. return chado_delete_property($record, $property);
  210. }
  211. /**
  212. * @deprecated Restructured API to make naming more readable and consistent.
  213. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  214. * This function has been replaced by chado_delete_record().
  215. *
  216. * @see chado_delete_record().
  217. */
  218. function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id) {
  219. tripal_report_error(
  220. 'tripal_deprecated',
  221. TRIPAL_NOTICE,
  222. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  223. array(
  224. '%old_function'=>'tripal_feature_analysis_delete_property_by_id',
  225. '%new_function' => 'chado_delete_record'
  226. )
  227. );
  228. // construct the array that will match the exact record to update
  229. $match = array(
  230. 'analysisfeatureprop_id' => $analysisfeatureprop_id,
  231. );
  232. return chado_delete_record('analysisfeatureprop', $match);
  233. }
  234. /**
  235. * @deprecated Restructured API to make naming more readable and consistent.
  236. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  237. * This function has been replaced by chado_get_property().
  238. *
  239. * @see chado_get_property().
  240. */
  241. function tripal_feature_get_property($feature_id, $property, $cv_name='tripal') {
  242. tripal_report_error(
  243. 'tripal_deprecated',
  244. TRIPAL_NOTICE,
  245. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  246. array(
  247. '%old_function'=>'tripal_feature_get_property',
  248. '%new_function' => 'chado_get_property'
  249. )
  250. );
  251. $record = array(
  252. 'table' => 'feature',
  253. 'id' => $feature_id,
  254. );
  255. $property = array(
  256. 'type_name' => $property,
  257. 'cv_name' => $cv_name,
  258. );
  259. return chado_get_property($record, $property);
  260. }
  261. /**
  262. * @deprecated Restructured API to make naming more readable and consistent.
  263. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  264. * This function has been replaced by chado_insert_property().
  265. *
  266. * @see chado_insert_property().
  267. */
  268. function tripal_feature_insert_property($feature_id, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {
  269. tripal_report_error(
  270. 'tripal_deprecated',
  271. TRIPAL_NOTICE,
  272. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  273. array(
  274. '%old_function'=>'tripal_feature_insert_property',
  275. '%new_function' => 'chado_insert_property'
  276. )
  277. );
  278. $record = array(
  279. 'table' => 'feature',
  280. 'id' => $feature_id,
  281. );
  282. $property = array(
  283. 'type_name' => $property,
  284. 'cv_name' => $cv_name,
  285. 'value' => $value,
  286. );
  287. $options = array(
  288. 'update_if_present' => $update_if_present,
  289. );
  290. return chado_insert_property($record, $property, $options);
  291. }
  292. /**
  293. * @deprecated Restructured API to make naming more readable and consistent.
  294. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  295. * This function has been replaced by chado_update_property().
  296. *
  297. * @see chado_update_property().
  298. */
  299. function tripal_feature_update_property($feature_id, $property, $value, $insert_if_missing = 0, $cv_name = 'tripal') {
  300. tripal_report_error(
  301. 'tripal_deprecated',
  302. TRIPAL_NOTICE,
  303. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  304. array(
  305. '%old_function'=>'tripal_feature_update_property',
  306. '%new_function' => 'chado_update_property'
  307. )
  308. );
  309. $record = array(
  310. 'table' => 'feature',
  311. 'id' => $feature_id,
  312. );
  313. $property = array(
  314. 'type_name' => $property,
  315. 'cv_name' => $cv_name,
  316. 'value' => $value,
  317. );
  318. $options = array(
  319. 'insert_if_missing' => insert_if_missing,
  320. );
  321. return chado_update_property($record, $property, $options);
  322. }
  323. /**
  324. * @deprecated Restructured API to make naming more readable and consistent.
  325. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  326. * This function has been replaced by chado_update_property().
  327. *
  328. * @see chado_update_property().
  329. */
  330. function tripal_feature_update_property_by_id($featureprop_id, $property, $value, $cv_name = 'tripal') {
  331. tripal_report_error(
  332. 'tripal_deprecated',
  333. TRIPAL_NOTICE,
  334. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  335. array(
  336. '%old_function'=>'tripal_feature_update_property_by_id',
  337. '%new_function' => 'chado_update_property'
  338. )
  339. );
  340. $record = array(
  341. 'table' => 'feature',
  342. 'prop_id' => $featureprop_id,
  343. );
  344. $property = array(
  345. 'type_name' => $property,
  346. 'cv_name' => $cv_name,
  347. 'value' => $value,
  348. );
  349. return chado_update_property($record, $property);
  350. }
  351. /**
  352. * @deprecated Restructured API to make naming more readable and consistent.
  353. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  354. * This function has been replaced by chado_delete_property().
  355. *
  356. * @see chado_delete_property().
  357. */
  358. function tripal_feature_delete_property($feature_id, $property, $cv_name='tripal') {
  359. tripal_report_error(
  360. 'tripal_deprecated',
  361. TRIPAL_NOTICE,
  362. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  363. array(
  364. '%old_function'=>'tripal_feature_delete_property',
  365. '%new_function' => 'chado_delete_property'
  366. )
  367. );
  368. $record = array(
  369. 'table' => 'feature',
  370. 'id' => $feature_id,
  371. );
  372. $property = array(
  373. 'type_name' => $property,
  374. 'cv_name' => $cv_name,
  375. );
  376. return chado_delete_property($record, $property);
  377. }
  378. /**
  379. * @deprecated Restructured API to make naming more readable and consistent.
  380. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  381. * This function has been replaced by chado_delete_record().
  382. *
  383. * @see chado_delete_record().
  384. */
  385. function tripal_feature_delete_property_by_id($featureprop_id) {
  386. tripal_report_error(
  387. 'tripal_deprecated',
  388. TRIPAL_NOTICE,
  389. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  390. array(
  391. '%old_function'=>'tripal_feature_delete_property_by_id',
  392. '%new_function' => 'chado_delete_record'
  393. )
  394. );
  395. // construct the array that will match the exact record to update
  396. $match = array(
  397. 'featureprop_id' => $featureprop_id,
  398. );
  399. return chado_delete_record('featureprop', $match);
  400. }
  401. /**
  402. * @deprecated Restructured API to make naming more readable and consistent.
  403. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  404. * This function has been replaced by tripal_reverse_compliment_sequence().
  405. *
  406. * @see tripal_reverse_compliment_sequence().
  407. */
  408. function tripal_feature_reverse_complement($sequence) {
  409. tripal_report_error(
  410. 'tripal_deprecated',
  411. TRIPAL_NOTICE,
  412. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  413. array(
  414. '%old_function'=>'tripal_feature_reverse_complement',
  415. '%new_function' => 'tripal_reverse_compliment_sequence'
  416. )
  417. );
  418. return tripal_reverse_compliment_sequence($sequence);
  419. }
  420. /**
  421. * @deprecated Restructured API to make naming more readable and consistent.
  422. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  423. * This function has been replaced by tripal_associate_dbxref().
  424. *
  425. * @see tripal_associate_dbxref().
  426. */
  427. function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
  428. tripal_report_error(
  429. 'tripal_deprecated',
  430. TRIPAL_NOTICE,
  431. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  432. array(
  433. '%old_function'=>'tripal_feature_add_dbxref',
  434. '%new_function' => 'tripal_associate_dbxref'
  435. )
  436. );
  437. return tripal_associate_dbxref(
  438. 'feature',
  439. $feature_id,
  440. array(
  441. 'accession' => $accession,
  442. 'db_name' => $dbname
  443. )
  444. );
  445. }
  446. /**
  447. * @deprecated Restructured API to make naming more readable and consistent.
  448. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
  449. * This function has been replaced by tripal_associate_cvterm().
  450. *
  451. * @see tripal_associate_cvterm().
  452. */
  453. function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
  454. tripal_report_error(
  455. 'tripal_deprecated',
  456. TRIPAL_NOTICE,
  457. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  458. array(
  459. '%old_function'=>'tripal_feature_add_cvterm',
  460. '%new_function' => 'tripal_associate_cvterm'
  461. )
  462. );
  463. return tripal_associate_cvterm(
  464. 'feature',
  465. $feature_id,
  466. array(
  467. 'name' => $cvterm,
  468. 'cv_name' => $cvname
  469. )
  470. );
  471. }