tripal_analysis_go.module 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <?php
  2. require_once "includes/gaf_loader.inc";
  3. function tripal_analysis_go_init(){
  4. // Add style sheet
  5. drupal_add_css(drupal_get_path('module', 'tripal_analysis_go').'/theme/css/tripal_analysis_go.css', 'theme');
  6. drupal_add_js(drupal_get_path('module', 'tripal_analysis_go').'/theme/js/tripal_analysis_go.js');
  7. }
  8. /*******************************************************************************
  9. * Menu items are automatically added for the new node types created
  10. * by this module to the 'Create Content' Navigation menu item. This function
  11. * adds more menu items needed for this module.
  12. */
  13. function tripal_analysis_go_menu() {
  14. $items = array();
  15. $items['download_goterm_features'] = array(
  16. 'path' => 'download_goterm_features',
  17. 'title' => t('Get GO Term Features'),
  18. 'page callback' => 'tripal_analysis_go_get_goterm_features',
  19. 'page arguments' => array(1,2),
  20. 'access arguments' => array('access chado_analysis_go content'),
  21. 'type' => MENU_CALLBACK
  22. );
  23. $items['tripal_analysis_go_org_charts'] = array(
  24. 'path' => 'tripal_analysis_go_org_charts',
  25. 'title' => t('Analysis GO Charts'),
  26. 'page callback' => 'tripal_analysis_go_org_charts',
  27. 'page arguments' => array(1),
  28. 'access arguments' => array('access chado_analysis_go content'),
  29. 'type' => MENU_CALLBACK
  30. );
  31. $items['admin/tripal/tripal_analysis_go'] = array(
  32. 'title' => 'Gene Ontology',
  33. 'description' => 'Administrative tools for managing Gene Ontology data.',
  34. 'page callback' => 'tripal_analysis_go_module_description_page',
  35. 'access arguments' => array('administer site configuration'),
  36. 'type' => MENU_NORMAL_ITEM,
  37. );
  38. $items['admin/tripal/tripal_analysis_go/gaf_load'] = array(
  39. 'title' => t('Import GO terms with GAF file'),
  40. 'description' => t("Import GO terms into Chado using the Gene Ontology's GAF 2.0 file format"),
  41. 'page callback' => 'drupal_get_form',
  42. 'page arguments' => array('tripal_analysis_go_gaf_load_form'),
  43. 'access arguments' => array('access administration pages'),
  44. 'type' => MENU_NORMAL_ITEM,
  45. );
  46. return $items;
  47. }
  48. /*************************************************************************
  49. * Purpose: Provide Guidance to new Tripal Admin
  50. *
  51. * @return HTML Formatted text
  52. */
  53. function tripal_analysis_go_module_description_page() {
  54. $text = '';
  55. $text .= '<h3>Description:</h3>';
  56. $text .= '<p>TODO: Basic Description of this module including mention/link to the chado module</p>';
  57. $text .= '<h3>Post Installation Instructions:</h3>';
  58. $text .= '<p>TODO: Describe any post installation intructions here. You shouldalways include setting user permissions.</p>';
  59. $text .= '<h3>Features of this Module:</h3>';
  60. $text .= '<p>TODO: Discuss the Features of this module including links. Some features to consider are creating content, details pages/node content, editing/deleteing, basic listings and vies integration. See admin/tripal/tripal_stock for an example.</p>';
  61. return $text;
  62. }
  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. function tripal_analysis_go_perm(){
  69. return array(
  70. 'access chado_analysis_go content',
  71. 'create chado_analysis_go content',
  72. 'delete chado_analysis_go content',
  73. 'edit chado_analysis_go content',
  74. );
  75. }
  76. /*******************************************************************************
  77. * The following function proves access control for users trying to
  78. * perform actions on data managed by this module
  79. */
  80. function chado_analysis_go_access($op, $node, $account){
  81. if ($op == 'create') {
  82. if(!user_access('create chado_analysis_go content', $account)){
  83. return FALSE;
  84. }
  85. }
  86. if ($op == 'update') {
  87. if (!user_access('edit chado_analysis_go content', $account)) {
  88. return FALSE;
  89. }
  90. }
  91. if ($op == 'delete') {
  92. if (!user_access('delete chado_analysis_go content', $account)) {
  93. return FALSE;
  94. }
  95. }
  96. if ($op == 'view') {
  97. if (!user_access('access chado_analysis_go content', $account)) {
  98. return FALSE;
  99. }
  100. }
  101. return NULL;
  102. }
  103. /*******************************************************************************
  104. *
  105. */
  106. function tripal_analysis_go_block($op = 'list', $delta = 0, $edit=array()){
  107. switch($op) {
  108. case 'list':
  109. $blocks['tago_org_sum']['info'] = t('Tripal Organism GO Analysis Report');
  110. $blocks['tago_org_sum']['cache'] = BLOCK_NO_CACHE;
  111. $blocks['featurego']['info'] = t('Tripal Feature GO Terms');
  112. $blocks['featurego']['cache'] = BLOCK_NO_CACHE;
  113. return $blocks;
  114. case 'view':
  115. if(user_access('access chado_analysis_go content') and arg(0) == 'node' and is_numeric(arg(1))) {
  116. $nid = arg(1);
  117. $node = node_load($nid);
  118. $block = array();
  119. switch($delta){
  120. case 'tago_org_sum':
  121. $block['subject'] = t('GO Summary');
  122. $block['content'] = theme('tripal_organism_go_summary',$node);
  123. break;
  124. case 'featurego':
  125. $block['subject'] = t('GO Terms');
  126. $block['content'] = theme('tripal_feature_go_terms',$node);
  127. break;
  128. default :
  129. }
  130. return $block;
  131. }
  132. }
  133. }
  134. /*******************************************************************************
  135. * HOOK: Implementation of hook_nodeapi()
  136. * Display library information for associated features or organisms
  137. * This function also provides contents for indexing
  138. */
  139. function tripal_analysis_go_nodeapi(&$node, $op, $teaser, $page) {
  140. switch ($op) {
  141. case 'view':
  142. if ($teaser) {
  143. return;
  144. }
  145. // add the library to the organism/feature search indexing
  146. if($node->build_mode == NODE_BUILD_SEARCH_INDEX){
  147. $node->content['tripal_analysis_go_search_index'] = array(
  148. '#value' => theme('tripal_analysis_go_search_index',$node),
  149. '#weight' => 5,
  150. );
  151. } else if ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
  152. $node->content['tripal_analysis_go_search_result'] = array(
  153. '#value' => theme('tripal_analysis_go_search_result',$node),
  154. '#weight' => 5,
  155. );
  156. } else {
  157. // Show go terms if the organism/feature is not at teaser view
  158. switch($node->type){
  159. case 'chado_organism':
  160. $node->content['tripal_organism_go_summary'] = array(
  161. '#value' => theme('tripal_organism_go_summary',$node),
  162. '#weight' => 5,
  163. );
  164. break;
  165. case 'chado_feature':
  166. $node->content['tripal_feature_go_terms'] = array(
  167. '#value' => theme('tripal_feature_go_terms',$node),
  168. '#weight' => 5,
  169. );
  170. break;
  171. }
  172. }
  173. break;
  174. }
  175. }
  176. /************************************************************************
  177. * We need to let drupal know about our theme functions and their arguments.
  178. * We create theme functions to allow users of the module to customize the
  179. * look and feel of the output generated in this module
  180. */
  181. function tripal_analysis_go_theme () {
  182. $path = drupal_get_path('module', 'tripal_analysis_go') . '/theme';
  183. return array(
  184. 'tripal_analysis_go_search_index' => array (
  185. 'arguments' => array('node'),
  186. ),
  187. 'tripal_analysis_go_search_result' => array (
  188. 'arguments' => array('node'),
  189. ),
  190. 'tripal_organism_go_summary' => array (
  191. 'arguments' => array('node'=> null),
  192. 'template' => 'tripal_organism_go_summary',
  193. 'path' => $path . '/tripal_organism',
  194. ),
  195. 'tripal_feature_go_terms' => array (
  196. 'arguments' => array('node'=> null),
  197. 'template' => 'tripal_feature_go_terms',
  198. 'path' => $path . '/tripal_feature',
  199. )
  200. );
  201. }
  202. /************************************************************************
  203. */
  204. function theme_tripal_analysis_go_search_index($node){
  205. }
  206. /************************************************************************
  207. */
  208. function theme_tripal_analysis_go_search_result($node){
  209. }
  210. /************************************************************************
  211. */
  212. function tripal_analysis_go_preprocess_tripal_feature_go_terms(&$variables){
  213. $feature = $variables['node']->feature;
  214. $feature->tripal_analysis_go->terms = tripal_analysis_go_load_feature_terms($feature);
  215. }
  216. /************************************************************************
  217. */
  218. function tripal_analysis_go_preprocess_tripal_organism_go_summary(&$variables){
  219. $node = $variables['node'];
  220. $organism = $node->organism;
  221. $organism->tripal_analysis_go->select_form = tripal_analysis_go_load_organism_go_summary($node);
  222. }
  223. /************************************************************************
  224. */
  225. function tripal_analysis_go_select_form(&$form_state = NULL,$node){
  226. $form = array();
  227. // find analyses that have GO terms
  228. $sql = "
  229. SELECT DISTINCT A.analysis_id, A.name, GCA.organism_id
  230. FROM {go_count_analysis} GCA
  231. INNER JOIN Analysis A on GCA.analysis_id = A.analysis_id
  232. WHERE organism_id = %d
  233. ORDER BY analysis_id DESC
  234. ";
  235. $previous_db = tripal_db_set_active('chado');
  236. $results = db_query($sql,$node->organism->organism_id);
  237. tripal_db_set_active($previous_db);
  238. $analyses = array();
  239. $analyses[''] = '';
  240. while($analysis = db_fetch_object($results)){
  241. # check to see if the user has permission to see this analysis
  242. $anode = tripal_analysis_get_node($analysis->analysis_id);
  243. if(node_access("view",$anode)){
  244. $analyses[$analysis->analysis_id."-".$analysis->organism_id] = "$analysis->name";
  245. }
  246. }
  247. # create the select box
  248. $form['tripal_analysis_go_select'] = array(
  249. '#title' => t('Select a GO report to view'),
  250. '#description' => t('Any analysis with GO results related to this organism are available for viewing. For further information, see the analysis information page.'),
  251. '#type' => 'select',
  252. '#options' => $analyses,
  253. '#attributes' => array (
  254. 'onchange' => 'tripal_analysis_go_org_charts(this.options[this.selectedIndex].value)'
  255. ),
  256. );
  257. return $form;
  258. }
  259. /************************************************************************
  260. */
  261. function tripal_analysis_go_org_charts ($element) {
  262. $analysis_id = preg_replace("/^(\d+)-(\d+)$/","$1",$element);
  263. $organism_id = preg_replace("/^(\d+)-(\d+)$/","$2",$element);
  264. $content = '';
  265. if($analysis_id and $organism_id){
  266. $content = "
  267. <b>Biological Process</b>
  268. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  269. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_bp\"></div>
  270. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_bp\" src=\"\" border=\"0\">
  271. <br><br><br><br>
  272. <b>Cellular Component</b>
  273. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  274. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_cc\"></div>
  275. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_cc\" src=\"\" border=\"0\">
  276. <br><br><br><br>
  277. <b>Molecular Function</b>
  278. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  279. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_mf\"></div>
  280. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_mf\" src=\"\" border=\"0\">
  281. ";
  282. }
  283. $opt = array($content);
  284. return drupal_json($opt);
  285. }
  286. /************************************************************************
  287. */
  288. function tripal_analysis_go_load_organism_go_summary($node) {
  289. $organism = $node->organism;
  290. // check to see if we have any analyses
  291. $sql = "
  292. SELECT A.analysis_id
  293. FROM {go_count_analysis} GCA
  294. INNER JOIN Analysis A on GCA.analysis_id = A.analysis_id
  295. WHERE organism_id = %d
  296. ";
  297. $previous_db = tripal_db_set_active('chado');
  298. $results = db_query($sql,$organism->organism_id);
  299. tripal_db_set_active($previous_db);
  300. # check to ensure we have access to at least one of the GO analyses
  301. $has_results = 0;
  302. while($analysis = db_fetch_object($results)){
  303. $anode = tripal_analysis_get_node($analysis->analysis_id);
  304. if(node_access("view",$anode)){
  305. $has_results = 1;
  306. }
  307. }
  308. return array (
  309. 'has_results' => $has_results,
  310. 'form' => drupal_get_form('tripal_analysis_go_select_form',$node),
  311. );
  312. }
  313. /************************************************************************
  314. *
  315. */
  316. function tripal_analysis_go_cv_chart($chart_id){
  317. // The CV module will create the JSON array necessary for buillding a
  318. // pie chart using jgChart and Google Charts. We have to pass to it
  319. // a table that contains count information, tell it which column
  320. // contains the cvterm_id and provide a filter for getting the
  321. // results we want from the table.
  322. $organism_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$chart_id);
  323. $analysis_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$chart_id);
  324. $type = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$chart_id);
  325. $sql = "SELECT * FROM {Analysis} WHERE analysis_id = %d";
  326. $previous_db = tripal_db_set_active('chado'); // use chado database
  327. $analysis = db_fetch_object(db_query($sql,$analysis_id));
  328. tripal_db_set_active($previous_db); // now use drupal database
  329. if(strcmp($type,'mf')==0){
  330. $class = 'molecular_function';
  331. $title = "Number of Molecular Function Terms From $analysis->name Analysis";
  332. }
  333. if(strcmp($type,'cc')==0){
  334. $class = 'cellular_component';
  335. $title = "Number of Cellular Component Terms From $analysis->name Analysis";
  336. }
  337. if(strcmp($type,'bp')==0){
  338. $class = 'biological_process';
  339. $title = "Number of Biological Process Terms From $analysis->name Analysis";
  340. }
  341. $options = array(
  342. count_mview => 'go_count_analysis',
  343. cvterm_id_column => 'cvterm_id',
  344. count_column => 'feature_count',
  345. filter => "
  346. CNT.organism_id = $organism_id AND
  347. CNT.analysis_id = $analysis_id AND
  348. CNT.cvterm_id IN (
  349. SELECT CVTR.subject_id
  350. FROM {CVTerm_relationship} CVTR
  351. INNER JOIN CVTerm CVT on CVTR.object_id = CVT.cvterm_id
  352. INNER JOIN CV on CVT.cv_id = CV.cv_id
  353. WHERE CVT.name = '$class' AND
  354. CV.name = '$class'
  355. )
  356. ",
  357. type => 'p',
  358. size => '650x260',
  359. title => $title,
  360. );
  361. return $options;
  362. }
  363. /************************************************************************
  364. *
  365. */
  366. function tripal_analysis_go_cv_tree($tree_id){
  367. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  368. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  369. $type = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$tree_id);
  370. if(strcmp($type,'mf')==0){
  371. $class = 'molecular_function';
  372. }
  373. if(strcmp($type,'cc')==0){
  374. $class = 'cellular_component';
  375. }
  376. if(strcmp($type,'bp')==0){
  377. $class = 'biological_process';
  378. }
  379. $options = array(
  380. cv_id => tripal_cv_get_cv_id($class),
  381. count_mview => 'go_count_analysis',
  382. cvterm_id_column => 'cvterm_id',
  383. count_column => 'feature_count',
  384. filter => "CNT.organism_id = $organism_id AND CNT.analysis_id = $analysis_id",
  385. label => 'Features',
  386. );
  387. return $options;
  388. }
  389. /************************************************************************
  390. */
  391. function tripal_analysis_go_cvterm_add($cvterm_id,$tree_id){
  392. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  393. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  394. $sql = "
  395. SELECT DBX.accession
  396. FROM {cvterm} CVT
  397. INNER JOIN dbxref DBX on DBX.dbxref_id = CVT.dbxref_id
  398. WHERE cvterm_id = %d
  399. ";
  400. $previous_db = tripal_db_set_active('chado');
  401. $xref = db_fetch_object(db_query($sql,$cvterm_id));
  402. tripal_db_set_active($previous_db);
  403. $link = url("download_goterm_features/$cvterm_id/$tree_id");
  404. $options = array(
  405. 'Download sequences' => "<a href=\"$link\">GO_".$xref->accession.".fasta</a>",
  406. );
  407. return $options;
  408. }
  409. /************************************************************************
  410. */
  411. function tripal_analysis_go_get_goterm_features($cvterm_id,$tree_id){
  412. // get hte accession number for this cvterm and use it in naming the download
  413. $sql = "
  414. SELECT DBX.accession
  415. FROM {cvterm} CVT
  416. INNER JOIN dbxref DBX on DBX.dbxref_id = CVT.dbxref_id
  417. WHERE cvterm_id = %d
  418. ";
  419. $previous_db = tripal_db_set_active('chado');
  420. $xref = db_fetch_object(db_query($sql,$cvterm_id));
  421. tripal_db_set_active($previous_db);
  422. drupal_set_header('Content-Type: text');
  423. drupal_set_header('Content-Disposition: attachment; filename="GO_'.$xref->accession.'.fasta"');
  424. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  425. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  426. $sql = "
  427. SELECT DISTINCT F.name,F.residues,F.feature_id
  428. FROM {cvtermpath} CVTP
  429. INNER JOIN CVTerm CVT1 on CVTP.subject_id = CVT1.cvterm_id
  430. INNER JOIN CVTerm CVT2 on CVTP.object_id = CVT2.cvterm_id
  431. INNER JOIN AnalysisFeatureProp AFP on AFP.type_id = CVTP.subject_id
  432. INNER JOIN AnalysisFeature AF on AF.analysisfeature_id = AFP.analysisfeature_id
  433. INNER JOIN Feature F on AF.feature_id = F.feature_id
  434. WHERE CVTP.object_id = %d and F.organism_id = %d and AF.analysis_id = %d
  435. ORDER BY F.name
  436. ";
  437. $previous_db = tripal_db_set_active('chado');
  438. $results = db_query($sql,$cvterm_id,$organism_id,$analysis_id);
  439. tripal_db_set_active($previous_db);
  440. while($feature = db_fetch_object($results)){
  441. // get the go term information for each sequence
  442. $sql = "
  443. SELECT CVT.name,DBX.accession
  444. FROM {Feature_CVTerm} FCVT
  445. INNER JOIN CVTerm CVT on FCVT.cvterm_id = CVT.cvterm_id
  446. INNER JOIN DBXref DBX on CVT.dbxref_id = DBX.dbxref_id
  447. WHERE FCVT.feature_id = %d
  448. ";
  449. $previous_db = tripal_db_set_active('chado');
  450. $terms = db_query($sql,$feature->feature_id);
  451. tripal_db_set_active($previous_db);
  452. $desc = '[';
  453. while($term = db_fetch_object($terms)){
  454. $desc .= "GO:$term->accession $term->name; ";
  455. }
  456. $desc = chop($desc);
  457. $desc = chop($desc,';');
  458. $desc .= ']';
  459. print tripal_feature_return_fasta($feature, $desc);
  460. }
  461. return;
  462. }
  463. /************************************************************************
  464. */
  465. function tripal_analysis_go_load_feature_terms($feature) {
  466. $sql = "
  467. SELECT DISTINCT FCVT.feature_id,DBX.accession,CVT.name as goterm,
  468. CVT.cvterm_id as go_id, CV.name as cvname, CVT.definition
  469. FROM {Feature_Cvterm} FCVT
  470. INNER JOIN Cvterm CVT ON CVT.cvterm_ID = FCVT.cvterm_ID
  471. INNER JOIN CV ON CV.cv_id = CVT.cv_id
  472. INNER JOIN dbxref DBX ON DBX.dbxref_id = CVT.dbxref_id
  473. WHERE
  474. (CV.name = 'biological_process' OR
  475. CV.name = 'cellular_component' OR
  476. CV.name = 'molecular_function') AND
  477. FCVT.feature_id = %d
  478. ORDER BY CV.name, CVT.name
  479. ";
  480. $previous_db = tripal_db_set_active('chado');
  481. $results = db_query($sql,$feature->feature_id);
  482. tripal_db_set_active($previous_db);
  483. $i=0;
  484. $terms = array();
  485. while($term = db_fetch_object($results)){
  486. $terms[$i++] = $term;
  487. }
  488. return $terms;
  489. }
  490. /*******************************************************************************
  491. * Tripal GO administrative setting form. This function is called by
  492. * tripal_analysis module which asks for an admin form to show on the page
  493. */
  494. function tripal_analysis_go_get_settings() {
  495. // Get an array of node types with internal names as keys
  496. $options = node_get_types('names');
  497. // Add 'chado_feature' to allowed content types for showing unigene results
  498. $allowedoptions ['chado_feature'] = "Show GO terms on feature pages";
  499. $allowedoptions ['chado_organism'] = "Show GO analysis on organism pages";
  500. $form['description'] = array(
  501. '#type' => 'item',
  502. '#value' => t("This option allows user to display the Gene Ontology (GO) ".
  503. "information. For features, this would include all GO terms assigned to a feature ".
  504. "and for organisms this would be statistical pie charts of GO terms for a organism. Check the box to ".
  505. "enable the display of GO information. Uncheck to disable."),
  506. '#weight' => 0,
  507. );
  508. $form['tripal_analysis_go_setting'] = array(
  509. '#type' => 'checkboxes',
  510. '#options' => $allowedoptions,
  511. '#default_value'=>variable_get('tripal_analysis_go_setting',array('chado_feature', 'chado_organism')),
  512. );
  513. $settings->form = $form;
  514. $settings->title = "Tripal GO";
  515. return $settings;
  516. }
  517. /**
  518. *
  519. *
  520. * @ingroup tripal_feature
  521. */
  522. function tripal_analysis_go_job_describe_args($callback,$args){
  523. $new_args = array();
  524. if($callback == 'tripal_analysis_go_load_gaf'){
  525. $new_args['GAF 2.0 file'] = $args[0];
  526. $organism = tripal_core_chado_select('organism',array('genus','species'),array('organism_id' => $args[1]));
  527. $new_args['Organism'] = $organism[0]->genus." ". $organism[0]->species;
  528. $new_args['Sequence Type'] = $args[7];
  529. if(!$args[8]){
  530. $new_args['Use Unique Name'] = 'No';
  531. } else {
  532. $new_args['Use Unique Name'] = 'Yes';
  533. }
  534. // add in the analysis
  535. if($args[2]){
  536. $analysis = tripal_core_chado_select('analysis',array('name'),array('analysis_id' => $args[2]));
  537. }
  538. $new_args['Analysis'] = $analysis[0]->name;
  539. if($args[3]){
  540. $new_args['Function to perform'] = 'Add GO terms';
  541. }
  542. if($args[4]){
  543. $new_args['Function to perform'] = 'Replace GO terms';
  544. }
  545. if($args[5]){
  546. $new_args['Function to perform'] = 'Delete GO terms';
  547. }
  548. $new_args['Regular expression for the feature name'] = $args[6];
  549. }
  550. return $new_args;
  551. }