我有一张 SNP 表和有关相应基因的信息:基因 ID、基因类型和基因名称:
SNP Gene ID Gene type Gene Name
1 rs10876864 ENSG00000123411.10 protein_coding IKZF4
2 rs10876864 ENSG00000123411.10 protein_coding IKZF4
3 rs10876864 ENSG00000123411.10 protein_coding IKZF4
4 rs10876864 ENSG00000123411.10 protein_coding IKZF4
5 CNVR2845.57 ENSG00000196126.6 protein_coding HLA-DRB1
6 CNVR2845.57 ENSG00000196126.6 protein_coding HLA-DRB1
7 CNVR2845.57 ENSG00000196126.6 protein_coding HLA-DRB1
8 CNVR2845.57 ENSG00000196126.6 protein_coding HLA-DRB1
9 rs6030897 ENSG00000201372.1 snRNA U6
10 rs6030897 ENSG00000201372.1 snRNA U6
11 rs6030897 ENSG00000201372.1 snRNA U6
我想绘制 SNP 总数的条形图,以查看有多少 SNP 是蛋白质编码或 snRNA 等。
到目前为止,这是我的代码:
barplot(as.matrix(data1), main="SNP", xlab="Gene type", ylab= "Total SNP", names.arg=c("protein_coding","snRNA","pseudogene","antisense","lincRNA",""), border="blue", density=c(10, 20, 30, 40, 50))
但我收到一条错误消息:
Error in barplot.default(as.matrix(data1), main = "SNP", xlab = "Gene type", : incorrect number of names
In addition: Warning messages:
1: In apply(height, 2L, cumsum) : NAs introduced by coercion
2: In apply(height, 2L, cumsum) : NAs introduced by coercion
3: In apply(height, 2L, cumsum) : NAs introduced by coercion
4: In apply(height, 2L, cumsum) : NAs introduced by coercion