Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
seed-germination-qtl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hartanto, Margi
seed-germination-qtl
Commits
0fe748da
Commit
0fe748da
authored
5 years ago
by
Hartanto, Margi
Browse files
Options
Downloads
Patches
Plain Diff
repair Dist function, change heatmap colors, and fix upset plot
parent
1f0731ff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
1-clustering.R
+56
-8
56 additions, 8 deletions
1-clustering.R
3-eqtl-visualization.R
+2
-2
2 additions, 2 deletions
3-eqtl-visualization.R
with
58 additions
and
10 deletions
1-clustering.R
+
56
−
8
View file @
0fe748da
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
library
(
amap
)
library
(
amap
)
library
(
topGO
)
library
(
topGO
)
library
(
org.At.tair.db
)
library
(
org.At.tair.db
)
library
(
colorspace
)
# unused libraries ####
# unused libraries ####
# library(Mfuzz)
# library(Mfuzz)
# library(factoextra)
# library(factoextra)
...
@@ -39,6 +40,7 @@
...
@@ -39,6 +40,7 @@
trait.matrix
<-
read.csv
(
file
=
'files/trait-matrix.csv'
,
row.names
=
1
)
trait.matrix
<-
read.csv
(
file
=
'files/trait-matrix.csv'
,
row.names
=
1
)
sample.list
<-
read.csv
(
file
=
'files/sample-list.csv'
)
sample.list
<-
read.csv
(
file
=
'files/sample-list.csv'
)
sample.stage
<-
sample.list
$
stage
sample.stage
<-
sample.list
$
stage
stages
<-
c
(
'pd'
,
'ar'
,
'im'
,
'rp'
)
# data presentation ####
# data presentation ####
presentation
<-
theme
(
axis.text.x
=
element_text
(
size
=
6
,
face
=
"bold"
,
color
=
"black"
),
presentation
<-
theme
(
axis.text.x
=
element_text
(
size
=
6
,
face
=
"bold"
,
color
=
"black"
),
...
@@ -70,12 +72,15 @@
...
@@ -70,12 +72,15 @@
pc2
=
pr.out
$
x
[,
2
],
pc2
=
pr.out
$
x
[,
2
],
stage
=
sample.stage
,
stage
=
sample.stage
,
population
=
c
(
rep
(
'parent'
,
16
),
rep
(
'RIL'
,
164
)))
population
=
c
(
rep
(
'parent'
,
16
),
rep
(
'RIL'
,
164
)))
pc.sum
<-
summary
(
pr.out
)
pc1.var
<-
round
(
pc.sum
$
importance
[
2
,
'PC1'
]
*
100
,
2
)
pc2.var
<-
round
(
pc.sum
$
importance
[
2
,
'PC2'
]
*
100
,
2
)
pca.all
<-
ggplot
(
pc.df
,
aes
(
x
=
pc1
,
y
=
pc2
,
color
=
factor
(
stage
,
level
=
c
(
'pd'
,
'ar'
,
'im'
,
'rp'
))))
+
pca.all
<-
ggplot
(
pc.df
,
aes
(
x
=
pc1
,
y
=
pc2
,
color
=
factor
(
stage
,
level
=
c
(
'pd'
,
'ar'
,
'im'
,
'rp'
))))
+
geom_point
(
aes
(
shape
=
population
))
+
geom_point
(
aes
(
shape
=
population
))
+
scale_colour_manual
(
values
=
c
(
'#ccbb44'
,
'#228833'
,
'#4477aa'
,
'#cc3311'
))
+
scale_colour_manual
(
values
=
c
(
'#ccbb44'
,
'#228833'
,
'#4477aa'
,
'#cc3311'
))
+
scale_shape_manual
(
values
=
c
(
17
,
19
))
+
scale_shape_manual
(
values
=
c
(
17
,
19
))
+
labs
(
x
=
"PC1 (55.56
%)"
,
y
=
"PC2 (14.82
%)"
)
+
labs
(
x
=
paste0
(
"PC1 ("
,
pc1.var
,
"
%)"
)
,
y
=
paste0
(
"PC2 ("
,
pc2.var
,
"
%)"
)
)
+
labs
(
colour
=
'stage'
)
+
labs
(
colour
=
'stage'
)
+
theme
(
text
=
element_text
(
size
=
10
),
theme
(
text
=
element_text
(
size
=
10
),
panel.background
=
element_blank
(),
panel.background
=
element_blank
(),
...
@@ -99,7 +104,51 @@
...
@@ -99,7 +104,51 @@
pca.all
pca.all
dev.off
()
dev.off
()
# differential expresed gene analysis and hierarchiecal clustering ####
# PCA per stage ####
for
(
i
in
stages
)
{
trait.stage
<-
trait.matrix
[,
which
(
sample.stage
==
i
)]
pr.stage
<-
prcomp
(
x
=
(
t
(
trait.stage
)),
center
=
T
,
scale.
=
F
)
pc.stage
<-
data.frame
(
pc1
=
pr.stage
$
x
[,
1
],
pc2
=
pr.stage
$
x
[,
2
],
population
=
c
(
rep
(
'parent'
,
4
),
rep
(
'RIL'
,
ncol
(
trait.stage
)
-
4
)))
pc.sum
<-
summary
(
pr.stage
)
pc1.var
<-
round
(
pc.sum
$
importance
[
2
,
'PC1'
]
*
100
,
2
)
pc2.var
<-
round
(
pc.sum
$
importance
[
2
,
'PC2'
]
*
100
,
2
)
pca.stage.plot
<-
ggplot
(
pc.stage
,
aes
(
x
=
pc1
,
y
=
pc2
))
+
geom_point
(
aes
(
shape
=
population
))
+
#scale_colour_manual(values = c('#ccbb44', '#228833', '#4477aa', '#cc3311')) +
scale_shape_manual
(
values
=
c
(
17
,
19
))
+
labs
(
x
=
paste0
(
"PC1 ("
,
pc1.var
,
"%)"
),
y
=
paste0
(
"PC2 ("
,
pc2.var
,
"%)"
))
+
labs
(
colour
=
'stage'
)
+
theme
(
text
=
element_text
(
size
=
10
),
panel.background
=
element_blank
(),
panel.border
=
element_rect
(
fill
=
NA
),
panel.grid.major
=
element_blank
(),
panel.grid.minor
=
element_blank
(),
strip.background
=
element_blank
(),
axis.text.x
=
element_text
(
colour
=
"black"
),
axis.text.y
=
element_text
(
colour
=
"black"
),
axis.ticks
=
element_line
(
colour
=
"black"
),
plot.margin
=
unit
(
c
(
1
,
1
,
1
,
1
),
"line"
))
+
#presentation +
geom_hline
(
aes
(
yintercept
=
0
),
linetype
=
'dashed'
,
size
=
.1
)
+
geom_vline
(
aes
(
xintercept
=
0
),
linetype
=
'dashed'
,
size
=
.1
)
tiff
(
file
=
paste0
(
"figures/pca-"
,
i
,
".tiff"
),
width
=
2250
,
height
=
1200
,
units
=
'px'
,
res
=
300
,
compression
=
'lzw'
)
print
(
pca.stage.plot
)
dev.off
()
}
# differential expresed gene analysis and hierarchiecal clustering ####
group
<-
with
(
pData
(
eset
),
stage
)
group
<-
with
(
pData
(
eset
),
stage
)
group
<-
factor
(
group
)
group
<-
factor
(
group
)
design
<-
model.matrix
(
~
0
+
group
)
design
<-
model.matrix
(
~
0
+
group
)
...
@@ -142,7 +191,7 @@
...
@@ -142,7 +191,7 @@
# hierarchiecal tree clustering done for stage and genes ####
# hierarchiecal tree clustering done for stage and genes ####
# hc for stage
# hc for stage
dist.matrix.stage
<-
Dist
(
t
(
cluster.data
),
dist.matrix.stage
<-
amap
::
Dist
(
t
(
cluster.data
),
method
=
'pearson'
,
method
=
'pearson'
,
upper
=
T
,
upper
=
T
,
diag
=
T
)
diag
=
T
)
...
@@ -152,7 +201,7 @@
...
@@ -152,7 +201,7 @@
plot
(
reorder
(
x
=
as.dendrogram
(
hc.stage
),
180
:
1
,
agglo.FUN
=
mean
))
plot
(
reorder
(
x
=
as.dendrogram
(
hc.stage
),
180
:
1
,
agglo.FUN
=
mean
))
# hc for gene
# hc for gene
dist.matrix.gene
<-
Dist
(
cluster.data
,
dist.matrix.gene
<-
amap
::
Dist
(
cluster.data
,
method
=
'pearson'
,
# to group the genes based on patterns similarity across stages
method
=
'pearson'
,
# to group the genes based on patterns similarity across stages
upper
=
T
,
upper
=
T
,
diag
=
T
)
diag
=
T
)
...
@@ -183,17 +232,16 @@
...
@@ -183,17 +232,16 @@
res
=
300
,
res
=
300
,
compression
=
'lzw'
)
compression
=
'lzw'
)
heatmap.2
(
x
=
as.matrix
(
cluster.data
),
cexRow
=
0.8
,
cexCol
=
1.2
,
heatmap.2
(
x
=
as.matrix
(
cluster.data
),
cexRow
=
0.8
,
cexCol
=
1.2
,
distfun
=
function
(
x
)
Dist
(
x
,
method
=
'pearson'
),
distfun
=
function
(
x
)
amap
::
Dist
(
x
,
method
=
'pearson'
),
hclust
=
function
(
x
)
hclust
(
x
,
method
=
'ward.D2'
),
hclust
=
function
(
x
)
hclust
(
x
,
method
=
'ward.D2'
),
scale
=
'row'
,
scale
=
'row'
,
density.info
=
"density"
,
density.info
=
"density"
,
trace
=
'none'
,
trace
=
'none'
,
col
=
brewer.pal
(
9
,
'YlGnBu
'
),
col
=
diverging_hcl
(
100
,
palette
=
'Blue-Red3
'
),
keysize
=
1
,
keysize
=
1
,
key.title
=
'Z-score of\nlog-intensities'
,
key.title
=
'Z-score of\nlog-intensities'
,
key.xlab
=
NA
,
key.xlab
=
NA
,
Colv
=
reorder
(
x
=
as.dendrogram
(
hc.stage
),
180
:
1
,
agglo.FUN
=
mean
),
Colv
=
reorder
(
x
=
as.dendrogram
(
hc.stage
),
180
:
1
,
agglo.FUN
=
mean
))
ColSideColors
=
sample.color
)
dev.off
()
dev.off
()
# GOE analysis for genes in each cluster ####
# GOE analysis for genes in each cluster ####
...
...
This diff is collapsed.
Click to expand it.
3-eqtl-visualization.R
+
2
−
2
View file @
0fe748da
...
@@ -277,12 +277,12 @@
...
@@ -277,12 +277,12 @@
set_size.scale_max
=
1400
)
set_size.scale_max
=
1400
)
tiff
(
file
=
paste0
(
"figures/upset-distant.tiff"
),
tiff
(
file
=
paste0
(
"figures/upset-distant.tiff"
),
width
=
225
0
,
width
=
100
0
,
height
=
850
,
height
=
850
,
units
=
'px'
,
units
=
'px'
,
res
=
300
,
res
=
300
,
compression
=
'lzw'
)
compression
=
'lzw'
)
grid.arrange
(
upset.local
,
upset.distant
,
ncol
=
2
)
upset.distant
dev.off
()
dev.off
()
# cis-trans plot - single stage #####
# cis-trans plot - single stage #####
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment