@@ -177,6 +177,7 @@ $(function() {
177
177
xmax : - Infinity ,
178
178
sense : null ,
179
179
anti : null ,
180
+ swapped : false ,
180
181
composites : null ,
181
182
scale : 1 ,
182
183
baseline : 0 ,
@@ -463,8 +464,7 @@ $(function() {
463
464
hide_strand_col = secondary_row . append ( "td" )
464
465
. classed ( "hide-strand-col" , true )
465
466
. attr ( "colspan" , "3" )
466
- . style ( "white-space" , "nowrap" ) ,
467
- secondary_row . append ( "td" )
467
+ swap_senses_col = secondary_row . append ( "td" )
468
468
reset_col = secondary_row . append ( "td" )
469
469
. classed ( "reset-col" , true ) ;
470
470
@@ -498,7 +498,6 @@ $(function() {
498
498
forward = hide_strand_col . append ( "div" )
499
499
. attr ( "title" , "forward" )
500
500
. style ( "float" , "left" )
501
- . style ( "margin-left" , "10%" )
502
501
. style ( "margin-right" , "15px" )
503
502
forward . append ( "label" )
504
503
. text ( "Show forward:" )
@@ -513,9 +512,11 @@ $(function() {
513
512
} )
514
513
reverse = hide_strand_col . append ( "div" )
515
514
. attr ( "title" , "reverse" )
515
+ . style ( "width" , "initial" )
516
516
reverse . append ( "label" )
517
517
. text ( "Show reverse:" )
518
518
. style ( "display" , "inline" )
519
+ . style ( "white-space" , "nowrap" )
519
520
reverse . append ( "input" )
520
521
. attr ( "type" , "checkbox" )
521
522
. property ( "checked" , true )
@@ -526,6 +527,18 @@ $(function() {
526
527
self . toggle_reverse ( ! d3 . select ( this ) . property ( "checked" ) ) ;
527
528
} )
528
529
530
+ swap_senses_col . append ( "label" )
531
+ . attr ( "for" , "swap_senses_checkbox" )
532
+ . text ( "Swap sense and antisense" )
533
+ swap_senses_col . append ( "input" )
534
+ . attr ( "type" , "checkbox" )
535
+ . attr ( "id" , "swap-senses-checkbox" )
536
+ . property ( "checked" , false )
537
+ . style ( "transform" , "scale(1.2)" )
538
+ . on ( "input" , function ( ) {
539
+ self . swap_senses ( d3 . select ( this ) . property ( "checked" ) ) ;
540
+ } ) ;
541
+
529
542
//Add reset button
530
543
reset_col . append ( "input" )
531
544
. attr ( "type" , "button" )
@@ -854,6 +867,15 @@ $(function() {
854
867
this . plot_composite ( )
855
868
} ,
856
869
870
+ swap_senses : function ( swapped ) {
871
+ this . swapped = swapped ;
872
+ let temp = this . sense ;
873
+ this . sense = this . anti ;
874
+ this . anti = temp ;
875
+ d3 . select ( swap_senses_col . node ( ) ) . select ( "#swap-senses-checkbox" ) . property ( "checked" , swapped ) ;
876
+ this . plot_composite ( )
877
+ } ,
878
+
857
879
//Changes baseline occupancy, adjusting slider for plot scale
858
880
change_baseline : function ( new_baseline , plot = true ) {
859
881
if ( isNaN ( new_baseline ) ) {
@@ -940,6 +962,7 @@ $(function() {
940
962
this . xmax = - Infinity ;
941
963
this . sense = null ;
942
964
this . anti = null ;
965
+ this . swapped = false ;
943
966
this . options . name = "Composite " + this . options . idx ;
944
967
this . scale = 1 ;
945
968
this . baseline = 0 ;
@@ -968,6 +991,7 @@ $(function() {
968
991
xmax : this . xmax ,
969
992
sense : this . sense ,
970
993
anti : this . anti ,
994
+ swapped : this . swapped ,
971
995
color : this . options . color ,
972
996
secondary_color : this . secondary_color ,
973
997
scale : this . scale ,
@@ -1028,6 +1052,9 @@ $(function() {
1028
1052
if ( "anti" in data ) {
1029
1053
this . anti = data . anti
1030
1054
} ;
1055
+ if ( "swapped" in data ) {
1056
+ this . swap_senses ( data . swapped )
1057
+ } ;
1031
1058
if ( "baseline" in data ) {
1032
1059
this . baseline = data . baseline
1033
1060
} ;
0 commit comments