@@ -16,13 +16,11 @@ open FSharp.Plotly.StyleParam
16
16
let header = [ " <b>RowIndex</b>" ; " A" ; " simple" ; " table" ]
17
17
let rows =
18
18
[
19
- [ " 0" ; " I" ; " am" ; " a" ]
19
+ [ " 0" ; " I" ; " am" ; " a" ]
20
20
[ " 1" ; " little" ; " example" ; " !" ]
21
21
]
22
22
23
- let table1 =
24
- Chart.Table( header, rows)
25
-
23
+ let table1 = Chart.Table( header, rows)
26
24
27
25
28
26
(***do-not-eval***)
@@ -39,29 +37,29 @@ let table2 =
39
37
header,
40
38
rows,
41
39
//sets global header alignment
42
- AlignHeader= [ HorizontalAlign.Center],
40
+ AlignHeader = [ HorizontalAlign.Center],
43
41
//sets alignment for each column separately
44
42
//(The last alignment is applied to all potential following columns)
45
- AlignCells= [ HorizontalAlign.Left; HorizontalAlign.Center; HorizontalAlign.Right],
43
+ AlignCells = [ HorizontalAlign.Left; HorizontalAlign.Center; HorizontalAlign.Right],
46
44
//sets global header color
47
- ColorHeader= " #45546a" ,
48
- //sets specific header color to each header column
45
+ ColorHeader = " #45546a" ,
46
+ //sets specific color to each header column
49
47
//ColorHeader=["#45546a";"#deebf7";"#45546a";"#deebf7"],
50
48
//sets global cell color
51
- //ColorRows= "#deebf7",
49
+ //ColorRows = "#deebf7",
52
50
//sets cell column colors
53
- ColorCells= [" #deebf7" ; " lightgrey" ; " #deebf7" ; " lightgrey" ],
51
+ ColorCells = [ " #deebf7" ; " lightgrey" ; " #deebf7" ; " lightgrey" ],
54
52
//sets cell row colors
55
53
//ColorCells=[["#deebf7";"lightgrey"]],
56
54
//sets font of header
57
- FontHeader= Font.init( FontFamily.Courier_ New, Size= 12 , Color= " white" ),
55
+ FontHeader = Font.init( FontFamily.Courier_ New, Size= 12 , Color= " white" ),
58
56
//sets the height of the header
59
57
HeightHeader= 30. ,
60
58
//sets lines of header
61
- LineHeader= Line.init( 2. , " black" ),
62
- ColumnWidth= [70 ; 50 ; 100 ; 70 ],
59
+ LineHeader = Line.init( 2. , " black" ),
60
+ ColumnWidth = [ 70 ; 50 ; 100 ; 70 ],
63
61
//defines order of columns
64
- ColumnOrder= [ 1 ; 2 ; 3 ; 4 ]
62
+ ColumnOrder = [ 1 ; 2 ; 3 ; 4 ]
65
63
)
66
64
67
65
(***do-not-eval***)
@@ -88,11 +86,13 @@ let rowvalues =
88
86
89
87
//map color from value to hex representation
90
88
let mapColor min max value =
91
- let percentage = ( value - min) / ( max - min)
92
- Colors.fromRgb 255 ( 255 - ( int ( 255. * percentage))) ( int ( 255. * percentage))
89
+ let proportion =
90
+ ( 255. * ( value - min) / ( max - min))
91
+ |> int
92
+ Colors.fromRgb 255 ( 255 - proportion) proportion
93
93
|> Colors.toWebColor
94
94
95
- //assign a color to every cell seperately. Matrix must be transposed for correct orientation
95
+ //Assign a color to every cell seperately. Matrix must be transposed for correct orientation.
96
96
let cellcolor =
97
97
rowvalues
98
98
|> Seq.map ( fun row ->
@@ -114,7 +114,7 @@ table3 |> Chart.Show
114
114
115
115
116
116
(**
117
- Sequence representation
117
+ Sequence representation:
118
118
119
119
*)
120
120
@@ -128,26 +128,26 @@ let sequence =
128
128
]
129
129
|> String.concat " "
130
130
131
- let elementsperrow = 60
131
+ let elementsPerRow = 60
132
132
133
133
let headers =
134
- [ 0 .. elementsperrow ]
134
+ [ 0 .. elementsPerRow ]
135
135
|> Seq.map ( fun x ->
136
136
if x% 10 = 0 && x <> 0 then " |"
137
137
else " "
138
138
)
139
139
140
140
let cells =
141
141
sequence
142
- |> Seq.chunkBySize elementsperrow
143
- |> Seq.mapi ( fun i x -> Seq.append [ string ( i * elementsperrow )] ( Seq.map string x))
142
+ |> Seq.chunkBySize elementsPerRow
143
+ |> Seq.mapi ( fun i x -> Seq.append [ string ( i * elementsPerRow )] ( Seq.map string x))
144
144
145
145
let cellcolors =
146
146
cells
147
147
|> Seq.map ( fun row ->
148
148
row
149
- |> Seq.map ( fun nucleotid ->
150
- match nucleotid with
149
+ |> Seq.map ( fun element ->
150
+ match element with
151
151
//colors taken from DRuMS
152
152
//(http://biomodel.uah.es/en/model4/dna/atgc.htm)
153
153
| " A" -> " #5050FF"
@@ -163,13 +163,21 @@ let cellcolors =
163
163
164
164
let font = Font.init( FontFamily.Consolas, Size= 14 )
165
165
let line = Line.init( 0 , " white" )
166
- let chartwidth = 50. + 10. * float elementsperrow
166
+ let chartwidth = 50. + 10. * float elementsPerRow
167
167
168
168
let table4 =
169
169
Chart.Table(
170
- headers, cells, LineCells= line, LineHeader= line, HeightCells= 20 ,
171
- FontHeader= font, FontCells= font, ColumnWidth=[ 50 ; 10 ],
172
- AlignCells=[ HorizontalAlign.Right; HorizontalAlign.Center], ColorCells= cellcolors)
170
+ headers,
171
+ cells,
172
+ LineCells = line,
173
+ LineHeader = line,
174
+ HeightCells = 20 ,
175
+ FontHeader = font,
176
+ FontCells = font,
177
+ ColumnWidth = [ 50 ; 10 ],
178
+ AlignCells = [ HorizontalAlign.Right; HorizontalAlign.Center],
179
+ ColorCells = cellcolors
180
+ )
173
181
|> Chart.withSize( chartwidth, nan)
174
182
|> Chart.withTitle " Sequence A"
175
183
0 commit comments