@@ -11,7 +11,7 @@ import { createGenomeTrack, createWiggleTracks, createDetailTSSTrack, createBinn
1111 * @param {Array } props.data - The data used for visualization.
1212 * @returns {JSX.Element } - The rendered genome visualization component.
1313 */
14- function AlignedGenomeViz ( { dataGosling, filter, filePath, gosRef, maxValueWiggleDict, allowFetch , allowWiggleVisualization, widthTrack } ) {
14+ function AlignedGenomeViz ( { dataGosling, filter, filePath, gosRef, maxValueWiggleDict, allowWiggleVisualization, widthTrack } ) {
1515
1616
1717 const createTSSTrack = ( binSizes , strand , maxGenome , title , filePath , maxValueGenome ) => {
@@ -27,18 +27,18 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
2727 }
2828 } )
2929 let binnedViews = sizesBins . map ( ( { GT , LT , size, maxValueBin } ) => createBinnedView ( filePath , size , maxValueBin , filter , strand , GT , LT , "aligned" , title ) ) ;
30- let specsWiggle = [ ]
31- if ( allowWiggleVisualization ) {
32- specsWiggle = createWiggleTracks ( strand , title , filePath , widthTrack )
33- specsWiggle . map ( spec => {
34- let [ strand , genome , type ] = spec [ "id" ] . split ( "_" ) . slice ( 2 )
35- let genomeID = genome . replace ( / - / g, "_" )
36- let strandID = strand === "+" ? "Plus" : "Minus"
37- let maxValuesTemp = maxValueWiggleDict ?. [ genomeID ] ?. [ strandID ] || 100 ;
38- spec [ "y" ] [ "domain" ] = [ 0 , maxValuesTemp ]
39- } )
40- }
4130 let detailTSSTrack = createDetailTSSTrack ( filePath , strand , filter , TSS_DETAIL_LEVEL_ZOOM , "aligned" , genomeName )
31+ let specsWiggle = [ ]
32+ if ( allowWiggleVisualization ) {
33+ specsWiggle = createWiggleTracks ( strand , title , filePath , widthTrack )
34+ specsWiggle . map ( spec => {
35+ let [ strand , genome , type ] = spec [ "id" ] . split ( "_" ) . slice ( 2 )
36+ let genomeID = genome . replace ( / - / g, "_" )
37+ let strandID = strand === "+" ? "Plus" : "Minus"
38+ let maxValuesTemp = maxValueWiggleDict ?. [ genomeID ] ?. [ strandID ] || 100 ;
39+ spec [ "y" ] [ "domain" ] = [ 0 , maxValuesTemp ]
40+ } )
41+ }
4242 return [
4343 {
4444 "spacing" : 0 ,
@@ -48,15 +48,12 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
4848 "genomicFields" : [ "binStart" , "binEnd" ] ,
4949 "sampleLength" : 100000
5050 } ,
51- "zoomLimits" : [ 50 , maxValueGenome ] ,
52-
5351 "alignment" : "overlay" ,
52+ "zoomLimits" : [ 50 , Math . round ( maxValueGenome ) ] ,
5453 "tracks" : [
5554 detailTSSTrack ,
5655 ...binnedViews ,
5756 ...specsWiggle
58-
59-
6057 ]
6158 }
6259
@@ -95,9 +92,7 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
9592 for ( let strand of [ "+" , "-" ] ) {
9693 let tempView = {
9794 "alignment" : "stack" ,
98- // "title": `${genome}${strand}`,
9995 "assembly" : [ [ genome , data [ genome ] [ "lengthGenome" ] ] ] ,
100- "spacing" : 0 ,
10196 "layout" : "linear" ,
10297 "tracks" : createTracks ( filePath , data [ genome ] , genome , data [ genome ] [ "lengthGenome" ] , strand , maxValueGenome )
10398 }
@@ -121,6 +116,7 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
121116 // Zip views
122117 let zippedViews = viewsForward . map ( ( view , index ) => {
123118 return {
119+ spacing : 0 ,
124120 "arrangement" : "horizontal" ,
125121 "views" : [ viewsReverse [ index ] , view ]
126122 } } )
@@ -129,7 +125,7 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
129125
130126
131127
132- const createSpecsGosling = ( dataGosling , filePath , maxValueWiggleDict , filter , allowFetch ) => {
128+ const createSpecsGosling = ( dataGosling , filePath , maxValueWiggleDict , filter ) => {
133129 const data = dataGosling . current
134130 const maxValue = Math . max ( ...Object . values ( data ) . map ( d => d [ "lengthGenome" ] ) ) ;
135131 const [ view_forward , view_reverse ] = getViews ( data , filePath , maxValue ) ;
@@ -141,19 +137,19 @@ function AlignedGenomeViz({ dataGosling, filter, filePath, gosRef, maxValueWiggl
141137 "arrangement" : "vertical" ,
142138 "spacing" : 50 ,
143139 "linkingId" : "detail" , // linkingId is used to enable zooming and panning across views
144- "zoomLimits" : [ 50 , maxValue ] ,
140+ "zoomLimits" : [ 50 , Math . round ( maxValue ) ] ,
145141 "views" : distributedViews ,
146- } ) , [ dataGosling , filePath , maxValueWiggleDict , filter , allowFetch , allowWiggleVisualization ] ) ;
147- console . log ( "SPEC ALIGNED" )
148- console . log ( specs )
142+ } ) , [ dataGosling , filePath , maxValueWiggleDict , filter , allowWiggleVisualization ] ) ;
149143 return specs ;
150144 }
151145
146+
147+
152148
153149 return < >
154150 { dataGosling === null ?
155151 < ClipLoader color = '#ffa000' size = { 30 } /> :
156- < GoslingComponent spec = { createSpecsGosling ( dataGosling , filePath , maxValueWiggleDict , filter , allowFetch ) } ref = { gosRef } reactive = { true } /> }
152+ < GoslingComponent spec = { createSpecsGosling ( dataGosling , filePath , maxValueWiggleDict , filter ) } ref = { gosRef } reactive = { true } /> }
157153 </ >
158154 ;
159155
0 commit comments