value); $db_id = $blastsettings [0]; // Get db 'urlprefix' $sql = "SELECT urlprefix FROM {db} WHERE db_id=%d"; $urlprefix = db_result(db_query($sql, $db_id)); // Get all analysisfeature_id's sorted by the selected header for this blast analysis $sql = "SELECT AFP.analysisfeature_id FROM {analysisfeature} AF INNER JOIN {analysisfeatureprop} AFP ON AF.analysisfeature_id = AFP.analysisfeature_id WHERE analysis_id = %d AND AFP.type_id = (SELECT cvterm_id FROM {cvterm} WHERE name = '%s' AND cv_id = (SELECT cv_id FROM {cv} WHERE name = 'tripal')) ORDER BY value "; // Convert string to number for evalue, %identity, and length before SQL sorting if ($convert == 1) { $sql .= "::numeric "; } $sql .= "$sort_key"; $result = db_query($sql, $analysis_id, $header); tripal_db_set_active($previous_db); $analysisfeatureSet = array(); // Count how many analysisfeature_id we have and store them in order in $analysisfeatureSet $counter = 0; while ($feature = db_fetch_object($result)) { $analysisfeatureSet [$counter] = $feature->analysisfeature_id; $counter ++; } // Get analysis node id $ana_nid = db_result(db_query("SELECT nid FROM {chado_analysis} WHERE analysis_id = %d", $analysis_id)); $ana_url = url("node/".$ana_nid); // Get pager info $no_page = (int) ($counter / $per_page); if ($counter % $per_page != 0) { $no_page ++; } $first_item = ($currentpage - 1)* $per_page; $url = url(drupal_get_path('theme', 'tripal')."/images/ajax-loader.gif"); $html_out .= "
". "
Loading...
". "
"; $html_out .= "
Analysis Date: $analysis->time ($analysis->name)
There are $counter records.
page $currentpage of $no_page
"; $html_out .= " "; $html_out .= ""; // Get table content $sql = "SELECT value FROM {analysisfeatureprop} 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'))"; $j = 0; for ($i = $first_item; $i < $first_item +$per_page; $i ++) { $previous_db = tripal_db_set_active('chado'); $query = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_query')); $match = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_match')); $desc = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_description')); $evalue = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_evalue')); $identity = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_identity')); $length = db_result(db_query($sql, $analysisfeatureSet[$i], 'analysis_blast_besthit_length')); $sql_fid = "SELECT feature_id FROM analysisfeature WHERE analysisfeature_id = %d"; $fid = db_result(db_query($sql_fid, $analysisfeatureSet[$i])); tripal_db_set_active($previous_db); $q_url = url("ID$fid"); $class = 'tripal_analysis_blast-table-odd-row tripal-table-odd-row'; if($j % 2 == 0 ){ $class = 'tripal_analysis_blast-table-even-row tripal-table-even-row'; } if ($query) { $html_out .= ""; } $j ++; } // The number of items to show on the page $path = "tripal_blast_report/$analysis_id/1/$sort/$descending/"; $html_out .= '
"; if ($sort == 0) {$html_out .= $symbol;} // Construct URL path for different sorting column $path = "tripal_blast_report/$analysis_id/1/0/"; if ($descending == 0 && $sort == 0) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="Query"; if ($sort == 1) {$html_out .= $symbol;} $path = "tripal_blast_report/$analysis_id/1/1/"; if ($descending == 0 && $sort == 1) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="Match Name"; if ($sort == 2) {$html_out .= $symbol;} $path = "tripal_blast_report/$analysis_id/1/2/"; if ($descending == 0 && $sort == 2) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="Description"; if ($sort == 3) {$html_out .= $symbol;} $path = "tripal_blast_report/$analysis_id/1/3/"; if ($descending == 0 && $sort == 3) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="E-value"; if ($sort == 4) {$html_out .= $symbol;} $path = "tripal_blast_report/$analysis_id/1/4/"; if ($descending == 0 && $sort == 4) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="%Identity"; if ($sort == 5) {$html_out .= $symbol;} $path = "tripal_blast_report/$analysis_id/1/5/"; if ($descending == 0 && $sort == 5) { $path .= "1"; } else { $path .= "0"; } $path .= "/$per_page"; $url_path = url ($path); $html_out.="Length
$query $match $desc $evalue $identity $length
Show '; if ($per_page == 10) { $html_out .= "10 | "; } else { $url_path = url($path."10"); $html_out .= "10 | "; } if ($per_page == 20) { $html_out .= "20 | "; } else { $url_path = url($path."20"); $html_out .= "20 | "; } if ($per_page == 50) { $html_out .= "50 | "; } else { $url_path = url($path."50"); $html_out .= "50 | "; } if ($per_page == 100) { $html_out .= "100 | "; } else { $url_path = url($path."100"); $html_out .= "100 | "; } if ($per_page == 200) { $html_out .= "200 | "; } else { $url_path = url($path."200"); $html_out .= "200"; } // Make AJAX call to update the page which user selected $html_out .= ' records per page
page
'; return $html_out; }