tripal_analysis_go.module 22 KB

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