Skip to content
Snippets Groups Projects
Commit b9983407 authored by Hartanto, Margi's avatar Hartanto, Margi
Browse files

discriminate parents in PCA plot

parent 0fe748da
No related branches found
No related tags found
No related merge requests found
......@@ -70,16 +70,16 @@
pr.out <- prcomp(x = (t(trait.matrix)), center = T, scale. = F)
pc.df <- data.frame(pc1 = pr.out$x[, 1],
pc2 = pr.out$x[, 2],
stage = sample.stage,
population = c(rep('parent', 16), rep('RIL', 164)))
stage = as.character(sample.stage),
population = substring(colnames(trait.matrix), 1, 3))
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('parent', 'pd', 'ar', 'im', 'rp')))) +
geom_point(aes(shape = population)) +
scale_colour_manual(values = c('#ccbb44', '#228833', '#4477aa', '#cc3311')) +
scale_shape_manual(values = c(17, 19)) +
scale_shape_manual(values = c(2, 19, 6)) +
labs(x = paste0("PC1 (", pc1.var, "%)"), y = paste0("PC2 (", pc2.var, "%)")) +
labs(colour = 'stage') +
theme(text = element_text(size = 10),
......@@ -101,7 +101,7 @@
units = 'px',
res = 300,
compression = 'lzw')
pca.all
print(pca.all)
dev.off()
# PCA per stage ####
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment