tripal_analysis_go.module 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <?php
  2. require_once "gaf_loader.inc";
  3. function tripal_analysis_go_init(){
  4. // Add style sheet
  5. drupal_add_css(drupal_get_path('theme', 'tripal').'/css/tripal_analysis_go.css');
  6. drupal_add_js(drupal_get_path('theme', 'tripal').'/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. return array(
  183. 'tripal_analysis_go_search_index' => array (
  184. 'arguments' => array('node'),
  185. ),
  186. 'tripal_analysis_go_search_result' => array (
  187. 'arguments' => array('node'),
  188. ),
  189. 'tripal_organism_go_summary' => array (
  190. 'arguments' => array('node'=> null),
  191. 'template' => 'tripal_organism_go_summary',
  192. ),
  193. 'tripal_feature_go_terms' => array (
  194. 'arguments' => array('node'=> null),
  195. 'template' => 'tripal_feature_go_terms',
  196. )
  197. );
  198. }
  199. /************************************************************************
  200. */
  201. function theme_tripal_analysis_go_search_index($node){
  202. }
  203. /************************************************************************
  204. */
  205. function theme_tripal_analysis_go_search_result($node){
  206. }
  207. /************************************************************************
  208. */
  209. function tripal_analysis_go_preprocess_tripal_feature_go_terms(&$variables){
  210. $feature = $variables['node']->feature;
  211. $feature->tripal_analysis_go->terms = tripal_analysis_go_load_feature_terms($feature);
  212. }
  213. /************************************************************************
  214. */
  215. function tripal_analysis_go_preprocess_tripal_organism_go_summary(&$variables){
  216. $node = $variables['node'];
  217. $organism = $node->organism;
  218. $organism->tripal_analysis_go->select_form = tripal_analysis_go_load_organism_go_summary($node);
  219. }
  220. /************************************************************************
  221. */
  222. function tripal_analysis_go_select_form(&$form_state = NULL,$node){
  223. $form = array();
  224. // find analyses that have GO terms
  225. $sql = "
  226. SELECT DISTINCT A.analysis_id, A.name, GCA.organism_id
  227. FROM {go_count_analysis} GCA
  228. INNER JOIN Analysis A on GCA.analysis_id = A.analysis_id
  229. WHERE organism_id = %d
  230. ORDER BY analysis_id DESC
  231. ";
  232. $previous_db = tripal_db_set_active('chado');
  233. $results = db_query($sql,$node->organism->organism_id);
  234. tripal_db_set_active($previous_db);
  235. $analyses = array();
  236. $analyses[''] = '';
  237. while($analysis = db_fetch_object($results)){
  238. # check to see if the user has permission to see this analysis
  239. $anode = tripal_analysis_get_node($analysis->analysis_id);
  240. if(node_access("view",$anode)){
  241. $analyses[$analysis->analysis_id."-".$analysis->organism_id] = "$analysis->name";
  242. }
  243. }
  244. # create the select box
  245. $form['tripal_analysis_go_select'] = array(
  246. '#title' => t('Select a GO report to view'),
  247. '#description' => t('Any analysis with GO results related to this organism are available for viewing. For further information, see the analysis information page.'),
  248. '#type' => 'select',
  249. '#options' => $analyses,
  250. '#attributes' => array (
  251. 'onchange' => 'tripal_analysis_go_org_charts(this.options[this.selectedIndex].value)'
  252. ),
  253. );
  254. return $form;
  255. }
  256. /************************************************************************
  257. */
  258. function tripal_analysis_go_org_charts ($element) {
  259. $analysis_id = preg_replace("/^(\d+)-(\d+)$/","$1",$element);
  260. $organism_id = preg_replace("/^(\d+)-(\d+)$/","$2",$element);
  261. $content = '';
  262. if($analysis_id and $organism_id){
  263. $content = "
  264. <b>Biological Process</b>
  265. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  266. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_bp\"></div>
  267. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_bp\" src=\"\" border=\"0\">
  268. <br><br><br><br>
  269. <b>Cellular Component</b>
  270. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  271. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_cc\"></div>
  272. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_cc\" src=\"\" border=\"0\">
  273. <br><br><br><br>
  274. <b>Molecular Function</b>
  275. <br><i>Expand the tree to browse term counts. Click a term to view term details.</i>
  276. <div class=\"tripal_cv_tree\" id=\"tripal_analysis_go_cv_tree_".$organism_id."-".$analysis_id."_mf\"></div>
  277. <br><br><img class=\"tripal_cv_chart\" id=\"tripal_analysis_go_cv_chart_".$organism_id."-".$analysis_id."_mf\" src=\"\" border=\"0\">
  278. ";
  279. }
  280. $opt = array($content);
  281. return drupal_json($opt);
  282. }
  283. /************************************************************************
  284. */
  285. function tripal_analysis_go_load_organism_go_summary($node) {
  286. $organism = $node->organism;
  287. // check to see if we have any analyses
  288. $sql = "
  289. SELECT A.analysis_id
  290. FROM {go_count_analysis} GCA
  291. INNER JOIN Analysis A on GCA.analysis_id = A.analysis_id
  292. WHERE organism_id = %d
  293. ";
  294. $previous_db = tripal_db_set_active('chado');
  295. $results = db_query($sql,$organism->organism_id);
  296. tripal_db_set_active($previous_db);
  297. # check to ensure we have access to at least one of the GO analyses
  298. $has_results = 0;
  299. while($analysis = db_fetch_object($results)){
  300. $anode = tripal_analysis_get_node($analysis->analysis_id);
  301. if(node_access("view",$anode)){
  302. $has_results = 1;
  303. }
  304. }
  305. return array (
  306. 'has_results' => $has_results,
  307. 'form' => drupal_get_form('tripal_analysis_go_select_form',$node),
  308. );
  309. }
  310. /************************************************************************
  311. *
  312. */
  313. function tripal_analysis_go_cv_chart($chart_id){
  314. // The CV module will create the JSON array necessary for buillding a
  315. // pie chart using jgChart and Google Charts. We have to pass to it
  316. // a table that contains count information, tell it which column
  317. // contains the cvterm_id and provide a filter for getting the
  318. // results we want from the table.
  319. $organism_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$chart_id);
  320. $analysis_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$chart_id);
  321. $type = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$chart_id);
  322. $sql = "SELECT * FROM {Analysis} WHERE analysis_id = %d";
  323. $previous_db = tripal_db_set_active('chado'); // use chado database
  324. $analysis = db_fetch_object(db_query($sql,$analysis_id));
  325. tripal_db_set_active($previous_db); // now use drupal database
  326. if(strcmp($type,'mf')==0){
  327. $class = 'molecular_function';
  328. $title = "Number of Molecular Function Terms From $analysis->name Analysis";
  329. }
  330. if(strcmp($type,'cc')==0){
  331. $class = 'cellular_component';
  332. $title = "Number of Cellular Component Terms From $analysis->name Analysis";
  333. }
  334. if(strcmp($type,'bp')==0){
  335. $class = 'biological_process';
  336. $title = "Number of Biological Process Terms From $analysis->name Analysis";
  337. }
  338. $options = array(
  339. count_mview => 'go_count_analysis',
  340. cvterm_id_column => 'cvterm_id',
  341. count_column => 'feature_count',
  342. filter => "
  343. CNT.organism_id = $organism_id AND
  344. CNT.analysis_id = $analysis_id AND
  345. CNT.cvterm_id IN (
  346. SELECT CVTR.subject_id
  347. FROM {CVTerm_relationship} CVTR
  348. INNER JOIN CVTerm CVT on CVTR.object_id = CVT.cvterm_id
  349. INNER JOIN CV on CVT.cv_id = CV.cv_id
  350. WHERE CVT.name = '$class' AND
  351. CV.name = '$class'
  352. )
  353. ",
  354. type => 'p',
  355. size => '550x175',
  356. title => $title,
  357. );
  358. return $options;
  359. }
  360. /************************************************************************
  361. *
  362. */
  363. function tripal_analysis_go_cv_tree($tree_id){
  364. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  365. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  366. $type = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$tree_id);
  367. if(strcmp($type,'mf')==0){
  368. $class = 'molecular_function';
  369. }
  370. if(strcmp($type,'cc')==0){
  371. $class = 'cellular_component';
  372. }
  373. if(strcmp($type,'bp')==0){
  374. $class = 'biological_process';
  375. }
  376. $options = array(
  377. cv_id => tripal_cv_get_cv_id($class),
  378. count_mview => 'go_count_analysis',
  379. cvterm_id_column => 'cvterm_id',
  380. count_column => 'feature_count',
  381. filter => "CNT.organism_id = $organism_id AND CNT.analysis_id = $analysis_id",
  382. label => 'Features',
  383. );
  384. return $options;
  385. }
  386. /************************************************************************
  387. */
  388. function tripal_analysis_go_cvterm_add($cvterm_id,$tree_id){
  389. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  390. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  391. $sql = "
  392. SELECT DBX.accession
  393. FROM {cvterm} CVT
  394. INNER JOIN dbxref DBX on DBX.dbxref_id = CVT.dbxref_id
  395. WHERE cvterm_id = %d
  396. ";
  397. $previous_db = tripal_db_set_active('chado');
  398. $xref = db_fetch_object(db_query($sql,$cvterm_id));
  399. tripal_db_set_active($previous_db);
  400. $link = url("download_goterm_features/$cvterm_id/$tree_id");
  401. $options = array(
  402. 'Download sequences' => "<a href=\"$link\">GO_".$xref->accession.".fasta</a>",
  403. );
  404. return $options;
  405. }
  406. /************************************************************************
  407. */
  408. function tripal_analysis_go_get_goterm_features($cvterm_id,$tree_id){
  409. // get hte accession number for this cvterm and use it in naming the download
  410. $sql = "
  411. SELECT DBX.accession
  412. FROM {cvterm} CVT
  413. INNER JOIN dbxref DBX on DBX.dbxref_id = CVT.dbxref_id
  414. WHERE cvterm_id = %d
  415. ";
  416. $previous_db = tripal_db_set_active('chado');
  417. $xref = db_fetch_object(db_query($sql,$cvterm_id));
  418. tripal_db_set_active($previous_db);
  419. drupal_set_header('Content-Type: text');
  420. drupal_set_header('Content-Disposition: attachment; filename="GO_'.$xref->accession.'.fasta"');
  421. $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
  422. $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
  423. $sql = "
  424. SELECT DISTINCT F.name,F.residues,F.feature_id
  425. FROM {cvtermpath} CVTP
  426. INNER JOIN CVTerm CVT1 on CVTP.subject_id = CVT1.cvterm_id
  427. INNER JOIN CVTerm CVT2 on CVTP.object_id = CVT2.cvterm_id
  428. INNER JOIN AnalysisFeatureProp AFP on AFP.type_id = CVTP.subject_id
  429. INNER JOIN AnalysisFeature AF on AF.analysisfeature_id = AFP.analysisfeature_id
  430. INNER JOIN Feature F on AF.feature_id = F.feature_id
  431. WHERE CVTP.object_id = %d and F.organism_id = %d and AF.analysis_id = %d
  432. ORDER BY F.name
  433. ";
  434. $previous_db = tripal_db_set_active('chado');
  435. $results = db_query($sql,$cvterm_id,$organism_id,$analysis_id);
  436. tripal_db_set_active($previous_db);
  437. while($feature = db_fetch_object($results)){
  438. // get the go term information for each sequence
  439. $sql = "
  440. SELECT CVT.name,DBX.accession
  441. FROM {Feature_CVTerm} FCVT
  442. INNER JOIN CVTerm CVT on FCVT.cvterm_id = CVT.cvterm_id
  443. INNER JOIN DBXref DBX on CVT.dbxref_id = DBX.dbxref_id
  444. WHERE FCVT.feature_id = %d
  445. ";
  446. $previous_db = tripal_db_set_active('chado');
  447. $terms = db_query($sql,$feature->feature_id);
  448. tripal_db_set_active($previous_db);
  449. $desc = '[';
  450. while($term = db_fetch_object($terms)){
  451. $desc .= "GO:$term->accession $term->name; ";
  452. }
  453. $desc = chop($desc);
  454. $desc = chop($desc,';');
  455. $desc .= ']';
  456. print tripal_feature_return_fasta($feature, $desc);
  457. }
  458. return;
  459. }
  460. /************************************************************************
  461. */
  462. function tripal_analysis_go_load_feature_terms($feature) {
  463. $sql = "
  464. SELECT DISTINCT FCVT.feature_id,DBX.accession,CVT.name as goterm,
  465. CVT.cvterm_id as go_id, CV.name as cvname, CVT.definition
  466. FROM {Feature_Cvterm} FCVT
  467. INNER JOIN Cvterm CVT ON CVT.cvterm_ID = FCVT.cvterm_ID
  468. INNER JOIN CV ON CV.cv_id = CVT.cv_id
  469. INNER JOIN dbxref DBX ON DBX.dbxref_id = CVT.dbxref_id
  470. WHERE
  471. (CV.name = 'biological_process' OR
  472. CV.name = 'cellular_component' OR
  473. CV.name = 'molecular_function') AND
  474. FCVT.feature_id = %d
  475. ORDER BY CV.name, CVT.name
  476. ";
  477. $previous_db = tripal_db_set_active('chado');
  478. $results = db_query($sql,$feature->feature_id);
  479. tripal_db_set_active($previous_db);
  480. $i=0;
  481. $terms = array();
  482. while($term = db_fetch_object($results)){
  483. $terms[$i++] = $term;
  484. }
  485. return $terms;
  486. }
  487. /*******************************************************************************
  488. * Tripal GO administrative setting form. This function is called by
  489. * tripal_analysis module which asks for an admin form to show on the page
  490. */
  491. function tripal_analysis_go_get_settings() {
  492. // Get an array of node types with internal names as keys
  493. $options = node_get_types('names');
  494. // Add 'chado_feature' to allowed content types for showing unigene results
  495. $allowedoptions ['chado_feature'] = "Show GO terms on feature pages";
  496. $allowedoptions ['chado_organism'] = "Show GO analysis on organism pages";
  497. $form['description'] = array(
  498. '#type' => 'item',
  499. '#value' => t("This option allows user to display the Gene Ontology (GO) ".
  500. "information. For features, this would include all GO terms assigned to a feature ".
  501. "and for organisms this would be statistical pie charts of GO terms for a organism. Check the box to ".
  502. "enable the display of GO information. Uncheck to disable."),
  503. '#weight' => 0,
  504. );
  505. $form['tripal_analysis_go_setting'] = array(
  506. '#type' => 'checkboxes',
  507. '#options' => $allowedoptions,
  508. '#default_value'=>variable_get('tripal_analysis_go_setting',array('chado_feature', 'chado_organism')),
  509. );
  510. $settings->form = $form;
  511. $settings->title = "Tripal GO";
  512. return $settings;
  513. }
  514. /**
  515. *
  516. *
  517. * @ingroup tripal_feature
  518. */
  519. function tripal_analysis_go_job_describe_args($callback,$args){
  520. $new_args = array();
  521. if($callback == 'tripal_analysis_go_load_gaf'){
  522. $new_args['GAF 2.0 file'] = $args[0];
  523. $organism = tripal_core_chado_select('organism',array('genus','species'),array('organism_id' => $args[1]));
  524. $new_args['Organism'] = $organism[0]->genus." ". $organism[0]->species;
  525. $new_args['Sequence Type'] = $args[7];
  526. if(!$args[8]){
  527. $new_args['Use Unique Name'] = 'No';
  528. } else {
  529. $new_args['Use Unique Name'] = 'Yes';
  530. }
  531. // add in the analysis
  532. if($args[2]){
  533. $analysis = tripal_core_chado_select('analysis',array('name'),array('analysis_id' => $args[2]));
  534. }
  535. $new_args['Analysis'] = $analysis[0]->name;
  536. if($args[3]){
  537. $new_args['Function to perform'] = 'Add GO terms';
  538. }
  539. if($args[4]){
  540. $new_args['Function to perform'] = 'Replace GO terms';
  541. }
  542. if($args[5]){
  543. $new_args['Function to perform'] = 'Delete GO terms';
  544. }
  545. $new_args['Regular expression for the feature name'] = $args[6];
  546. }
  547. return $new_args;
  548. }