我正在尝试使用ggplot2将元数据覆盖到PCA图上。我遇到形状显示不正确的问题。
数据集来自Illumina测序仪上的读数。我已经运行了DESeq2(R中的程序包),将数据转换为可与prcomp()函数一起使用,并导入了一个表,其中包含所有颜色和形状编码信息。
library(ggfortify)
library(ggrepel)
library(GGally)
library(gplots)
library(ggplot2)
library(DESeq2)
library(pathview)
library(reshape2)
library(pvclust)
library(readxl)
x <- read.table('#Illumina Data#', header=T, sep="\t", fill=T, row.names= 1 )
condition = data.frame(condition = c(#names of conditions#)
rownames(condition) = colnames(x)
dds <- DESeqDataSetFromMatrix(countData = x, colData = condition, design = ~ condition)
dds <- estimateSizeFactors(dds)
dds <- estimateDispersions(dds)
zxc <- getVarianceStabilizedData(dds)
a<- t(zxc)
zz <- prcomp(a)
asdf <- as.data.frame(zxc)
data<- melt(as.data.frame(asdf))
b<- t(data)
prcomp <- prcomp(b)
prcomp <- as.data.frame(prcomp)
ggplot_prep <- read_excel("ggplot_HostAlone_metadata_coding_inprogress.xlsx")
autoplot(prcompb) + geom_point(aes(shape = ggplot_prep$Shape_by_Donor_Timepoint, color = ggplot_prep$Color_by_Date_Group), size = 3)
ggplot_prep$Shape_by_Donor_Timepoint <- as.factor(ggplot_prep$Shape_by_Donor_Timepoint)
ggplot_prep$Shape_by_Date_Timepoint <- as.factor(ggplot_prep$Shape_by_Date_Timepoint)
ggplot_prep$Shape_by_Strain_Timepoint <- as.factor(ggplot_prep$Shape_by_Strain_Timepoint)
ggplot_prep$Shape_by_Timepoint <- as.factor(ggplot_prep$Shape_by_Timepoint)
autoplot(prcompb) + geom_point(aes(pch = ggplot_prep$Shape_by_Donor_Timepoint,color = ggplot_prep$Color_by_Date))
我希望输出是具有四种颜色的点,六个不同形状的图。我使用的形状代码分别为0、1、2、15、16和17。我希望有3种填充形状和3种相应的开放形状,但是我没有得到。谁能建议我可能做错了什么?