|
@@ -27,6 +27,9 @@
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
+<p>The following table summarizes the results of your BLAST. To see additional information
|
|
|
+about each hit including the alignment, click on that row in the table to expand it.</p>
|
|
|
+
|
|
|
<?php
|
|
|
|
|
|
// Load the XML file
|
|
@@ -37,76 +40,79 @@ $xml = simplexml_load_file($xml_filename);
|
|
|
* @see theme_table() for additional documentation
|
|
|
*/
|
|
|
|
|
|
-// Specify the header of the table
|
|
|
-$header = array(
|
|
|
- 'number' => array('data' => '#', 'class' => array('number')),
|
|
|
- 'query' => array('data' => 'Query Name', 'class' => array('query')),
|
|
|
- 'hit' => array('data' => 'Hit Name', 'class' => array('hit')),
|
|
|
- 'evalue' => array('data' => 'E-Value', 'class' => array('evalue')),
|
|
|
- 'arrow-col' => array('data' => '', 'class' => array('arrow-col'))
|
|
|
-);
|
|
|
-
|
|
|
-$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) {
|
|
|
- foreach($iteration->{'Iteration_hits'}->children() as $hit) {
|
|
|
- if (is_object($hit)) {
|
|
|
- $count +=1;
|
|
|
-
|
|
|
- $zebra_class = ($count % 2 == 0) ? 'even' : 'odd';
|
|
|
-
|
|
|
- // SUMMARY ROW
|
|
|
- $hit_name = $hit->Hit_def;
|
|
|
- if (preg_match('/(\w+)/', $hit_name, $matches)) {
|
|
|
- $hit_name = $matches[1];
|
|
|
- }
|
|
|
- $score = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_score'};
|
|
|
- $evalue = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_evalue'};
|
|
|
- $query_name = $iteration->{'Iteration_query-def'};
|
|
|
-
|
|
|
- $row = array(
|
|
|
- 'data' => array(
|
|
|
- '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' => $evalue, 'class' => array('evalue')),
|
|
|
- 'arrow-col' => array('data' => '<div class="arrow"></div>', 'class' => array('arrow-col'))
|
|
|
- ),
|
|
|
- 'class' => array('result-summary')
|
|
|
- );
|
|
|
- $rows[] = $row;
|
|
|
-
|
|
|
- // ALIGNMENT ROW (collapsed by default)
|
|
|
- // Process HSPs
|
|
|
- $HSPs = array();
|
|
|
- foreach ($hit->{'Hit_hsps'}->children() as $hsp_xml) {
|
|
|
- $HSPs[] = (array) $hsp_xml;
|
|
|
- }
|
|
|
-
|
|
|
- $row = array(
|
|
|
- 'data' => array(
|
|
|
- 'number' => '',
|
|
|
- 'query' => array(
|
|
|
- 'data' => theme('blast_report_alignment_row', array('HSPs' => $HSPs)),
|
|
|
- 'colspan' => 4,
|
|
|
- )
|
|
|
- ),
|
|
|
- 'class' => array('alignment-row', $zebra_class),
|
|
|
- 'no_striping' => TRUE
|
|
|
- );
|
|
|
- $rows[] = $row;
|
|
|
+if ($xml) {
|
|
|
+ // Specify the header of the table
|
|
|
+ $header = array(
|
|
|
+ 'number' => array('data' => '#', 'class' => array('number')),
|
|
|
+ 'query' => array('data' => 'Query Name', 'class' => array('query')),
|
|
|
+ 'hit' => array('data' => 'Hit Name', 'class' => array('hit')),
|
|
|
+ 'evalue' => array('data' => 'E-Value', 'class' => array('evalue')),
|
|
|
+ 'arrow-col' => array('data' => '', 'class' => array('arrow-col'))
|
|
|
+ );
|
|
|
+
|
|
|
+ $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) {
|
|
|
+ foreach($iteration->{'Iteration_hits'}->children() as $hit) {
|
|
|
+ if (is_object($hit)) {
|
|
|
+ $count +=1;
|
|
|
+
|
|
|
+ $zebra_class = ($count % 2 == 0) ? 'even' : 'odd';
|
|
|
+
|
|
|
+ // SUMMARY ROW
|
|
|
+ $hit_name = $hit->Hit_id;
|
|
|
+ $score = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_score'};
|
|
|
+ $evalue = $hit->{'Hit_hsps'}->{'Hsp'}->{'Hsp_evalue'};
|
|
|
+ $query_name = $iteration->{'Iteration_query-def'};
|
|
|
+
|
|
|
+ $row = array(
|
|
|
+ 'data' => array(
|
|
|
+ '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' => $evalue, 'class' => array('evalue')),
|
|
|
+ 'arrow-col' => array('data' => '<div class="arrow"></div>', 'class' => array('arrow-col'))
|
|
|
+ ),
|
|
|
+ 'class' => array('result-summary')
|
|
|
+ );
|
|
|
+ $rows[] = $row;
|
|
|
+
|
|
|
+ // ALIGNMENT ROW (collapsed by default)
|
|
|
+ // Process HSPs
|
|
|
+ $HSPs = array();
|
|
|
+ foreach ($hit->{'Hit_hsps'}->children() as $hsp_xml) {
|
|
|
+ $HSPs[] = (array) $hsp_xml;
|
|
|
+ }
|
|
|
+
|
|
|
+ $row = array(
|
|
|
+ 'data' => array(
|
|
|
+ 'number' => '',
|
|
|
+ 'query' => array(
|
|
|
+ 'data' => theme('blast_report_alignment_row', array('HSPs' => $HSPs)),
|
|
|
+ 'colspan' => 4,
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ 'class' => array('alignment-row', $zebra_class),
|
|
|
+ 'no_striping' => TRUE
|
|
|
+ );
|
|
|
+ $rows[] = $row;
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-print theme('table', array(
|
|
|
- 'header' => $header,
|
|
|
- 'rows' => $rows,
|
|
|
- 'attributes' => array('id' => 'blast_report'),
|
|
|
- ));
|
|
|
+ print theme('table', array(
|
|
|
+ 'header' => $header,
|
|
|
+ 'rows' => $rows,
|
|
|
+ 'attributes' => array('id' => 'blast_report'),
|
|
|
+ ));
|
|
|
+}
|
|
|
+else {
|
|
|
+ drupal_set_title('BLAST: Error Encountered');
|
|
|
+ print '<p>We encountered an error and are unable to load your BLAST results.</p>';
|
|
|
+}
|
|
|
?>
|