vcountPDict fails on PDict
1
0
Entering edit mode
Aditya ▴ 160
@aditya-7667
Last seen 2.5 years ago
Germany
# vcountPDict on a DNAStringSet works
bsgenome <-  BSgenome.Mmusculus.UCSC.mm10::Mmusculus
seqs <- c("CTTATATTGTCTCCAGCAGAAGG", "CTTATATTGTCTCCAGCAGAAGG", "ATATTGTCAAGTTGACAACCAGG")
Biostrings::vcountPDict(
    Biostrings::DNAStringSet(seqs),
    bsgenome,
    min.mismatch = mismatch,
    max.mismatch = mismatch)

# vcountPDict on a PDict fails (contrary to documentation!)
Biostrings::vcountPDict(
    Biostrings::PDict(cas9seqdt$cas9seq, max.mismatch=0),
    bsgenome,
    min.mismatch = mismatch,
    max.mismatch = mismatch)
Error in .local(pdict, subject, max.mismatch, min.mismatch, fixed, algorithm,  : 
'pdict' must be a DNAStringSet object
Biostrings • 1.1k views
ADD COMMENT
2
Entering edit mode
@herve-pages-1542
Last seen 1 day ago
Seattle, WA, United States

Hi Aditya,

Maybe you were looking at the wrong man page. vcountPDict() is a generic function with dispatch on the 2nd argument (subject):

library(BSgenome)
vcountPDict
# standardGeneric for "vcountPDict" defined from package "Biostrings"

# function (pdict, subject, max.mismatch = 0, min.mismatch = 0, 
#     with.indels = FALSE, fixed = TRUE, algorithm = "auto", collapse = FALSE, 
#     weight = 1L, verbose = FALSE, ...) 
# standardGeneric("vcountPDict")
# <bytecode: 0xfdc27c8>
# <environment: 0xfd96f80>
# Methods may be defined for arguments: subject
# Use  showMethods("vcountPDict")  for currently available ones.

Let's look at the list of its methods:

showMethods("vcountPDict")
# Function: vcountPDict (package Biostrings)
# subject="BSgenome"
# subject="MaskedXString"
# subject="XString"
# subject="XStringSet"
# subject="XStringViews"

This generic function and most of its methods are actually defined and documented in the Biostrings package. The method that you are trying to use (and that fails on a PDict object) is the method defined for BSgenome objects i.e. it's the method that handles a subject that is a BSgenome object. You can open the man page for this particular method with:

?`vcountPDict,BSgenome-method`

As you can see, unlike the man page for the other methods which is from the Biostrings package, this man page is from the BSgenome package. It says:

   pdict: A DNAStringSet object containing the pattern sequences.

Anyway, I've enhanced the vmatchPDict() and vcountPDict() methods for BSgenome objects in BioC devel to accept a PDict object. The change is in BSgenome 1.53.1 (see it on GitHub). BSgenome 1.53.1 should become available to BioC devel (i.e. BioC 3.10) users via BiocManager::install() in the next 24h or so.

Cheers,

H.

ADD COMMENT
0
Entering edit mode

Oh, thank you Herve :-)

ADD REPLY

Login before adding your answer.

Traffic: 1051 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6