Skip to content

Commit f554f3a

Browse files
added swap senses checkbox
1 parent 2845eb7 commit f554f3a

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

js/widgets/settings_table.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ $(function() {
176176
xmax: -Infinity,
177177
sense: null,
178178
anti: null,
179+
swapped: false,
179180
composites: null,
180181
scale: 1,
181182
baseline: 0,
@@ -462,8 +463,7 @@ $(function() {
462463
hide_strand_col = secondary_row.append("td")
463464
.classed("hide-strand-col", true)
464465
.attr("colspan", "3")
465-
.style("white-space", "nowrap"),
466-
secondary_row.append("td")
466+
swap_senses_col = secondary_row.append("td")
467467
reset_col = secondary_row.append("td")
468468
.classed("reset-col", true);
469469

@@ -497,7 +497,6 @@ $(function() {
497497
forward = hide_strand_col.append("div")
498498
.attr("title", "forward")
499499
.style("float", "left")
500-
.style("margin-left", "10%")
501500
.style("margin-right", "15px")
502501
forward.append("label")
503502
.text("Show forward:")
@@ -512,9 +511,11 @@ $(function() {
512511
})
513512
reverse = hide_strand_col.append("div")
514513
.attr("title", "reverse")
514+
.style("width", "initial")
515515
reverse.append("label")
516516
.text("Show reverse:")
517517
.style("display", "inline")
518+
.style("white-space", "nowrap")
518519
reverse.append("input")
519520
.attr("type", "checkbox")
520521
.property("checked", true)
@@ -525,6 +526,18 @@ $(function() {
525526
self.toggle_reverse(!d3.select(this).property("checked"));
526527
})
527528

529+
swap_senses_col.append("label")
530+
.attr("for", "swap_senses_checkbox")
531+
.text("Swap sense and antisense")
532+
swap_senses_col.append("input")
533+
.attr("type", "checkbox")
534+
.attr("id", "swap-senses-checkbox")
535+
.property("checked", false)
536+
.style("transform", "scale(1.2)")
537+
.on("input", function() {
538+
self.swap_senses(d3.select(this).property("checked"));
539+
});
540+
528541
//Add reset button
529542
reset_col.append("input")
530543
.attr("type", "button")
@@ -853,6 +866,15 @@ $(function() {
853866
this.plot_composite()
854867
},
855868

869+
swap_senses: function(swapped){
870+
this.swapped = swapped;
871+
let temp = this.sense;
872+
this.sense = this.anti;
873+
this.anti = temp;
874+
d3.select(swap_senses_col.node()).select("#swap-senses-checkbox").property("checked", swapped);
875+
this.plot_composite()
876+
},
877+
856878
//Changes baseline occupancy, adjusting slider for plot scale
857879
change_baseline: function(new_baseline, plot=true){
858880
if (isNaN(new_baseline)) {
@@ -939,6 +961,7 @@ $(function() {
939961
this.xmax = -Infinity;
940962
this.sense = null;
941963
this.anti = null;
964+
this.swapped = false;
942965
this.options.name = "Composite " + this.options.idx;
943966
this.scale = 1;
944967
this.baseline = 0;
@@ -967,6 +990,7 @@ $(function() {
967990
xmax: this.xmax,
968991
sense: this.sense,
969992
anti: this.anti,
993+
swapped: this.swapped,
970994
color: this.options.color,
971995
secondary_color: this.secondary_color,
972996
scale: this.scale,
@@ -1027,6 +1051,9 @@ $(function() {
10271051
if ("anti" in data) {
10281052
this.anti = data.anti
10291053
};
1054+
if ("swapped" in data) {
1055+
this.swap_senses(data.swapped)
1056+
};
10301057
if ("baseline" in data) {
10311058
this.baseline = data.baseline
10321059
};

0 commit comments

Comments
 (0)