我的读入文件是一段DNA序列,序列号是NC_000964.3,下载地址https://www.ncbi.nlm.nih.gov/nuccore/255767013/?report=fasta,,然后我想对该序列进行可视化绘图,然后就发现用plot,或者是ggplot,都很慢,
library(Biostrings)
library(BioGenerics)
library(stats4)
library(S4Vectors)
library(IRanges)
library(XVector)
library(seqinr)
library(parallel)
library(scatterplot3d)
library(ggplot2)
seq<-readDNAStringSet(file.choose())#读入NC_000964.fna格式文件
seq1<-as.character(seq)
seq2<-getSequence(seq1)
a<-cumsum(seq2=="A")
g<-cumsum(seq2=="G")
t<-cumsum(seq2=="T")
c<-cumsum(seq2=="C")
x<-(a+g)-(c+t)
y<-(a+c)-(g+t)
z<-(a+t)-(g+c)
scatterplot3d(x,y,z)#用这个画,有时候就能画出来,有时候就出现Error: cannot allocate vector of size 64.0 Mb
xlab<-1:length(a)
df<-data.frame(m=xlab,n=(x-y)/2)
library(ggplot2)
qplot(x=m,y=n,data = df,geom="point")
Error: cannot allocate vector of size 32.2 Mb或者是Error in plyr::split_indices(scale_id, n) : std::bad_alloc
ggplot(df,aes(x=m,y=n))+geom_point()
Error: cannot allocate vector of size 32.2 Mb