";var_dump($blastdb);echo ""; // Set ourselves up to do link-out if our blast database is configured to do so. $linkout = FALSE; if ($blastdb->linkout->none === FALSE) { $linkout_type = $blastdb->linkout->type; $linkout_regex = $blastdb->linkout->regex; // Note that URL prefix is not required if linkout type is 'custom' if (isset($blastdb->linkout->db_id->urlprefix) && !empty($blastdb->linkout->db_id->urlprefix)) { $linkout_urlprefix = $blastdb->linkout->db_id->urlprefix; } // Check that we can determine the linkout URL. // (ie: that the function specified to do so, exists). if (function_exists($blastdb->linkout->url_function)) { $url_function = $blastdb->linkout->url_function; $linkout = TRUE; } } // Handle no hits. This following array will hold the names of all query // sequences which didn't have any hits. $query_with_no_hits = array(); // Furthermore, if no query sequences have hits we don't want to bother listing // them all but just want to give a single, all-include "No Results" message. $no_hits = TRUE; ?>

Download: Alignment, Tab-Delimited, XML

"; echo "
    "; foreach($query_def as $row) { echo "
  1. "; echo $row . "
  2. "; } echo "
"; echo ""; include_once("blast_align_image.php"); //display the BLAST command without revealing the internal path $blast_cmd = $job_id_data['program']; foreach($job_id_data['options'] as $key => $value) { $blast_cmd .= ' -' . $key. ' ' . $value ; } print ""; ?>
Input query sequence(s) Target Database selected BLAST command executed
" . $job_id_data['db_name'] . "" . $blast_cmd . "

The following table summarizes the results of your BLAST. Click on a triangle on the left to see the alignment and a visualization of the hit, and click the target name to get more information about the target hit.

array('data' => '', 'class' => array('arrow-col')), 'number' => array('data' => '#', 'class' => array('number')), 'query' => array('data' => 'Query Name (Click for alignment & visualization)', 'class' => array('query')), 'hit' => array('data' => 'Target Name', 'class' => array('hit')), 'evalue' => array('data' => 'E-Value', 'class' => array('evalue')), ); $rows = array(); $count = 0; // Parse the BLAST XML to generate the rows of the table // where each hit results in two rows in the table: 1) A summary of the query/hit and // significance and 2) additional information including the alignment foreach ($xml->{'BlastOutput_iterations'}->children() as $iteration) { $children_count = $iteration->{'Iteration_hits'}->children()->count(); //@deepaksomanadh: Code added for BLAST visualization // parameters that need to be passed for BLAST image generation $target_name = ''; $q_name = $xml->{'BlastOutput_query-def'}; $query_size = $xml->{'BlastOutput_query-len'}; $target_size = $iteration->{'Iteration_stat'}->{'Statistics'}->{'Statistics_db-len'}; if ($children_count != 0) { foreach ($iteration->{'Iteration_hits'}->children() as $hit) { if (is_object($hit)) { $count +=1; $zebra_class = ($count % 2 == 0) ? 'even' : 'odd'; $no_hits = FALSE; // RETRIEVE INFO $hit_name = (preg_match('/BL_ORD_ID/', $hit->{'Hit_id'})) ? $hit->{'Hit_def'} : $hit->{'Hit_id'}; $score = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_score'}; $evalue = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_evalue'}; $query_name = $iteration->{'Iteration_query-def'}; // Round e-val to two decimal values $rounded_evalue = ''; if (strpos($evalue,'e') != false) { $evalue_split = explode('e', $evalue); $rounded_evalue = round($evalue_split[0], 2, PHP_ROUND_HALF_EVEN); $rounded_evalue .= 'e' . $evalue_split[1]; } else { $rounded_evalue = $evalue; } // ALIGNMENT ROW (collapsed by default) // Process HSPs // @deepaksomanadh: Code added for BLAST visualization // hit array and corresponding bit scores // hits=4263001_4262263_1_742;4260037_4259524_895_1411;&scores=722;473; $HSPs = array(); $track_start = INF; $track_end = -1; $hsps_range = ''; $hit_hsps = ''; $hit_hsp_score = ''; $target_size = $hit->{'Hit_len'}; foreach ($hit->{'Hit_hsps'}->children() as $hsp_xml) { $HSPs[] = (array) $hsp_xml; if ($track_start > $hsp_xml->{'Hsp_hit-from'}) { $track_start = $hsp_xml->{'Hsp_hit-from'} . ""; } if ($track_end < $hsp_xml->{'Hsp_hit-to'}) { $track_end = $hsp_xml->{'Hsp_hit-to'} . ""; } } $range_start = (int) $track_start - 50000; $range_end = (int) $track_end + 50000; if ($range_start < 1) $range_start = 1; // For BLAST visualization $target_size = $hit->{'Hit_len'}; foreach ($hit->{'Hit_hsps'}->children() as $hsp_xml) { $hit_hsps .= $hsp_xml->{'Hsp_hit-from'} . '_' . $hsp_xml->{'Hsp_hit-to'} . '_' . $hsp_xml->{'Hsp_query-from'} . '_' . $hsp_xml->{'Hsp_query-to'} . ';'; $Hsp_bit_score .= $hsp_xml->{'Hsp_bit-score'} .';'; } // SUMMARY ROW // If the id is of the form gnl|BL_ORD_ID|### then the parseids flag // to makeblastdb did a really poor job. In this case we want to use // the def to provide the original FASTA header. // If our BLAST DB is configured to handle link-outs then use the // regex & URL prefix provided to create one. $hit_name = $hit->{'Hit_def'}; $query_name = $iteration->{'Iteration_query-def'}; if ($linkout) { //echo "link out regex: $linkout_regex executed on [$hit_name]
"; //preg_match($linkout_regex, $hit_name, $linkout_match); //echo "
matches:
" . var_dump($linkout_match);echo "
"; if (preg_match($linkout_regex, $hit_name, $linkout_match)) { $linkout_id = $linkout_match[1]; $hit->{'linkout_id'} = $linkout_id; $hit->{'hit_name'} = $hit_name; } $hit_url = call_user_func( $url_function, $linkout_urlprefix, $hit, array( 'query_name' => $query_name, 'score' => $score, 'e-value' => $evalue, 'HSPs' => $HSPs, 'Target' => $blastdb->title, ) ); // The linkout id might have been set/changed by the custom linkout code. if ($linkout_type == 'custom' && $hit->{'linkout_id'}) { $linkout_id = $hit->{'linkout_id'}; } if ($hit_url) { /* eksc- l() URL-encodes the URL path too, which is often not what we want. $hit_name = l( $linkout_id, $hit_url, array('attributes' => array('target' => '_blank')) ); */ $hit_name = " $linkout_id "; } }//handle linkout //@deepaksomanadh: Code added for BLAST visualization // get the image and display $hit_img = generateImage($target_name, $Hsp_bit_score, $hit_hsps, $target_size, $query_size, $q_name, $hit_name); ob_start(); // Start buffering the output imagepng($hit_img, null, 0, PNG_NO_FILTER); $b64 = base64_encode(ob_get_contents()); // Get what we've just outputted and base64 it imagedestroy($hit_img); ob_end_clean(); // Print the HTML tag with the image embedded $hit_img = '

Hit Visualization


'; $row = array( 'data' => array( 'arrow-col' => array('data' => '
', 'class' => array('arrow-col')), 'number' => array('data' => $count, 'class' => array('number')), 'query' => array('data' => $query_name, 'class' => array('query')), 'hit' => array('data' => $hit_name, 'class' => array('hit')), 'evalue' => array('data' => $rounded_evalue, 'class' => array('evalue')), 'arrow-col' => array('data' => '
', 'class' => array('arrow-col')) ), 'class' => array('result-summary') ); $rows[] = $row; // ALIGNMENT ROW (collapsed by default) // Process HSPs $row = array( 'data' => array( 'arrow' => '', 'number' => '', 'query' => array( 'data' => theme('blast_report_alignment_row', array('HSPs' => $HSPs)), // 'colspan' => 4, ), 'hit' => array( 'data' => $hit_img, 'colspan' => 3, ), ), 'class' => array('alignment-row', $zebra_class), 'no_striping' => TRUE ); $rows[] = $row; }//end of if - checks $hit }//end of foreach - iteration_hits }//end of if - check for iteration_hits else { // Currently where the "no results" is added. $query_name = $iteration->{'Iteration_query-def'}; $query_with_no_hits[] = $query_name; }//no results }//end of foreach - BlastOutput_iterations if ($no_hits) { print '

No results found.

'; } else { // We want to warn the user if some of their query sequences had no hits. if (!empty($query_with_no_hits)) { print '

Some of your query sequences did not ' . 'match to the database/template. They are: ' . implode(', ', $query_with_no_hits) . '.

'; } // Actually print the table. if (!empty($rows)) { print theme('table', array( 'header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'blast_report'), )); } }//handle no hits }//XML exists else { drupal_set_title('BLAST: Error Encountered'); print '

We encountered an error and are unable to load your BLAST results.

'; } ?>

Edit this query and re-submit