tripal_analysis_go.module 22 KB

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