tripal_feature.DEPRECATED.inc 16 KB

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