tripal_feature.DEPRECATED.inc

  1. 2.x tripal_feature/api/tripal_feature.DEPRECATED.inc
  2. 3.x legacy/tripal_feature/api/tripal_feature.DEPRECATED.inc

Wrapper functions to provide backwards compatibility for the tripal feature api

File

tripal_feature/api/tripal_feature.DEPRECATED.inc
View source
  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. }