I am writing a function which takes 2 inputs, a fasta file (with sequences) and a data.frame (with subsequence coordinates), and returning as output the given subsequences. Inside the function, the fasta file is loaded, the data.frame is converted into a
GRanges, and the subsequences are extracted using
Here is how it looks like on a quick example:
records <- Biostrings::readDNAStringSet(filepath=in.fa, format="fasta") sub.info.gr <- GenomicRanges::GRanges( seqnames=Rle("chr2"), ranges=IRanges::IRanges(start=4890, end=5040)) names(sub.info.gr) <- "sl" sub.records <- Biostrings::getSeq(x=records, sub.info.gr)
Unfortunately, the last command returns an error:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘getSeq’ for signature ‘"DNAStringSet"’
This is surprising because of what is the following command is returning:
library(BSgenome) Function: getSeq (package Biostrings) x="BSgenome" x="FaFile" x="FaFileList" x="TwoBitFile" x="XStringSet"
Once I executed the last command (just above, that is after loading BSgenome), I re-executed the problematic command, and now it returns another error:
sub.records <- Biostrings::getSeq(x=records, sub.info.gr) Error in .unlist_RL_subscript(i, x) : could not find function "shift"
Here are the package versions I am using:
sessionInfo() R version 3.2.2 (2015-08-14) Platform: x86_64-pc-linux-gnu (64-bit) loaded via a namespace (and not attached)  IRanges_2.4.8 XML_3.98-1.4  Rsamtools_1.22.0 Biostrings_2.38.4  GenomicAlignments_1.6.3 bitops_1.0-6  GenomeInfoDb_1.6.3 futile.options_1.0.0  stats4_3.2.2 zlibbioc_1.16.0  XVector_0.10.0 S4Vectors_0.8.11  futile.logger_1.4.1 lambda.r_1.1.7  BiocParallel_1.4.3 tools_3.2.2  Biobase_2.30.0 BSgenome_1.38.0  RCurl_1.95-4.8 rtracklayer_1.30.4  parallel_3.2.2 compiler_3.2.2  BiocGenerics_0.16.1 GenomicRanges_1.22.4  SummarizedExperiment_1.0.2
Is this error fixed in more recent versions? Which package(s) should I upgrade? Or most importantly, is there another way to do what I want with the versions of the packages I currently have installed?