blast_ui.api.inc 851 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Contains more generally applicable functions as well as some meant to help developers
  5. * Plug-in to the BLAST UI functionality
  6. */
  7. /**
  8. * Returns a list BLAST DATABASE options
  9. *
  10. * @param $type
  11. * The type of BLAST dabases to restrict the list to (ie: n: nucleotide or p: protein)
  12. *
  13. * @return
  14. * An array where the nid is the key and the value is the human-readable name of the option
  15. */
  16. function get_blast_database_options($type) {
  17. // Get all BlastDB nodes
  18. $nodes = node_load_multiple(array(), array('type'=> 'blastdb'));
  19. $options = array();
  20. foreach ($nodes as $node) {
  21. if ( isset($node) && isset($node->db_dbtype) ) {
  22. if ( ($node->db_dbtype == $type) ) {
  23. $options[$node->nid] = $node->db_name;
  24. }
  25. }
  26. }
  27. asort($options);
  28. $options[0] = 'Select a Dataset';
  29. return $options;
  30. }