Skip to content

Commit

Permalink
Minimal antismash file
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuBarba committed Mar 17, 2024
1 parent 9c2234b commit 1b51748
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js/ranking.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ function to_antismash(data) {
tool = {
"name": "synteruptor",
"version": synteruptor_version,
"description": "",
"description": "Synteny breaks explorer",
};
records = [];
for (var br of data) {
subregions = {
"label": "break_" + br["breakid"],
// "start": br["nuc_start1"],
// "end": br["nuc_end1"],
"start": br["loc_start1"],
"end": br["loc_end1"],
}
record = {
"name": br["gpart1"],
Expand Down
15 changes: 14 additions & 1 deletion lib_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,21 @@ function get_ranking_data($dbh) {
$limit = ' LIMIT 10000';
$condition = join(' AND ', $cond);
$order = ' ORDER BY ' . join(', ', $ord);
$query = 'SELECT *, (real_size2 * 100.0 / (real_size1 + real_size2)) AS diff FROM breaks_ranking LEFT JOIN breaks_all ON breaks_ranking.breakid=breaks_all.breakid WHERE ' . $condition . $order . $limit;
$select = 'SELECT breaks_ranking.*, breaks_all.*';
$select .= ', (real_size2 * 100.0 / (real_size1 + real_size2)) AS diff ';
$select .= ', gleft1.loc_start AS loc_start1';
$select .= ', gright1.loc_end AS loc_end1';
$select .= ', gleft2.loc_start AS loc_start2';
$select .= ', gright2.loc_end AS loc_end2';
$from = 'FROM breaks_ranking ';
$joins = 'LEFT JOIN breaks_all ON breaks_ranking.breakid=breaks_all.breakid ';
$joins .= 'LEFT JOIN genes gleft1 ON (pnum_all_left1 = gleft1.pnum_all and breaks_all.sp1 = gleft1.sp) ';
$joins .= 'LEFT JOIN genes gright1 ON (pnum_all_right1 = gright1.pnum_all and breaks_all.sp1 = gright1.sp) ';
$joins .= 'LEFT JOIN genes gleft2 ON (pnum_all_left2 = gleft2.pnum_all and breaks_all.sp2 = gleft2.sp) ';
$joins .= 'LEFT JOIN genes gright2 ON (pnum_all_right2 = gright2.pnum_all and breaks_all.sp2 = gright2.sp) ';
$query = "$select $from $joins WHERE $condition $order $limit";
return get_db_data($dbh, $query, $vals);
return $query;
}

/************************************************************
Expand Down

0 comments on commit 1b51748

Please sign in to comment.