I using Biostrings::readDNAStringSet to cut some sequence from hg19.fa, but an error occurs when I run the program(as follows).
seq <- Biostrings::readDNAStringSet("hg19.fa")
genome <- GenomeInfoDb::Seqinfo(genome = NA_character_)
gr_a <- BiocGenerics::unstrand(rtracklayer::import("file.bed", genome = genome))
a <- seq[gr_a]
gr_a is a GRanges object, when run a <- seq[gr_a], R report
"Error in .Call2("XStringSet_unlist", x, PACKAGE = "Biostrings") :
XStringSet object is too big to be unlisted (would result in an XString
object of length 2^31 or more)"
I try these codes several times, but sometimes the code runs very well, sometimes it report the error above.
what's wrong with these code?