0

我正在尝试提取存储在 .csv 中的染色体大小数据。我尝试绘制该信息我得到下一个错误:“(函数(类,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)

有没有办法可以将文件调用到我的代码中?

先谢谢了!

4

1 回答 1

0

查看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)
于 2021-02-01T17:34:04.270 回答