Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
037745fe
Commit
037745fe
authored
Apr 19, 2017
by
Sander Bollen
Browse files
get margins for heatmap from row name length
parent
02292fea
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/resources/nl/lumc/sasc/biopet/tools/plotHeatmap.R
View file @
037745fe
...
...
@@ -14,6 +14,7 @@ rownames(heat) <- heat[,1]
heat
<-
heat
[,
-1
]
heat
<-
as.matrix
(
heat
)
textMargin
<-
max
(
sapply
(
rownames
(
heat
),
nchar
))
+
4
colNumber
<-
50
col
<-
rev
(
colorRampPalette
(
brewer.pal
(
11
,
"Spectral"
))(
colNumber
))
for
(
i
in
(
colNumber
+1
)
:
(
colNumber
+
round
((
dist
(
range
(
heat
))
-
dist
(
range
(
heat
[
heat
<
1
])))
/
dist
(
range
(
heat
[
heat
<
1
]))
*
colNumber
)))
{
...
...
@@ -22,7 +23,7 @@ for (i in (colNumber+1):(colNumber+round((dist(range(heat)) - dist(range(heat[he
col
[
length
(
col
)]
<-
"#00FF00"
png
(
file
=
outputArg
,
width
=
1200
,
height
=
1200
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
NA
,
Rowv
=
NA
,
dendrogram
=
"none"
,
margins
=
c
(
12
,
12
),
na.color
=
"#00FF00"
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
NA
,
Rowv
=
NA
,
dendrogram
=
"none"
,
margins
=
c
(
textMargin
,
textMargin
),
na.color
=
"#00FF00"
)
dev.off
()
hc
<-
hclust
(
d
=
dist
(
heat
))
...
...
@@ -31,5 +32,5 @@ plot(as.dendrogram(hc), horiz=TRUE, asp=0.02)
dev.off
()
png
(
file
=
outputArgClustering
,
width
=
1200
,
height
=
1200
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
"Rowv"
,
dendrogram
=
"row"
,
margins
=
c
(
12
,
12
),
na.color
=
"#00FF00"
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
"Rowv"
,
dendrogram
=
"row"
,
margins
=
c
(
textMargin
,
textMargin
),
na.color
=
"#00FF00"
)
dev.off
()
biopet-tools/src/main/resources/nl/lumc/sasc/biopet/tools/vcfstats/plotHeatmap.R
View file @
037745fe
...
...
@@ -14,6 +14,7 @@ rownames(heat) <- heat[,1]
heat
<-
heat
[,
-1
]
heat
<-
as.matrix
(
heat
)
textMargin
<-
max
(
sapply
(
rownames
(
heat
),
nchar
))
+
4
colNumber
<-
50
col
<-
rev
(
colorRampPalette
(
brewer.pal
(
11
,
"Spectral"
))(
colNumber
))
for
(
i
in
(
colNumber
+1
)
:
(
colNumber
+
round
((
dist
(
range
(
heat
))
-
dist
(
range
(
heat
[
heat
<
1
])))
/
dist
(
range
(
heat
[
heat
<
1
]))
*
colNumber
)))
{
...
...
@@ -22,7 +23,7 @@ for (i in (colNumber+1):(colNumber+round((dist(range(heat)) - dist(range(heat[he
col
[
length
(
col
)]
<-
"#00FF00"
png
(
file
=
outputArg
,
width
=
1200
,
height
=
1200
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
NA
,
Rowv
=
NA
,
dendrogram
=
"none"
,
margins
=
c
(
12
,
12
),
na.color
=
"#00FF00"
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
NA
,
Rowv
=
NA
,
dendrogram
=
"none"
,
margins
=
c
(
textMargin
,
textMargin
),
na.color
=
"#00FF00"
)
dev.off
()
hc
<-
hclust
(
d
=
dist
(
heat
))
...
...
@@ -31,5 +32,5 @@ plot(as.dendrogram(hc), horiz=TRUE, asp=0.02)
dev.off
()
png
(
file
=
outputArgClustering
,
width
=
1200
,
height
=
1200
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
"Rowv"
,
dendrogram
=
"row"
,
margins
=
c
(
12
,
12
),
na.color
=
"#00FF00"
)
heatmap.2
(
heat
,
trace
=
'none'
,
col
=
col
,
Colv
=
"Rowv"
,
dendrogram
=
"row"
,
margins
=
c
(
textMargin
,
textMargin
),
na.color
=
"#00FF00"
)
dev.off
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment