@@ -177,6 +177,7 @@ $(function() {
177177 xmax : - Infinity ,
178178 sense : null ,
179179 anti : null ,
180+ swapped : false ,
180181 composites : null ,
181182 scale : 1 ,
182183 baseline : 0 ,
@@ -463,8 +464,7 @@ $(function() {
463464 hide_strand_col = secondary_row . append ( "td" )
464465 . classed ( "hide-strand-col" , true )
465466 . attr ( "colspan" , "3" )
466- . style ( "white-space" , "nowrap" ) ,
467- secondary_row . append ( "td" )
467+ swap_senses_col = secondary_row . append ( "td" )
468468 reset_col = secondary_row . append ( "td" )
469469 . classed ( "reset-col" , true ) ;
470470
@@ -498,7 +498,6 @@ $(function() {
498498 forward = hide_strand_col . append ( "div" )
499499 . attr ( "title" , "forward" )
500500 . style ( "float" , "left" )
501- . style ( "margin-left" , "10%" )
502501 . style ( "margin-right" , "15px" )
503502 forward . append ( "label" )
504503 . text ( "Show forward:" )
@@ -513,9 +512,11 @@ $(function() {
513512 } )
514513 reverse = hide_strand_col . append ( "div" )
515514 . attr ( "title" , "reverse" )
515+ . style ( "width" , "initial" )
516516 reverse . append ( "label" )
517517 . text ( "Show reverse:" )
518518 . style ( "display" , "inline" )
519+ . style ( "white-space" , "nowrap" )
519520 reverse . append ( "input" )
520521 . attr ( "type" , "checkbox" )
521522 . property ( "checked" , true )
@@ -526,6 +527,18 @@ $(function() {
526527 self . toggle_reverse ( ! d3 . select ( this ) . property ( "checked" ) ) ;
527528 } )
528529
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+
529542 //Add reset button
530543 reset_col . append ( "input" )
531544 . attr ( "type" , "button" )
@@ -854,6 +867,15 @@ $(function() {
854867 this . plot_composite ( )
855868 } ,
856869
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+
857879 //Changes baseline occupancy, adjusting slider for plot scale
858880 change_baseline : function ( new_baseline , plot = true ) {
859881 if ( isNaN ( new_baseline ) ) {
@@ -940,6 +962,7 @@ $(function() {
940962 this . xmax = - Infinity ;
941963 this . sense = null ;
942964 this . anti = null ;
965+ this . swapped = false ;
943966 this . options . name = "Composite " + this . options . idx ;
944967 this . scale = 1 ;
945968 this . baseline = 0 ;
@@ -968,6 +991,7 @@ $(function() {
968991 xmax : this . xmax ,
969992 sense : this . sense ,
970993 anti : this . anti ,
994+ swapped : this . swapped ,
971995 color : this . options . color ,
972996 secondary_color : this . secondary_color ,
973997 scale : this . scale ,
@@ -1028,6 +1052,9 @@ $(function() {
10281052 if ( "anti" in data ) {
10291053 this . anti = data . anti
10301054 } ;
1055+ if ( "swapped" in data ) {
1056+ this . swap_senses ( data . swapped )
1057+ } ;
10311058 if ( "baseline" in data ) {
10321059 this . baseline = data . baseline
10331060 } ;
0 commit comments