tripal_feature.module 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <?php
  2. /**
  3. * @file
  4. * Basic functionality for the tripal module
  5. */
  6. /**
  7. * @defgroup tripal_feature Feature Module
  8. * @ingroup tripal_modules
  9. * @{
  10. * Integrates the Chado Sequence module with Drupal Nodes & Views
  11. * @}
  12. */
  13. require_once 'api/tripal_feature.api.inc';
  14. require_once 'api/tripal_feature.schema.api.inc';
  15. require_once 'api/tripal_feature.DEPRECATED.inc';
  16. require_once 'theme/tripal_feature.theme.inc';
  17. require_once 'includes/tripal_feature.admin.inc';
  18. require_once 'includes/tripal_feature.fasta_loader.inc';
  19. require_once 'includes/tripal_feature.gff_loader.inc';
  20. require_once 'includes/tripal_feature.seq_extract.inc';
  21. require_once 'includes/tripal_feature.delete.inc';
  22. require_once 'includes/tripal_feature.chado_node.inc';
  23. /**
  24. * Implements hook_views_api().
  25. *
  26. * Essentially this hook tells drupal that there is views support for
  27. * for this module which then includes tripal_db.views.inc where all the
  28. * views integration code is
  29. *
  30. * @ingroup tripal_feature
  31. */
  32. function tripal_feature_views_api() {
  33. return array(
  34. 'api' => 3.0,
  35. );
  36. }
  37. /**
  38. * Implements hook_help().
  39. *
  40. * Display help and module information
  41. *
  42. * @param
  43. * path which path of the site we're displaying help
  44. * @param
  45. * arg array that holds the current path as would be returned from arg() function
  46. *
  47. * @return
  48. * help text for the path
  49. *
  50. * @ingroup tripal_feature
  51. */
  52. function tripal_feature_help($path, $arg) {
  53. $output = '';
  54. switch ($path) {
  55. case "admin/help#tripal_feature":
  56. $output='<p>' . t("Displays links to nodes created on this date") . '</p>';
  57. break;
  58. }
  59. return $output;
  60. }
  61. /**
  62. * Implements hook_permission().
  63. *
  64. * Set the permission types that the chado module uses. Essentially we
  65. * want permissionis that protect creation, editing and deleting of chado
  66. * data objects
  67. *
  68. * @ingroup tripal_feature
  69. */
  70. function tripal_feature_permission() {
  71. return array(
  72. 'access chado_feature content' => array(
  73. 'title' => t('View Features'),
  74. 'description' => t('Allow users to view feature pages.'),
  75. ),
  76. 'create chado_feature content' => array(
  77. 'title' => t('Create Features'),
  78. 'description' => t('Allow users to create new feature pages.'),
  79. ),
  80. 'delete chado_feature content' => array(
  81. 'title' => t('Delete Features'),
  82. 'description' => t('Allow users to delete feature pages.'),
  83. ),
  84. 'edit chado_feature content' => array(
  85. 'title' => t('Edit Features'),
  86. 'description' => t('Allow users to edit feature pages.'),
  87. ),
  88. 'administer tripal feature' => array(
  89. 'title' => t('Administer Features'),
  90. 'description' => t('Allow users to administer all features.'),
  91. ),
  92. );
  93. }
  94. /**
  95. * Implements hook_menu().
  96. *
  97. * Menu items are automatically added for the new node types created
  98. * by this module to the 'Create Content' Navigation menu item. This function
  99. * adds more menu items needed for this module.
  100. *
  101. * @ingroup tripal_feature
  102. */
  103. function tripal_feature_menu() {
  104. $items = array();
  105. // the administative settings menu
  106. $items['find/sequences'] = array(
  107. 'title' => 'Sequence Retrieval',
  108. 'description' => 'Download a file of sequences',
  109. 'page callback' => 'tripal_feature_seq_extract_page',
  110. 'access arguments' => array('access chado_feature content'),
  111. 'type' => MENU_CALLBACK,
  112. );
  113. $items['find/sequences/ajax'] = array(
  114. 'title' => 'Sequence Retrieval',
  115. 'page callback' => 'tripal_feature_seq_extract_form_ahah_update',
  116. 'access arguments' => array('access chado_feature content'),
  117. 'type' => MENU_CALLBACK,
  118. );
  119. // the menu link for addressing any feature (by name, uniquename, synonym)
  120. $items['feature/%'] = array(
  121. 'page callback' => 'tripal_feature_match_features_page',
  122. 'page arguments' => array(1),
  123. 'access arguments' => array('access chado_feature content'),
  124. 'type' => MENU_LOCAL_TASK,
  125. );
  126. // the administative settings menu
  127. $items['admin/tripal/chado/tripal_feature'] = array(
  128. 'title' => 'Features',
  129. 'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
  130. 'page callback' => 'tripal_feature_admin_feature_view',
  131. 'access arguments' => array('administer tripal feature'),
  132. 'type' => MENU_NORMAL_ITEM,
  133. );
  134. $items['admin/tripal/chado/tripal_feature/delete'] = array(
  135. 'title' => ' Delete',
  136. 'description' => 'Delete multiple features from Chado',
  137. 'page callback' => 'drupal_get_form',
  138. 'page arguments' => array('tripal_feature_delete_form'),
  139. 'access arguments' => array('administer tripal feature'),
  140. 'type' => MENU_LOCAL_TASK,
  141. 'weight' => 2
  142. );
  143. $items['admin/tripal/chado/tripal_feature/sync'] = array(
  144. 'title' => ' Sync',
  145. 'description' => 'Create pages on this site for features stored in Chado',
  146. 'page callback' => 'drupal_get_form',
  147. 'page arguments' => array('chado_node_sync_form', 'tripal_feature', 'chado_feature'),
  148. 'access arguments' => array('administer tripal feature'),
  149. 'type' => MENU_LOCAL_TASK,
  150. 'weight' => 1
  151. );
  152. $items['admin/tripal/chado/tripal_feature/chado_feature_toc'] = array(
  153. 'title' => ' TOC',
  154. 'description' => 'Manage the table of contents for feature nodes.',
  155. 'page callback' => 'drupal_get_form',
  156. 'page arguments' => array('tripal_core_content_type_toc_form', 'chado_feature'),
  157. 'access arguments' => array('administer tripal feature'),
  158. 'type' => MENU_LOCAL_TASK,
  159. 'file' => 'includes/tripal_core.toc.inc',
  160. 'file path' => drupal_get_path('module', 'tripal_core'),
  161. 'weight' => 3
  162. );
  163. $items['admin/tripal/chado/tripal_feature/configuration'] = array(
  164. 'title' => 'Settings',
  165. 'description' => 'Configure the Tripal Feature module.',
  166. 'page callback' => 'drupal_get_form',
  167. 'page arguments' => array('tripal_feature_admin'),
  168. 'access arguments' => array('administer tripal feature'),
  169. 'type' => MENU_LOCAL_TASK,
  170. 'weight' => 5
  171. );
  172. $items['admin/tripal/chado/tripal_feature/help'] = array(
  173. 'title' => 'Help',
  174. 'description' => 'Help with the Tripal Feature module.',
  175. 'page callback' => 'theme',
  176. 'page arguments' => array('tripal_feature_help'),
  177. 'access arguments' => array('administer tripal feature'),
  178. 'type' => MENU_LOCAL_TASK,
  179. 'weight' => 10
  180. );
  181. /** Loaders */
  182. $items['admin/tripal/loaders/fasta_loader'] = array(
  183. 'title' => 'FASTA file Loader',
  184. 'description' => 'Load sequences from a multi-FASTA file into Chado',
  185. 'page callback' => 'drupal_get_form',
  186. 'page arguments' => array('tripal_feature_fasta_load_form'),
  187. 'access arguments' => array('administer tripal feature'),
  188. 'type' => MENU_NORMAL_ITEM,
  189. );
  190. $items['admin/tripal/loaders/gff3_load'] = array(
  191. 'title' => 'GFF3 file Loader',
  192. 'description' => 'Import a GFF3 file into Chado',
  193. 'page callback' => 'drupal_get_form',
  194. 'page arguments' => array('tripal_feature_gff3_load_form'),
  195. 'access arguments' => array('administer tripal feature'),
  196. 'type' => MENU_NORMAL_ITEM,
  197. );
  198. // Enable admin view
  199. $items['admin/tripal/chado/tripal_feature/views/features/enable'] = array(
  200. 'title' => 'Enable feature Administrative View',
  201. 'page callback' => 'tripal_enable_view',
  202. 'page arguments' => array('tripal_feature_admin_features', 'admin/tripal/chado/tripal_feature'),
  203. 'access arguments' => array('administer tripal feature'),
  204. 'type' => MENU_CALLBACK,
  205. );
  206. return $items;
  207. }
  208. /**
  209. * Implements hook_search_biological_data_views().
  210. *
  211. * Adds the described views to the "Search Data" Page created by Tripal Views
  212. */
  213. function tripal_feature_search_biological_data_views() {
  214. return array(
  215. 'tripal_feature_user_features' => array(
  216. 'machine_name' => 'tripal_feature_user_features',
  217. 'human_name' => 'Features',
  218. 'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
  219. 'link' => 'chado/feature'
  220. ),
  221. );
  222. }
  223. /**
  224. * Implements hook_theme().
  225. *
  226. * We need to let drupal know about our theme functions and their arguments.
  227. * We create theme functions to allow users of the module to customize the
  228. * look and feel of the output generated in this module
  229. *
  230. * @ingroup tripal_feature
  231. */
  232. function tripal_feature_theme($existing, $type, $theme, $path) {
  233. $core_path = drupal_get_path('module', 'tripal_core');
  234. $items = array(
  235. 'node__chado_feature' => array(
  236. 'template' => 'node--chado-generic',
  237. 'render element' => 'node',
  238. 'base hook' => 'node',
  239. 'path' => "$core_path/theme/templates",
  240. ),
  241. 'tripal_feature_alignments' => array(
  242. 'variables' => array('node' => NULL),
  243. 'template' => 'tripal_feature_alignments',
  244. 'path' => "$path/theme/templates",
  245. ),
  246. 'tripal_feature_analyses' => array(
  247. 'variables' => array('node' => NULL),
  248. 'template' => 'tripal_feature_analyses',
  249. 'path' => "$path/theme/templates",
  250. ),
  251. 'tripal_feature_base' => array(
  252. 'variables' => array('node' => NULL),
  253. 'template' => 'tripal_feature_base',
  254. 'path' => "$path/theme/templates",
  255. ),
  256. 'tripal_feature_sequence' => array(
  257. 'variables' => array('node' => NULL),
  258. 'template' => 'tripal_feature_sequence',
  259. 'path' => "$path/theme/templates",
  260. ),
  261. 'tripal_feature_proteins' => array(
  262. 'variables' => array('node' => NULL),
  263. 'template' => 'tripal_feature_proteins',
  264. 'path' => "$path/theme/templates",
  265. ),
  266. 'tripal_feature_publications' => array(
  267. 'variables' => array('node' => NULL),
  268. 'template' => 'tripal_feature_publications',
  269. 'path' => "$path/theme/templates",
  270. ),
  271. 'tripal_feature_synonyms' => array(
  272. 'variables' => array('node' => NULL),
  273. 'template' => 'tripal_feature_synonyms',
  274. 'path' => "$path/theme/templates",
  275. ),
  276. 'tripal_feature_references' => array(
  277. 'variables' => array('node' => NULL),
  278. 'template' => 'tripal_feature_references',
  279. 'path' => "$path/theme/templates",
  280. ),
  281. 'tripal_feature_properties' => array(
  282. 'variables' => array('node' => NULL),
  283. 'template' => 'tripal_feature_properties',
  284. 'path' => "$path/theme/templates",
  285. ),
  286. 'tripal_feature_terms' => array(
  287. 'variables' => array('node' => NULL),
  288. 'template' => 'tripal_feature_terms',
  289. 'path' => "$path/theme/templates",
  290. ),
  291. 'tripal_feature_relationships' => array(
  292. 'variables' => array('node' => NULL),
  293. 'template' => 'tripal_feature_relationships',
  294. 'path' => "$path/theme/templates",
  295. ),
  296. // help template
  297. 'tripal_feature_help' => array(
  298. 'template' => 'tripal_feature_help',
  299. 'variables' => array(NULL),
  300. 'path' => "$path/theme/templates"
  301. ),
  302. // template for the organism page
  303. 'tripal_organism_feature_browser' => array(
  304. 'variables' => array('node' => NULL),
  305. 'template' => 'tripal_organism_feature_browser',
  306. 'path' => "$path/theme/templates",
  307. ),
  308. 'tripal_organism_feature_counts' => array(
  309. 'variables' => array('node' => NULL),
  310. 'template' => 'tripal_organism_feature_counts',
  311. 'path' => "$path/theme/templates",
  312. ),
  313. // themed forms
  314. 'tripal_feature_seq_extract_form' => array(
  315. 'arguments' => array('form'),
  316. ),
  317. // themed teaser
  318. 'tripal_feature_teaser' => array(
  319. 'variables' => array('node' => NULL),
  320. 'template' => 'tripal_feature_teaser',
  321. 'path' => "$path/theme/templates",
  322. ),
  323. );
  324. return $items;
  325. }
  326. /**
  327. * The CV module will create the JSON array necessary for buillding a
  328. * pie chart using jgChart and Google Charts. We have to pass to it
  329. * a table that contains count information, tell it which column
  330. * contains the cvterm_id and provide a filter for getting the
  331. * results we want from the table.
  332. *
  333. * @ingroup tripal_feature
  334. */
  335. function tripal_feature_cv_chart($chart_id) {
  336. // we only want the chart to show feature types setup by the admin
  337. $temp = rtrim(variable_get('tripal_feature_summary_report_mapping', ''));
  338. $where = '';
  339. if ($temp) {
  340. $temp = explode("\n", $temp);
  341. foreach ($temp as $key => $value) {
  342. $temp2 = explode("=", $value);
  343. $feature_type = rtrim($temp2[0]);
  344. $where .= "CNT.feature_type = '$feature_type' OR \n";
  345. }
  346. if ($where) {
  347. $where = drupal_substr($where, 0, -5); # remove OR from the end
  348. $where = "($where) AND";
  349. }
  350. }
  351. $organism_id = preg_replace("/^tripal_feature_cv_chart_(\d+)$/", "$1", $chart_id);
  352. $options = array(
  353. count_mview => 'organism_feature_count',
  354. cvterm_id_column => 'cvterm_id',
  355. count_column => 'num_features',
  356. size => '550x200',
  357. filter => "$where CNT.organism_id = $organism_id",
  358. );
  359. return $options;
  360. }
  361. /**
  362. * The CV module will create the JSON array necessary for buillding a
  363. * pie chart using jgChart and Google Charts. We have to pass to it
  364. * a table that contains count information, tell it which column
  365. * contains the cvterm_id and provide a filter for getting the
  366. * results we want from the table.
  367. *
  368. * @ingroup tripal_feature
  369. */
  370. function tripal_feature_cv_tree($tree_id) {
  371. $organism_id = preg_replace("/^tripal_feature_cv_tree_(\d+)$/", "$1", $tree_id);
  372. $options = array(
  373. cv_id => tripal_get_cv(array('name' => 'sequence')),
  374. count_mview => 'organism_feature_count',
  375. cvterm_id_column => 'cvterm_id',
  376. count_column => 'num_features',
  377. filter => "CNT.organism_id = $organism_id",
  378. label => 'Features',
  379. );
  380. return $options;
  381. }
  382. /**
  383. * Implements hook_job_describe_args() in order to describe the various feature jobs
  384. * to the tripal jobs interface.
  385. *
  386. * @ingroup tripal_feature
  387. */
  388. function tripal_feature_job_describe_args($callback, $args) {
  389. $new_args = array();
  390. if ($callback == 'tripal_feature_load_fasta') {
  391. $new_args['FASTA file'] = $args[0];
  392. $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
  393. $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
  394. $new_args['Sequence Type'] = $args[2];
  395. $new_args['Name Match Type'] = $args[14];
  396. $new_args['Name RE'] = $args[4];
  397. $new_args['Unique Name RE'] = $args[5];
  398. // add in the relationship arguments
  399. $new_args['Relationship Type'] = $args[8];
  400. $new_args['Relationship Parent RE'] = $args[9];
  401. $new_args['Relationship Parent Type'] = $args[10];
  402. // add in the database reference arguments
  403. if ($args[7]) {
  404. $db = chado_select_record('db', array('name'), array('db_id' => $args[7]));
  405. }
  406. $new_args['Database Reference'] = $db[0]->name;
  407. $new_args['Accession RE'] = $args[6];
  408. $new_args['Method'] = $args[11];
  409. // add in the analysis
  410. if ($args[13]) {
  411. $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[13]));
  412. }
  413. $new_args['Analysis'] = $analysis[0]->name;
  414. }
  415. if ($callback == 'tripal_feature_delete_features') {
  416. if ($args[0]) {
  417. $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[0]));
  418. $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
  419. }
  420. else {
  421. $new_args['Organism'] = '';
  422. }
  423. if ($args[1]) {
  424. $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[1]));
  425. $new_args['Analysis'] = $analysis[0]->name;
  426. }
  427. else {
  428. $new_args['Analysis'] = '';
  429. }
  430. $new_args['Sequence Type'] = $args[2];
  431. $new_args['Is Unique Name'] = $args[3];
  432. $new_args['Features Names'] = $args[4];
  433. }
  434. elseif ($callback == 'tripal_feature_load_gff3') {
  435. $new_args['GFF File'] = $args[0];
  436. $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
  437. $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
  438. $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[2]));
  439. $new_args['Analysis'] = $analysis[0]->name;
  440. $new_args['Use a Transaction'] = ($args[7] == 1) ? "Yes" : "No";
  441. $new_args['Import only new features'] = ($args[3] == 1) ? "Yes" : "No";
  442. $new_args['Import all and update'] = ($args[4] == 1) ? "Yes" : "No";
  443. $new_args['Import all and replace'] = ($args[5] == 1) ? "Yes" : "No";
  444. $new_args['Delete features'] = ($args[6] == 1) ? "Yes" : "No";
  445. if ($args[8]) {
  446. $target_organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[8]));
  447. $new_args['Target organism'] = $target_organism[0]->genus . " " . $target_organism[0]->species;
  448. }
  449. else {
  450. $new_args['Target organism'] = '';
  451. }
  452. $new_args['Target type'] = $args[9];
  453. $new_args['Create target'] = ($args[10] == 1) ? "Yes" : "No";
  454. $new_args['Starting line'] = $args[11];
  455. $new_args['Landmark Type'] = $args[12];
  456. $new_args['Alternate ID attribute'] = $args[13];
  457. $new_args['Create Organism'] = ($args[14] == 1) ? "Yes" : "No";
  458. }
  459. return $new_args;
  460. }
  461. /**
  462. * Implements hook_coder_ignore().
  463. *
  464. * Defines the path to the file (tripal_core.coder_ignores.txt) where ignore rules for
  465. * coder are stored
  466. *
  467. * @ingroup tripal_feature
  468. */
  469. function tripal_feature_coder_ignore() {
  470. return array(
  471. 'path' => drupal_get_path('module', 'tripal_feature'),
  472. 'line prefix' => drupal_get_path('module', 'tripal_feature'),
  473. );
  474. }
  475. /*
  476. * Uses the value provided in the $id argument to find all features that match
  477. * that ID by name, featurename or synonym. If it matches uniquenly to a single
  478. * feature it will redirect to that feature page, otherwise, a list of matching
  479. * features is shown.
  480. *
  481. * @ingroup tripal_feature
  482. */
  483. function tripal_feature_match_features_page($id) {
  484. // first check to see if the URL (e.g. /feature/$id) is already
  485. // assigned to a node. If so, then just go there. Otherwise,
  486. // try to find the feature.
  487. $sql = "
  488. SELECT source
  489. FROM {url_alias}
  490. WHERE alias = :alias
  491. ";
  492. $match = db_query($sql, array(':alias' => "feature/$id"))->fetchObject();
  493. if ($match) {
  494. drupal_goto($match->source);
  495. return;
  496. }
  497. $sql = "
  498. SELECT
  499. F.name, F.uniquename, F.feature_id,
  500. O.genus, O.species, O.organism_id,
  501. CVT.cvterm_id, CVT.name as type_name,
  502. CF.nid,
  503. array_agg(S.name) as synonyms
  504. FROM {feature} F
  505. INNER JOIN {organism} O on F.organism_id = O.organism_id
  506. INNER JOIN {cvterm} CVT on CVT.cvterm_id = F.type_id
  507. LEFT JOIN {feature_synonym} FS on FS.feature_id = F.feature_id
  508. LEFT JOIN {synonym} S on S.synonym_id = FS.synonym_id
  509. INNER JOIN public.chado_feature CF on CF.feature_id = F.feature_id
  510. WHERE
  511. F.uniquename = :uname or
  512. F.name = :fname' or
  513. S.name = :sname
  514. GROUP BY F.name, F.uniquename, F.feature_id, O.genus, O.species,
  515. O.organism_id, CVT.cvterm_id, CVT.name, CF.nid
  516. ";
  517. $results = chado_query($sql, array(':uname' => $id, ':fname' => $id, ':sname' => $id));
  518. $num_matches = 0;
  519. // iterate through the matches and build the table for showing matches
  520. $header = array('Uniquename', 'Name', 'Type', 'Species', 'Synonyms');
  521. $rows = array();
  522. $curr_match;
  523. while ($match = $results->fetchObject()) {
  524. $curr_match = $match;
  525. $synonyms = $match->synonyms;
  526. $synonyms = preg_replace('/[\"\{\}]/', '', $synonyms);
  527. $rows[] = array(
  528. $match->uniquename,
  529. "<a href=\"" . url("node/" . $match->nid) . "\">" . $match->name . "</a>",
  530. $match->type_name,
  531. '<i>' . $match->genus . ' ' . $match->species . '</i>',
  532. $synonyms,
  533. );
  534. $num_matches++;
  535. }
  536. // if we have more than one match then generate the table, otherwise, redirect
  537. // to the matched feature
  538. if ($num_matches == 1) {
  539. drupal_goto("node/" . $curr_match->nid);
  540. }
  541. if ($num_matches == 0) {
  542. return "<p>No features matched the given name '$id'</p>";
  543. }
  544. $table_attrs = array('class' => 'tripal-data-table');
  545. $output = "<p>The following features match the name '$id'.</p>";
  546. $output .= theme_table($header, $rows, $table_attrs, $caption);
  547. return $output;
  548. }
  549. /**
  550. * Implementation of hook_form_alter()
  551. *
  552. * @param $form
  553. * @param $form_state
  554. * @param $form_id
  555. *
  556. * @ingroup tripal_feature
  557. */
  558. function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
  559. if ($form_id == "tripal_feature_seq_extract_form") {
  560. // updating the form through the ahah callback sets the action of
  561. // the form to the ahah callback URL. We need to set it back
  562. // to the normal form URL
  563. $form['#action'] = url("find/sequences");
  564. }
  565. // turn off preview button for insert/updates
  566. if ($form_id == "chado_feature_node_form") {
  567. $form['actions']['preview']['#access'] = FALSE;
  568. //remove the body field
  569. unset($form['body']);
  570. }
  571. }