'blast_report', 'path' => "$path/theme", ); $items['blast_report_alignment_row'] = array( 'template' => 'blast_report_alignment_row', 'variables' => array('hsps' => NULL), 'path' => "$path/theme", ); return $items; } /** * * Implements hook_menu() * */ function blast_ui_menu() { $items['blast'] = array( 'title' => 'BLAST', 'page callback' => 'drupal_get_form', 'page arguments' => array('blast_nucleotide_form'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM, 'expanded' => TRUE, ); $items['blast/report/%'] = array( 'title' => 'BLAST result:', 'page callback' => 'show_blast_output', 'page arguments' => array(2), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); $items['blast/blastn'] = array( 'title' => 'Nucleotide BLAST', 'page callback' => 'drupal_get_form', 'page arguments' => array('blast_nucleotide_form'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM ); $items['blast/blastp'] = array( 'title' => 'Protein BLAST', 'page callback' => 'drupal_get_form', 'page arguments' => array('blast_protein_form'), 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM ); return $items; } /** * Facilitate presenting the result of the blast search * * @param $args * A string containing name of the blast output file. * * @return $result * Return a string containing the blast search output. A link is also provided to let users download the output file. * */ function show_blast_output($args = 'all') { if (preg_match('/^[^\/]*/',$args)) { // Since the blast results are in the files directory we can use public:// to get around hard-coding the full path $full_path_filename = 'public://'.$args; if (file_exists($full_path_filename)) { // $result = t('

BLAST Results: HTML

', array('@url' => url('sites/default/files/' . $args))); // $result .= check_markup(file_get_contents($full_path_filename), 'full_html'); // $result = str_replace('','',$result); $result = theme('show_blast_report'); } else { tripal_report_error( 'blast_ui', TRIPAL_ERROR, 'Unable to open blast results file (%file)', array('%file' => $full_path_filename) ); $result = '

An error was encountered while trying to process your blast results

'; } } else { $result = '

An error was encountered while trying to process your blast results

'; } return $result; }