blast_ui.custom.inc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * customized for PeanutBase
  4. *
  5. */
  6. function tripal_custom_generate_linkout($url_prefix, $hit, $info, $options = array()) {
  7. // uncomment to see contents of hit object
  8. //echo "hit:<pre>";var_dump($hit);echo "</pre>";
  9. // uncomment to see contents of info object
  10. //echo "info:<pre>";var_dump($info);echo "</pre>";
  11. $hit_name = $hit->{'Hit_def'};
  12. if ($info['Target'] == 'All genomes') {
  13. if (preg_match('/.*(aradu).*/i', $hit_name) == 1) {
  14. $hit->{'linkout_id'} = $hit_name;
  15. $url_prefix = "\gbrowse_aradu1.0?";
  16. $url = tripal_blast_generate_linkout_gbrowse($url_prefix, $hit, $info, $options);
  17. }
  18. else if (preg_match('/.*(araip).*/i', $hit_name) == 1) {
  19. $hit->{'linkout_id'} = $hit_name;
  20. $url_prefix = "\gbrowse_araip1.0?";
  21. $url = tripal_blast_generate_linkout_gbrowse($url_prefix, $hit, $info, $options);
  22. }
  23. }//handle All genomes BLAST target
  24. else {
  25. if (preg_match('/.*(aradu).*/i', $hit_name) == 1) {
  26. preg_match("/\w+\.(\w+\.\w+)/", $hit_name, $linkout_match);
  27. $linkout_id = $linkout_match[1];
  28. $hit->{'linkout_id'} = $linkout_id;
  29. $url = "/gbrowse_aradu1.0?query=q=$linkout_id;h_feat=$linkout_id";
  30. }
  31. else if(preg_match('/.*(araip).*/i', $hit_name) == 1) {
  32. preg_match("/\w+\.(\w+\.\w+)/", $hit_name, $linkout_match);
  33. $linkout_id = $linkout_match[1];
  34. $hit->{'linkout_id'} = $linkout_id;
  35. $url = "/gbrowse_araip1.0?query=q=$linkout_id;h_feat=$linkout_id";
  36. }
  37. else if(preg_match('/.*(phytozome).*/i', $hit_name) == 1) {
  38. preg_match("/(.*?)\s.*/", $hit_name, $linkout_match);
  39. $linkout_id = $linkout_match[1];
  40. $hit->{'linkout_id'} = $linkout_id;
  41. $url = "http://legumeinfo.org/chado_phylotree/$linkout_id";
  42. }
  43. else {
  44. // Don't know what to do with this hit
  45. drupal_set_message("Don't know how to create linkout for $hit_name", 'error');
  46. $url = false;
  47. }
  48. }//handle remaining BLAST targets
  49. return "$url";
  50. }