更新 RNA-arry.R
This commit is contained in:
parent
c7b7f636a9
commit
d8fdaa0208
26
RNA-arry.R
26
RNA-arry.R
@ -38,28 +38,28 @@ exp <- exp[, -1]
|
|||||||
#将样本按pData$title分为normal组和cancer组,并转换为factor
|
#将样本按pData$title分为normal组和cancer组,并转换为factor
|
||||||
grp <- grp[colnames(exp),]
|
grp <- grp[colnames(exp),]
|
||||||
grp <- ifelse(str_detect(grp$title,"Normal"),"normal","cancer") %>%
|
grp <- ifelse(str_detect(grp$title,"Normal"),"normal","cancer") %>%
|
||||||
factor(c("normal","cancer"))
|
factor(c("normal","cancer"))
|
||||||
|
|
||||||
############################样本质量控制与标准化################################
|
############################样本质量控制与标准化################################
|
||||||
|
|
||||||
pca_plot1 <- as.data.frame(prcomp(t(exp))$x) %>%
|
pca_plot1 <- as.data.frame(prcomp(t(exp))$x) %>%
|
||||||
ggplot(aes(x = PC1, y = PC2, colour = grp)) +
|
ggplot(aes(x = PC1, y = PC2, colour = grp)) +
|
||||||
geom_point() +
|
geom_point() +
|
||||||
stat_ellipse(level = 0.95, show.legend = F) +
|
stat_ellipse(level = 0.95, show.legend = F) +
|
||||||
theme_bw() +
|
theme_bw() +
|
||||||
theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) +
|
theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) +
|
||||||
ggtitle("Before Normalize")
|
ggtitle("Before Normalize")
|
||||||
|
|
||||||
exp <- normalizeBetweenArrays(exp, method="quantile")
|
exp <- normalizeBetweenArrays(exp, method="quantile")
|
||||||
if(max(exp)>50) exp <- log2(exp + 1)
|
if(max(exp)>50) exp <- log2(exp + 1)
|
||||||
|
|
||||||
pca_plot2 <- as.data.frame(prcomp(t(exp))$x) %>%
|
pca_plot2 <- as.data.frame(prcomp(t(exp))$x) %>%
|
||||||
ggplot(aes(x = PC1, y = PC2, colour = grp)) +
|
ggplot(aes(x = PC1, y = PC2, colour = grp)) +
|
||||||
geom_point() +
|
geom_point() +
|
||||||
stat_ellipse(level = 0.95, show.legend = F) +
|
stat_ellipse(level = 0.95, show.legend = F) +
|
||||||
theme_bw() +
|
theme_bw() +
|
||||||
theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) +
|
theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank()) +
|
||||||
ggtitle("After Normalize")
|
ggtitle("After Normalize")
|
||||||
|
|
||||||
pca_plot1 + theme(legend.position = "none") + pca_plot2
|
pca_plot1 + theme(legend.position = "none") + pca_plot2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user