|  | @@ -63,59 +63,72 @@ if ($xml) {
 | 
											
												
													
														|  |    // where each hit results in two rows in the table: 1) A summary of the query/hit and
 |  |    // 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
 |  |    // significance and 2) additional information including the alignment
 | 
											
												
													
														|  |    foreach($xml->{'BlastOutput_iterations'}->children() as $iteration) {
 |  |    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
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        // If the id is of the form gnl|BL_ORD_ID|### then the parseids flag
 |  | 
 | 
											
												
													
														|  | -        // to makeblastdb did a really poor job. In thhis case we want to use
 |  | 
 | 
											
												
													
														|  | -        // the def to provide the original FASTA header.
 |  | 
 | 
											
												
													
														|  | -        $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'};
 |  | 
 | 
											
												
													
														|  | 
 |  | +    $children_count = $iteration->{'Iteration_hits'}->children()->count();
 | 
											
												
													
														|  | 
 |  | +    if($children_count != 0) {
 | 
											
												
													
														|  | 
 |  | +      foreach($iteration->{'Iteration_hits'}->children() as $hit) {
 | 
											
												
													
														|  | 
 |  | +	if (is_object($hit)) {
 | 
											
												
													
														|  | 
 |  | +	  $count +=1;
 | 
											
												
													
														|  | 
 |  | +   	  $zebra_class = ($count % 2 == 0) ? 'even' : 'odd';
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	  // 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 thhis case we want to use
 | 
											
												
													
														|  | 
 |  | +	  // the def to provide the original FASTA header.
 | 
											
												
													
														|  | 
 |  | +	  $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'};
 | 
											
												
													
														|  | 
 |  | +          
 | 
											
												
													
														|  | 
 |  | +	  $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;
 | 
											
												
													
														|  | 
 |  | +	 }// end of if - checks $hit
 | 
											
												
													
														|  | 
 |  | +      } //end of foreach - iteration_hits
 | 
											
												
													
														|  | 
 |  | +    }	// end of if - check for iteration_hits
 | 
											
												
													
														|  | 
 |  | +    else {
 | 
											
												
													
														|  | 
 |  | +	$count +=1;
 | 
											
												
													
														|  | 
 |  | +        $query_id = $iteration->{'Iteration_query-ID'};
 | 
											
												
													
														|  |          $query_name = $iteration->{'Iteration_query-def'};
 |  |          $query_name = $iteration->{'Iteration_query-def'};
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |          $row = array(
 |  |          $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')
 |  | 
 | 
											
												
													
														|  | -        );
 |  | 
 | 
											
												
													
														|  | 
 |  | +                'data' => array(
 | 
											
												
													
														|  | 
 |  | +                   'number' => array('data' => $count , 'class' => array('number')),
 | 
											
												
													
														|  | 
 |  | +                   'query' => array('data' => $query_name, 'class' => array('query')),
 | 
											
												
													
														|  | 
 |  | +                   'hit' => array('data' =>  $iteration->{'Iteration_message'}, 'class' => array('hit')),
 | 
											
												
													
														|  | 
 |  | +                   'evalue' => array('data' => "-", 'class' => array('evalue')),
 | 
											
												
													
														|  | 
 |  | +                   'arrow-col' => array('data' => '', 'class' => array('arrow-col'))
 | 
											
												
													
														|  | 
 |  | +                ),
 | 
											
												
													
														|  | 
 |  | +                'class' => array('result-summary')
 | 
											
												
													
														|  | 
 |  | +            );
 | 
											
												
													
														|  |          $rows[] = $row;
 |  |          $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;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -      }
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | 
 |  | +		} // end of else		
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |    print theme('table', array(
 |  |    print theme('table', array(
 | 
											
												
													
														|  |        'header' => $header,
 |  |        'header' => $header,
 | 
											
												
													
														|  |        'rows' => $rows,
 |  |        'rows' => $rows,
 |