r语言 - layout_circle使用ggbio从.csv文件中提取数据



我正试图取出存储在.csv上的染色体大小的数据。我试着画出这些信息,我得到了下一个错误:" (function (classes, fdef, mtable)中的错误:无法为签名"data.frame"的函数"layout_circle"找到继承方法

这是我使用的:

library(ggbio)
ChrLen2 = read.csv("ChrLen2.csv") #Change name of the file
p <- ggplot() + layout_circle(ChrLen2, geom = "ideo", fill = "gray70",
radius = 30, trackWidth = 4)

有一种方法,我可以调用文件到我的代码?

提前,谢谢!

查看ggbio的帮助手册,需要提供一个GRanges对象进行绘图,并在其中指定染色体长度信息,例如:

library(ggbio)
library(GenomicRanges)
gr = GRanges(seqnames="chr2",IRanges(start=1 ,end= 1))
seqinfo(gr)
Seqinfo object with 1 sequence from an unspecified genome; no seqlengths:
seqnames seqlengths isCircular genome
chr2             NA         NA   <NA>
seqlengths(gr) = 2e6
seqinfo(gr)
Seqinfo object with 1 sequence from an unspecified genome:
seqnames seqlengths isCircular genome
chr2        2000000         NA   <NA>
ggplot() + layout_circle(gr, geom = "ideo", fill = "gray70",
radius = 30, trackWidth = 4)

最新更新