|
@@ -1,12 +1,9 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending, $per_page) {
|
|
function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending, $per_page) {
|
|
- /*
|
|
|
|
- if (!tripal_check_permission_by_analysis_id($analysis_id)) {
|
|
|
|
- $html_out = "Access denied. You are not authorized to access this report.";
|
|
|
|
- return $html_out;
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+ $report_object = new stdClass;
|
|
|
|
+
|
|
$symbol = "∧";
|
|
$symbol = "∧";
|
|
$sort_key = "ASC";
|
|
$sort_key = "ASC";
|
|
if ($descending == 1) {
|
|
if ($descending == 1) {
|
|
@@ -38,12 +35,9 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
WHERE A.analysis_id = %d
|
|
WHERE A.analysis_id = %d
|
|
AND type_id= (SELECT cvterm_id
|
|
AND type_id= (SELECT cvterm_id
|
|
FROM {cvterm}
|
|
FROM {cvterm}
|
|
- WHERE name = 'analysis_blast_settings')";
|
|
|
|
|
|
+ WHERE name = 'analysis_blast_blastdb')";
|
|
$analysis = db_fetch_object(db_query($sql, $analysis_id));
|
|
$analysis = db_fetch_object(db_query($sql, $analysis_id));
|
|
-
|
|
|
|
- // Parse the blast settings
|
|
|
|
- $blastsettings = explode("|", $analysis->value);
|
|
|
|
- $db_id = $blastsettings [0];
|
|
|
|
|
|
+ $db_id = $analysis->value;
|
|
|
|
|
|
// Get db 'urlprefix'
|
|
// Get db 'urlprefix'
|
|
$sql = "SELECT urlprefix FROM {db} WHERE db_id=%d";
|
|
$sql = "SELECT urlprefix FROM {db} WHERE db_id=%d";
|
|
@@ -82,17 +76,15 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
$no_page ++;
|
|
$no_page ++;
|
|
}
|
|
}
|
|
$first_item = ($currentpage - 1)* $per_page;
|
|
$first_item = ($currentpage - 1)* $per_page;
|
|
- $url = url(drupal_get_path('theme', 'tripal')."/images/ajax-loader.gif");
|
|
|
|
- $html_out .= "<div id=\"tripal_ajaxLoading\" style=\"display:none\">".
|
|
|
|
- "<div id=\"loadingText\">Loading...</div>".
|
|
|
|
- "<img src=\"$url\"></div>";
|
|
|
|
- $html_out .= "<div id=\"blast-hits-report\">
|
|
|
|
- <strong>Analysis Date: </strong>$analysis->time (<a href=$ana_url>$analysis->name</a>)<br>
|
|
|
|
- There are <strong>$counter</strong> records. <div id=tripal_blast_report_current_page>page <strong>$currentpage</strong> of <strong>$no_page</strong></div>
|
|
|
|
- <table id=\"tripal_analysi_blast-report-table\" class=\"tripal_analysis_blast-table tripal-table tripal-table-horz\">
|
|
|
|
- <tr class=\"tripal_analysis_blast-table-odd-row tripal-table-odd-row\">";
|
|
|
|
|
|
|
|
- $html_out .= " <th nowrap>"; if ($sort == 0) {$html_out .= $symbol;}
|
|
|
|
|
|
+ $report_object->time = $analysis->time;
|
|
|
|
+ $report_object->name = $analysis->name;
|
|
|
|
+ $report_object->url = $ana_url;
|
|
|
|
+ $report_object->counter = $counter;
|
|
|
|
+ $report_object->currentpage = $currentpage;
|
|
|
|
+ $report_object->no_page = $no_page;
|
|
|
|
+ $report_object->symbol = $symbol;
|
|
|
|
+ $report_object->sort = $sort;
|
|
|
|
|
|
// Construct URL path for different sorting column
|
|
// Construct URL path for different sorting column
|
|
$path = "tripal_blast_report/$analysis_id/1/0/";
|
|
$path = "tripal_blast_report/$analysis_id/1/0/";
|
|
@@ -103,7 +95,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>Query</a></th><th nowrap>"; if ($sort == 1) {$html_out .= $symbol;}
|
|
|
|
|
|
+ $report_object->byQuery = $url_path;
|
|
|
|
|
|
$path = "tripal_blast_report/$analysis_id/1/1/";
|
|
$path = "tripal_blast_report/$analysis_id/1/1/";
|
|
if ($descending == 0 && $sort == 1) {
|
|
if ($descending == 0 && $sort == 1) {
|
|
@@ -113,7 +105,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>Match Name</a></th><th nowrap>"; if ($sort == 2) {$html_out .= $symbol;}
|
|
|
|
|
|
+ $report_object->byMatchName =$url_path;
|
|
|
|
|
|
$path = "tripal_blast_report/$analysis_id/1/2/";
|
|
$path = "tripal_blast_report/$analysis_id/1/2/";
|
|
if ($descending == 0 && $sort == 2) {
|
|
if ($descending == 0 && $sort == 2) {
|
|
@@ -123,7 +115,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>Description</a></th><th nowrap>"; if ($sort == 3) {$html_out .= $symbol;}
|
|
|
|
|
|
+ $report_object->byDescription = $url_path;
|
|
|
|
|
|
$path = "tripal_blast_report/$analysis_id/1/3/";
|
|
$path = "tripal_blast_report/$analysis_id/1/3/";
|
|
if ($descending == 0 && $sort == 3) {
|
|
if ($descending == 0 && $sort == 3) {
|
|
@@ -133,8 +125,8 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>E-value</a></th><th nowrap>"; if ($sort == 4) {$html_out .= $symbol;}
|
|
|
|
-
|
|
|
|
|
|
+ $report_object->byEvalue = $url_path;
|
|
|
|
+
|
|
$path = "tripal_blast_report/$analysis_id/1/4/";
|
|
$path = "tripal_blast_report/$analysis_id/1/4/";
|
|
if ($descending == 0 && $sort == 4) {
|
|
if ($descending == 0 && $sort == 4) {
|
|
$path .= "1";
|
|
$path .= "1";
|
|
@@ -143,7 +135,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>%Identity</a></th><th nowrap>"; if ($sort == 5) {$html_out .= $symbol;}
|
|
|
|
|
|
+ $report_object->byIdentity = $url_path;
|
|
|
|
|
|
$path = "tripal_blast_report/$analysis_id/1/5/";
|
|
$path = "tripal_blast_report/$analysis_id/1/5/";
|
|
if ($descending == 0 && $sort == 5) {
|
|
if ($descending == 0 && $sort == 5) {
|
|
@@ -153,9 +145,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
}
|
|
}
|
|
$path .= "/$per_page";
|
|
$path .= "/$per_page";
|
|
$url_path = url ($path);
|
|
$url_path = url ($path);
|
|
- $html_out.="<a href=$url_path>Length</a></th>";
|
|
|
|
-
|
|
|
|
- $html_out .= "</tr>";
|
|
|
|
|
|
+ $report_object->byLength = $url_path;
|
|
|
|
|
|
// Get table content
|
|
// Get table content
|
|
$sql = "SELECT value
|
|
$sql = "SELECT value
|
|
@@ -163,6 +153,7 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
WHERE analysisfeature_id = %d
|
|
WHERE analysisfeature_id = %d
|
|
AND type_id = (SELECT cvterm_id FROM {cvterm} WHERE name = '%s' AND cv_id = (SELECT cv_id FROM {cv} WHERE name = 'tripal'))";
|
|
AND type_id = (SELECT cvterm_id FROM {cvterm} WHERE name = '%s' AND cv_id = (SELECT cv_id FROM {cv} WHERE name = 'tripal'))";
|
|
$j = 0;
|
|
$j = 0;
|
|
|
|
+ $hits = array ();
|
|
for ($i = $first_item; $i < $first_item +$per_page; $i ++) {
|
|
for ($i = $first_item; $i < $first_item +$per_page; $i ++) {
|
|
$previous_db = tripal_db_set_active('chado');
|
|
$previous_db = tripal_db_set_active('chado');
|
|
$query = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_query'));
|
|
$query = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_query'));
|
|
@@ -181,63 +172,34 @@ function tripal_get_blast_report ($analysis_id, $currentpage, $sort, $descending
|
|
if($j % 2 == 0 ){
|
|
if($j % 2 == 0 ){
|
|
$class = 'tripal_analysis_blast-table-even-row tripal-table-even-row';
|
|
$class = 'tripal_analysis_blast-table-even-row tripal-table-even-row';
|
|
}
|
|
}
|
|
|
|
+ $hit = new stdClass();
|
|
if ($query) {
|
|
if ($query) {
|
|
- $html_out .= "<tr class=\"$class\">
|
|
|
|
- <td nowrap><a href=$q_url>$query</a></td>
|
|
|
|
- <td nowrap><a href=\"$urlprefix$match\" target=\"_blank\">$match</td>
|
|
|
|
- <td>$desc</td>
|
|
|
|
- <td nowrap>$evalue</td>
|
|
|
|
- <td nowrap>$identity</td>
|
|
|
|
- <td nowrap>$length</td>
|
|
|
|
- </tr>";
|
|
|
|
|
|
+ $hit->class = $class;
|
|
|
|
+ $hit->q_url = $q_url;
|
|
|
|
+ $hit->query = $query;
|
|
|
|
+ $hit->urlprefix = $urlprefix;
|
|
|
|
+ $hit->match = $match;
|
|
|
|
+ $hit->desc = $desc;
|
|
|
|
+ $hit->evalue = $evalue;
|
|
|
|
+ $hit->identity = $identity;
|
|
|
|
+ $hit->length = $length;
|
|
|
|
+ $hits [$j] = $hit;
|
|
}
|
|
}
|
|
$j ++;
|
|
$j ++;
|
|
}
|
|
}
|
|
|
|
+ $report_object->hits = $hits;
|
|
|
|
|
|
// The number of items to show on the page
|
|
// The number of items to show on the page
|
|
$path = "tripal_blast_report/$analysis_id/1/$sort/$descending/";
|
|
$path = "tripal_blast_report/$analysis_id/1/$sort/$descending/";
|
|
- $html_out .= '</table>
|
|
|
|
- <div id=tripal_blast_report_per_page>Show ';
|
|
|
|
- if ($per_page == 10) {
|
|
|
|
- $html_out .= "<strong>10</strong> | ";
|
|
|
|
- } else {
|
|
|
|
- $url_path = url($path."10");
|
|
|
|
- $html_out .= "<a href=$url_path>10</a> | ";
|
|
|
|
- }
|
|
|
|
- if ($per_page == 20) {
|
|
|
|
- $html_out .= "<strong>20</strong> | ";
|
|
|
|
- } else {
|
|
|
|
- $url_path = url($path."20");
|
|
|
|
- $html_out .= "<a href=$url_path>20</a> | ";
|
|
|
|
- }
|
|
|
|
- if ($per_page == 50) {
|
|
|
|
- $html_out .= "<strong>50</strong> | ";
|
|
|
|
- } else {
|
|
|
|
- $url_path = url($path."50");
|
|
|
|
- $html_out .= "<a href=$url_path>50</a> | ";
|
|
|
|
- }
|
|
|
|
- if ($per_page == 100) {
|
|
|
|
- $html_out .= "<strong>100</strong> | ";
|
|
|
|
- } else {
|
|
|
|
- $url_path = url($path."100");
|
|
|
|
- $html_out .= "<a href=$url_path>100</a> | ";
|
|
|
|
- }
|
|
|
|
- if ($per_page == 200) {
|
|
|
|
- $html_out .= "<strong>200</strong> | ";
|
|
|
|
- } else {
|
|
|
|
- $url_path = url($path."200");
|
|
|
|
- $html_out .= "<a href=$url_path>200</a>";
|
|
|
|
- }
|
|
|
|
|
|
+ $report_object->path = $path;
|
|
|
|
+ $report_object->per_page = $per_page;
|
|
|
|
|
|
// Make AJAX call to update the page which user selected
|
|
// Make AJAX call to update the page which user selected
|
|
- $html_out .= ' records per page
|
|
|
|
- </div>
|
|
|
|
- <div id=tripal_blast_report_pager>page
|
|
|
|
- <select id=tripal_blast_report_page_selector onChange="tripal_update_best_hit_report(this,'.$analysis_id.','.$sort.','.$descending.','.$per_page.')">';
|
|
|
|
- for ($i = 1; $i <= $no_page; $i ++) {
|
|
|
|
- $html_out .= "<option value=$i>$i</option>";
|
|
|
|
- }
|
|
|
|
- $html_out .= '</select></div>
|
|
|
|
- </div>';
|
|
|
|
- return $html_out;
|
|
|
|
|
|
+ $report_object->analysis_id = $analysis_id;
|
|
|
|
+ $report_object->sort = $sort;
|
|
|
|
+ $report_object->descending = $descending;
|
|
|
|
+ $report_object->per_page = $per_page;
|
|
|
|
+ $report_object->no_page = $no_page;
|
|
|
|
+
|
|
|
|
+ return theme('tripal_analysis_blast_report',$report_object);
|
|
}
|
|
}
|