tripal_feature.admin.inc 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <?php
  2. /**
  3. * @file
  4. * @todo Add file header description
  5. */
  6. /**
  7. * Purpose: Provide Guidance to new Tripal Admin
  8. *
  9. * @return
  10. * HTML Formatted text
  11. *
  12. * @ingroup tripal_feature
  13. */
  14. function tripal_feature_module_description_page() {
  15. $text .= '<h3>Tripal Feature Administrative Tools Quick Links:</h3>';
  16. $text .= "<ul>
  17. <li><a href=\"" . url("admin/tripal/tripal_feature/configuration") . "\">Feature Configuration</a></li>
  18. <li><a href=\"" . url("admin/tripal/tripal_feature/fasta_loader") . "\">Import a multi-FASTA file</a></li>
  19. <li><a href=\"" . url("admin/tripal/tripal_feature/gff3_load") . "\">Import a GFF3 file</a></li>
  20. <li><a href=\"" . url("admin/tripal/tripal_feature/sync") . "\">Sync Features</a></li>
  21. <li><a href=\"" . url("admin/tripal/tripal_feature/delete") . "\">Delete Features</a></li>
  22. </ul>";
  23. # <li><a href=\"".url("admin/tripal/tripal_feature/aggregate"). "\">Feature Relationship Aggegators</a></li>
  24. $text .= '<h3>Module Description:</h3>';
  25. $text .= '<p>This module provides an interface for the Chado feature module which stores information
  26. related to genomic features. This module provides support for bulk loading of data in
  27. FASTA or GFF format, visualization of "feature" pages, editing and updating.
  28. </p>';
  29. $text .= '<h3>Setup Instructions:</h3>';
  30. $text .= '<p>After installation of the feature module. The following tasks should be performed
  31. <ol>
  32. <li><p><b>Set Permissions</b>: The feature module supports the Drupal user permissions interface for
  33. controlling access to feature content and functions. These permissions include viewing,
  34. creating, editing or administering of
  35. feature content. The default is that only the original site administrator has these
  36. permissions. You can <a href="' . url('admin/user/roles') . '">add roles</a> for classifying users,
  37. <a href="' . url('admin/user/user') . '">assign users to roles</a> and
  38. <a href="' . url('admin/user/permissions') . '">assign permissions</a> for the feature content to
  39. those roles. For a simple setup, allow anonymous users access to view organism content and
  40. allow the site administrator all other permissions.</p></li>
  41. <li><p><b>Themeing</b>: Before content from Chado can be visualized the Tripal base theme must
  42. be installed. This should have been done prior to this point. But is mentioned here in the event you
  43. follow the instructions below and cannot see content. In this case, if you do not see content
  44. check that Tripal theming is properly installed</p></li>
  45. <li><p><b>Loading of Ontologies</b>: If you
  46. used Tripal to create the Chado database, then you must load ontologies before proceeding. Visit the
  47. page to <a href="' . url('admin/tripal/tripal_cv/obo_loader') . '">load ontologies</a> and load at
  48. least the following ontologies:
  49. <ul>
  50. <li>Chado Feature Properties</li>
  51. <li>Relationship Ontology</li>
  52. <li>Sequence Ontology</li>
  53. <li>Gene Ontology (if loading GO terms for features)</li>
  54. </ul></p></li>
  55. <li><p><b>Create Organisms</b>: Before adding feature data you must already have the
  56. organisms loaded in the database. See the
  57. <a href="' . url('admin/tripal/tripal_organism') . '">Tripal Organism Admin page</a> for
  58. instructions for adding and Syncing organisms.</p></li>
  59. <li><p><b>Create Analysis</b>: Tripal requires that feature data loaded using the Tripal loaders
  60. be associated with an analyis. This provides a grouping for the feature data and can be used
  61. later to visualize data pipelines. Before loading feature data through the FASTA or GFF loaders
  62. you will need to <a href="' . url('node/add') . '">create an analysis</a> for the data.</p></li>
  63. <li><p><b>Create Referring Database Entries</b>: If you would like to associate your feature data with an
  64. external reference database, check to ensure that the <a href="' . url('admin/tripal/tripal_db/edit_db') . '">
  65. database record already exists</a>. If not you should <a href="' . url('admin/tripal/tripal_db/add_db') . '">add a new database record</a> before importing
  66. feature data.</p></li>
  67. <li><p><b>Data Import</b>: if you do not already have an existing Chado database with preloaded data
  68. then you will want
  69. to import data. You can do so using the Chado perl scripts that come with the normal
  70. <a href="http://gmod.org/wiki/Chado">distribution of Chado</a> or you can use the <a href="' . url('admin/tripal/tripal_feature/fasta_loader') . '">FASTA loader</a> and
  71. <a href="' . url('admin/tripal/tripal_feature/gff3_load') . '">GFF loader</a> provided here. If you
  72. created the Chado database using Tripal then you\'ll most likely want to use the Tripal loaders. If your data
  73. is not condusive for loading with these loaders you may have to write your own loaders.
  74. </p></li>
  75. <li><p><b>Sync Features</b>: After data is loaded you need to sync features. This process is what
  76. creates the pages for viewing online. Not all features need be synced. For instance, if you
  77. have loaded whole genome sequence with fully defined gene models with several features to define
  78. a gene and its products (e.g. gene, mRNA, CDS, 5\'UTR, 3\'UTR, etc) you probably only want to create
  79. pages for genes or genes and mRNA. You probably do not want a page for a 5\'UTR.
  80. Using the <a href="' . url('admin/tripal/tripal_feature/configuration/sync') . '">Feature Sync page</a>
  81. you can sync (or create pages) for the desired feature types. </p></li>
  82. <li><p><b>Set Feature URL</b>: It is often convenient to have a simple URL for each feature page.
  83. For example, http://www.mygenomesite.org/[feature], where [feature] is a unique identifier for a feature page.
  84. With this, people can easily include links to feature pages of interest. Use the
  85. <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a>
  86. to specify whether to use the feature name, unique name or internal ID as the [feature] portion of the
  87. URL. Select the one that will guarantee a unique identifier for feature pages.</p></li>
  88. <li><p><b>Indexing</b>: Once all data has been loaded (including analysis data--e.g. blast, interpro, etc.)
  89. you can index all feature pages for searching if you want to ues the Drupal default search mechanism.
  90. Use the <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a>
  91. to either Index (for the first time) or "Reindex" (after adding new data)
  92. the feature pages for searching. Once the site is 100% indexed the pages will be searchable using Drupal\'s
  93. full text searching. You can find the percent indexed for the entire site by visiting the
  94. <a href="' . url('admin/settings/search') . '">Search settings page</a>. Indexing
  95. can take quite a while if you have a lot of data</p></li>
  96. <li><p><b>Set Taxonomy</b>: Drupal provides a mechanism for categorizing content to allow
  97. for advanced searching. Drupal calls this "Taxonomy", but is essentially categorizing the pages.
  98. You can categorize feature pages by their type (e.g. gene, mRNA, contig, EST, etc.) and by the
  99. organism to which they belong. This allows for filtering of search results by organism and feature type.
  100. Use the <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a> to
  101. set the Taxonomy.</p></li>
  102. </ol>
  103. </p>';
  104. $text .= '<h3>Features of this Module:</h3>';
  105. $text .= '<p>Aside from data loading and feature page setup (as described in the Setup section above),
  106. The Tripal feature module also provides the following functionality
  107. <ul>
  108. <li><p><b>Feature Browser:</b> The feature browser is a tabular list of features with links to their
  109. feature pages which appears on the organism
  110. page. It was created to provide a mechanism to allow site visitors to quickly
  111. accesss feature pages when they do not know what to search for. For sites with large numbers of features, this
  112. method for finding a specific pages is inadequate, but may still be included to aid new site
  113. visitors. This browser can be toggled on or off using the
  114. <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a></p></li>
  115. <li><p><b>Feature Summary Report:</b> The feature summary report is a pie chart that indicates the types and quantities
  116. of feature types (Sequence Ontology terms) that are loaded in the database. It appears on the organism
  117. page. The summary can be toggled on or off using the
  118. <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a></p></li>
  119. <li><p><b>Integration with Drupal Views</b>: <a href="http://drupal.org/project/views">Drupal Views</a> is
  120. a powerful tool that allows the site administrator to create lists or basic searching forms of Chado content.
  121. It provides a graphical interface within Drupal to allow the site admin to directly query the Chado database
  122. and create custom lists without PHP programming or customization of Tripal source code. Views can also
  123. be created to filter content that has not yet been synced with Druapl in order to protect access to non
  124. published data (only works if Chado was installed using Tripal). You can see a list of available pre-existing
  125. Views <a href="' . url('admin/build/views/') . '">here</a>, as well as create your own. </p></li>
  126. <li><p><b>Basic Feature Lookup View</b>: This module provides a basic <a href="' . url('features') . '">feature search
  127. tool</a> for finding or listing features in Chado. It does not require indexing for Drupal searching but relies
  128. on Drupal Views. <a href="http://drupal.org/project/views">Drupal Views</a> must be installed. </p></li>
  129. <li><p><b>Delete Features</b>: This module provides a <a href="' . url('admin/tripal/tripal_feature/delete') . '">Delete Feature page</a>
  130. for bulk deltions of features. You may delete features using a list of feature names, or for a specific organism
  131. or for a specific feature type.</p></li>
  132. </ul>
  133. </p>';
  134. $text .= '<h3>Page Customizations</h3>';
  135. $text .= '<p>There are several ways to customize the look-and-feel for the way Chado data is presented through Tripal.
  136. Below is a description of several methods. These methods may be used in conjunction with one another to
  137. provide fine-grained control.
  138. <ul>
  139. <li><p><b>Integration with Drupal Panels</b>: <a href="http://drupal.org/project/views">Drupal Panels</a>
  140. allows for customization of a page layout if you don\'t want to do PHP/Javascript/CSS programming. Tripal comes with pre-set layouts for feature pages. However,
  141. Panels become useful if you prefer a layout that is different from the pre-set layouts. Chado content
  142. is provided to Panels in the form of Drupal "blocks" which you can then place anywhere on a page using the
  143. Panel\'s GUI.</p></li>
  144. <li><p><b>Drupal\'s Content Construction Kit (CCK)</b>: the
  145. <a href="http://drupal.org/project/cck">Content Construction Kit (CCK) </a> is a powerful way to add non-Chado content
  146. to any page without need to edit template files or knowing PHP. You must first download and install CCK.
  147. With CCK, the site administartor can create a new field to appear on the page. For example, currently,
  148. the Chado publication module is not yet supported by Tripal. Therefore, the site administrator can add a text
  149. field to the feature pages. This content is not stored in Chado, but will appear on the feature page. A field
  150. added by CCK will also appear in the form when editing a feature to allow users to manually enter the appropriate
  151. text. If the default pre-set layout and themeing for Tripal is used, it is better to create the CCK element,
  152. indicate that it is not to be shown (using the CCK interface), then manually add the new content type
  153. where desired by editing the templates (as described below). If using Panels, the CCK field can be added to the
  154. location desired using the Panels interface.</p></li>
  155. <li><p><b>Drupal Node Templates</b>: The Tripal packages comes with a "theme_tripal" directory that contains the
  156. themeing for Chado content. The feature module has a template file for feature "nodes" (Tripal feature pages). This file
  157. is named "node-chado_feature.tpl.php", and provides javascript, HTML and PHP code for display of the feature
  158. pages. You can edit this file to control which types of information (or which feature "blocks") are displayed for features. Be sure to
  159. copy these template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
  160. future Tripal updates may overwrite your customizations. See the <a href="http://tripal.sourceforge.net/">Tripal website </a>
  161. for instructions on how to access variables and other Chado content within the template file.</p></li>
  162. <li><p><b>Feature "Block" Templates</b>: In the "theme_tripal" directory is a subdirectory named "tripal_feature".
  163. Inside this directory is a set of templates that control distinct types of information for features. For example,
  164. there is a "base" template for displaying of data directly from the Chado feature table, and a "references"
  165. template for showing external site references for a feature (data from the feature_dbxref table). These templates are used both by Drupal blocks
  166. for use in Drupal Panels (as described above) or for use in the default pre-set layout that the node template
  167. provides (also desribed above). You can customize this template as you desire. Be sure to copy the
  168. template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
  169. future Tripal updates may overwrite your customizations. See the <a href="http://tripal.sourceforge.net/">Tripal website </a>
  170. for instructions on how to access variables and other Chado content within the template files.</p></li>
  171. </li>
  172. <li><p><b>Adding Links to the "Resources" Sidebar</b>: If you use the pre-set default Tripal layout for theming, you
  173. will see a "Resources" sidebar on each page. The links that appear on the sidebar are automatically generated
  174. using Javascript for all of the feature "Blocks" that appear on the page. If you want to add additional links
  175. (e.g. a dynamic link to GBrowse for the feature) and you want that link to appear in the
  176. "Resources" sidebar, simply edit the Drupal Node Template (as described above) and add the link to the
  177. section at the bottom of the template file where the resources section is found.</p></li>
  178. </ul>
  179. </p>';
  180. return $text;
  181. }
  182. /**
  183. *
  184. *
  185. * @ingroup tripal_feature
  186. */
  187. function tripal_feature_admin() {
  188. // before proceeding check to see if we have any
  189. // currently processing jobs. If so, we don't want
  190. // to give the opportunity to sync libraries
  191. $active_jobs = FALSE;
  192. if (tripal_get_module_active_jobs('tripal_feature')) {
  193. $active_jobs = TRUE;
  194. }
  195. if (!$active_jobs) {
  196. get_tripal_feature_admin_form_url_set($form);
  197. $form['browser'] = array(
  198. '#type' => 'fieldset',
  199. '#title' => t('Feature Browser'),
  200. '#collapsible' => 1,
  201. '#collapsed' => 1 ,
  202. );
  203. $allowedoptions1 = array(
  204. 'show_feature_browser' => "Show the feature browser on the organism page. The browser loads when page loads. This may be slow for large sites.",
  205. 'hide_feature_browser' => "Hide the feature browser on the organism page. Disables the feature browser completely.",
  206. );
  207. // $allowedoptions ['allow_feature_browser'] = "Allow loading of the feature browsing through AJAX. For large sites the initial page load will be quick with the feature browser loading afterwards.";
  208. $form['browser']['browser_desc'] = array(
  209. '#type' => 'markup',
  210. '#value' => 'A feature browser can be added to an organism page to allow users to quickly '.
  211. 'access a feature. This will most likely not be the ideal mechanism for accessing feature '.
  212. 'information, especially for large sites, but it will alow users exploring the site (such '.
  213. 'as students) to better understand the data types available on the site.',
  214. );
  215. $form['browser']['feature_types'] = array(
  216. '#title' => t('Feature Types'),
  217. '#type' => 'textarea',
  218. '#description' => t("Enter the Sequence Ontology (SO) terms for the feature types that " .
  219. "will be shown in the feature browser."),
  220. '#default_value' => variable_get('chado_browser_feature_types', 'gene contig'),
  221. );
  222. $form['browser']['browse_features'] = array(
  223. '#title' => 'Feature Browser on Organism Page',
  224. '#type' => 'radios',
  225. '#options' => $allowedoptions1,
  226. '#default_value' => variable_get('tripal_feature_browse_setting', 'show_feature_browser'),
  227. );
  228. $form['browser']['browse_features_library'] = array(
  229. '#title' => 'Feature Browser on Library Page',
  230. '#type' => 'radios',
  231. '#options' => array(
  232. 'show_feature_browser' => "Show the feature browse on the library page. The browser loads when page loads. This may be slow for large sites.",
  233. 'hide_feature_browser' => "Hide the feature browser on the library page. Disables the feature browser completely.",
  234. ),
  235. '#default_value' => variable_get('tripal_library_feature_browse_setting', 'show_feature_browser'),
  236. );
  237. $form['browser']['browse_features_analysis'] = array(
  238. '#title' => 'Feature Browser on Analysis Page',
  239. '#type' => 'radios',
  240. '#options' => array(
  241. 'show_feature_browser' => "Show the feature browse on the analysis page. The browser loads when page loads. This may be slow for large sites.",
  242. 'hide_feature_browser' => "Hide the feature browser on the analysis page. Disables the feature browser completely.",
  243. ),
  244. '#default_value' => variable_get('tripal_analysis_feature_browse_setting', 'show_feature_browser'),
  245. );
  246. $form['browser']['set_browse_button'] = array(
  247. '#type' => 'submit',
  248. '#value' => t('Set Browser'),
  249. '#weight' => 2,
  250. );
  251. $form['feature_edit'] = array(
  252. '#type' => 'fieldset',
  253. '#title' => t('Feature Editing'),
  254. '#collapsible' => 1,
  255. '#collapsed' => 1 ,
  256. );
  257. $form['feature_edit']['browser_desc'] = array(
  258. '#type' => 'markup',
  259. '#value' => 'When editing or creating a feature, a user must provide the feature type. '.
  260. 'The Sequence Ontology list is very large, therefore, to simply the list of types for the user, the following '.
  261. 'textbox allows you to specify which features types can be used. This list of terms will appear in the '.
  262. 'feature type drop down list of the feature creation/edit form.',
  263. );
  264. $form['feature_edit']['feature_edit_types'] = array(
  265. '#title' => t('Feature Types'),
  266. '#type' => 'textarea',
  267. '#description' => t("Enter the Sequence Ontology (SO) terms for the allowed feature types when creating or editing features."),
  268. '#default_value' => variable_get('chado_edit_feature_types', 'gene contig EST mRNA'),
  269. );
  270. $form['feature_edit']['set_feature_types'] = array(
  271. '#type' => 'submit',
  272. '#value' => t('Set Feature Types'),
  273. );
  274. $form['summary'] = array(
  275. '#type' => 'fieldset',
  276. '#title' => t('Feature Summary Report'),
  277. '#collapsible' => 1,
  278. '#collapsed' => 1 ,
  279. );
  280. $allowedoptions2 ['show_feature_summary'] = "Show the feature summary on the organism page. The summary loads when page loads.";
  281. $allowedoptions2 ['hide_feature_summary'] = "Hide the feature summary on the organism page. Disables the feature summary.";
  282. $form['summary']['feature_summary'] = array(
  283. '#title' => 'Feature Summary on Organism Page',
  284. '#description' => 'A feature summary can be added to an organism page to allow users to see the '.
  285. 'type and quantity of features available for the organism.',
  286. '#type' => 'radios',
  287. '#options' => $allowedoptions2,
  288. '#default_value' => variable_get('tripal_feature_summary_setting', 'show_feature_summary'),
  289. );
  290. $form['summary']['feature_mapping'] = array(
  291. '#title' => 'Map feature types',
  292. '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the '.
  293. 'feature summary report by listing them in the following text area. Enter one per line. '.
  294. 'If left blank, all SO terms for all features will be shown in the report. Only those terms '.
  295. 'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a '.
  296. 'SO term to be more human readable form, use an \'=\' sign after the SO term (e.g. \'polypeptide = Protein\')'),
  297. '#type' => 'textarea',
  298. '#rows' => 15,
  299. '#default_value' => variable_get('tripal_feature_summary_report_mapping', ''),
  300. );
  301. $form['summary']['set_summary_button'] = array(
  302. '#type' => 'submit',
  303. '#value' => t('Set Summary'),
  304. '#weight' => 2,
  305. );
  306. get_tripal_feature_admin_form_taxonomy_set($form);
  307. get_tripal_feature_admin_form_reindex_set($form);
  308. get_tripal_feature_admin_form_cleanup_set($form);
  309. }
  310. else {
  311. $form['notice'] = array(
  312. '#type' => 'fieldset',
  313. '#title' => t('Feature Management Temporarily Unavailable')
  314. );
  315. $form['notice']['message'] = array(
  316. '#value' => t('Currently, feature management jobs are waiting or ".
  317. "are running. Managemment features have been hidden until these ".
  318. "jobs complete. Please check back later once these jobs have ".
  319. "finished. You can view the status of pending jobs in the Tripal ".
  320. "jobs page.'),
  321. );
  322. }
  323. return system_settings_form($form);
  324. }
  325. /**
  326. *
  327. *
  328. * @ingroup tripal_feature
  329. */
  330. function tripal_feature_admin_validate($form, &$form_state) {
  331. global $user; // we need access to the user info
  332. $job_args = array();
  333. variable_set('chado_browser_feature_types', $form_state['values']['feature_types']);
  334. // if the user wants to sync up the chado features then
  335. // add the job to the management queue
  336. switch ($form_state['values']['op']) {
  337. case t('Sync all Features') :
  338. tripal_add_job('Sync all features', 'tripal_feature',
  339. 'tripal_feature_sync_features', $job_args, $user->uid);
  340. break;
  341. case t('Set/Reset Taxonomy for all feature nodes') :
  342. tripal_add_job('Set all feature taxonomy', 'tripal_feature',
  343. 'tripal_features_set_taxonomy', $job_args, $user->uid);
  344. break;
  345. case t('Reindex all feature nodes') :
  346. tripal_add_job('Reindex all features', 'tripal_feature',
  347. 'tripal_features_reindex', $job_args, $user->uid);
  348. break;
  349. case t('Clean up orphaned features') :
  350. tripal_add_job('Cleanup orphaned features', 'tripal_feature',
  351. 'tripal_features_cleanup', $job_args, $user->uid);
  352. break;
  353. case t('Set Browser') :
  354. variable_set('tripal_feature_browse_setting', $form_state['values']['browse_features']);
  355. variable_set('tripal_library_feature_browse_setting', $form_state['values']['browse_features_library']);
  356. variable_set('tripal_analysis_feature_browse_setting', $form_state['values']['browse_features_analysis']);
  357. break;
  358. case t('Set Feature Types') :
  359. variable_set('tripal_feature_type_setting', $form_state['values']['feature_edit_types']);
  360. break;
  361. case t('Set Summary') :
  362. variable_set('tripal_feature_summary_setting', $form_state['values']['feature_summary']);
  363. variable_set('tripal_feature_summary_report_mapping', $form_state['values']['feature_mapping']);
  364. break;
  365. case t('Set Feature URLs') :
  366. variable_set('chado_feature_url', $form_state['values']['feature_url']);
  367. tripal_add_job('Set Feature URLs', 'tripal_feature',
  368. 'tripal_feature_set_urls', $job_args, $user->uid);
  369. break;
  370. }
  371. }
  372. /**
  373. *
  374. *
  375. * @ingroup tripal_feature
  376. */
  377. function get_tripal_feature_admin_form_cleanup_set(&$form) {
  378. $form['cleanup'] = array(
  379. '#type' => 'fieldset',
  380. '#title' => t('Clean Up'),
  381. '#collapsible' => 1,
  382. '#collapsed' => 1 ,
  383. );
  384. $form['cleanup']['description'] = array(
  385. '#type' => 'item',
  386. '#value' => t("With Drupal and chado residing in different databases ".
  387. "it is possible that nodes in Drupal and features in Chado become ".
  388. "\"orphaned\". This can occur if a feature node in Drupal is ".
  389. "deleted but the corresponding chado feature is not and/or vice ".
  390. "versa. The Cleanup function will also remove nodes for features ".
  391. "that are not in the list of allowed feature types as specified ".
  392. "above. This is helpful when a feature type needs to be ".
  393. "removed but was previously present as Drupal nodes. ".
  394. "Click the button below to resolve these discrepancies."),
  395. '#weight' => 1,
  396. );
  397. $form['cleanup']['button'] = array(
  398. '#type' => 'submit',
  399. '#value' => t('Clean up orphaned features'),
  400. '#weight' => 2,
  401. );
  402. }
  403. /**
  404. *
  405. *
  406. * @ingroup tripal_feature
  407. */
  408. function get_tripal_feature_admin_form_reindex_set(&$form) {
  409. $form['reindex'] = array(
  410. '#type' => 'fieldset',
  411. '#title' => t('Index/Reindex'),
  412. '#collapsible' => 1,
  413. '#collapsed' => 1 ,
  414. );
  415. $form['reindex']['description'] = array(
  416. '#type' => 'item',
  417. '#value' => t("Indexing or reindexing of nodes is required for Drupal's full text searching. ".
  418. "Index features for the first time to allow for searching of content, and later when content for features ".
  419. "is updated. Depending on the number of features this may take ".
  420. "quite a while. Click the button below to begin reindexing of ".
  421. "features. "),
  422. '#weight' => 1,
  423. );
  424. $form['reindex']['button'] = array(
  425. '#type' => 'submit',
  426. '#value' => t('Reindex all feature nodes'),
  427. '#weight' => 2,
  428. );
  429. }
  430. /**
  431. *
  432. *
  433. * @ingroup tripal_feature
  434. */
  435. function get_tripal_feature_admin_form_taxonomy_set(&$form) {
  436. $form['taxonomy'] = array(
  437. '#type' => 'fieldset',
  438. '#title' => t('Set Taxonomy'),
  439. '#collapsible' => 1,
  440. '#collapsed' => 1 ,
  441. );
  442. $form['taxonomy']['description'] = array(
  443. '#type' => 'item',
  444. '#value' => t("Drupal allows for assignment of \"taxonomy\" or ".
  445. "catagorical terms to nodes. These terms allow for advanced ".
  446. "filtering during searching."),
  447. '#weight' => 1,
  448. );
  449. $tax_options = array(
  450. 'organism' => t('Organism name'),
  451. 'feature_type' => t('Feature Type (e.g. EST, mRNA, etc.)'),
  452. 'analysis' => t('Analysis Name'),
  453. 'library' => t('Library Name'),
  454. );
  455. $form['taxonomy']['tax_classes'] = array(
  456. '#title' => t('Available Taxonomic Classes'),
  457. '#type' => t('checkboxes'),
  458. '#description' => t("Please select the class of terms to assign to ".
  459. "chado features"),
  460. '#required' => FALSE,
  461. '#prefix' => '<div id="taxclass_boxes">',
  462. '#suffix' => '</div>',
  463. '#options' => $tax_options,
  464. '#weight' => 2,
  465. '#default_value' => variable_get('tax_classes', ''),
  466. );
  467. $form['taxonomy']['button'] = array(
  468. '#type' => 'submit',
  469. '#value' => t('Set/Reset Taxonomy for all feature nodes'),
  470. '#weight' => 3,
  471. );
  472. }
  473. function get_tripal_feature_admin_form_url_set(&$form) {
  474. $form['url'] = array(
  475. '#type' => 'fieldset',
  476. '#title' => t('Feature URL Path')
  477. );
  478. $form['url']['desc'] = array(
  479. '#type' => 'markup',
  480. '#value' => t('Each synced feature will have a unique URL which consists of '.
  481. 'the site domain followed by a unique identifer: for '.
  482. 'example http://my-tripal-site.org/ID1034, where the '.
  483. 'element just after the final slash is the unique '.
  484. 'identifier for the feature.'),
  485. );
  486. $options = array(
  487. 'internal ID' => 'Internal ID (Chado feature_id)',
  488. 'feature unique name' => 'Feature unique name',
  489. 'feature name' => 'Feature name',
  490. 'genus_species_uqname' => 'Genus + species + unique name (e.g. http://your.site.url/[genus]/[genus]_[species]/[unique_name]',
  491. 'genus_species_name' => 'Genus + species + name (e.g. http://your.site.url/[genus]/[genus]_[species]/[name]',
  492. );
  493. $form['url']['chado_feature_url'] = array(
  494. '#title' => t('Unique Identifier'),
  495. '#type' => 'radios',
  496. '#description' => t('Choose an identifier type '.
  497. 'from the list above that is guaranteed to be unique in your synced '.
  498. 'dataset. If in doubt it is safest to coose the internal ID. '.
  499. 'The descrpitor need not be unique amont the total dataset. '.
  500. 'It only need be unique among the synced dataset.'),
  501. '#required' => FALSE,
  502. '#options' => $options,
  503. '#default_value' => variable_get('chado_feature_url', 'internal ID'),
  504. );
  505. $form['url']['chado_feature_accession_prefix'] = array(
  506. '#title' => t('ID Prefix'),
  507. '#type' => t('textfield'),
  508. '#description' => t("If you choose an Internal ID above you must also enter an ID prefix.".
  509. "this prefix will be prepended to the internal ID number (e.g. ID38294). ".
  510. "if you chose to use the feature name or unique name then this prfix is not used"),
  511. '#required' => TRUE,
  512. '#default_value' => variable_get('chado_feature_accession_prefix', 'ID'),
  513. );
  514. $form['url']['button'] = array(
  515. '#type' => 'submit',
  516. '#value' => t('Set Feature URLs'),
  517. '#weight' => 3,
  518. );
  519. }