Question: vcountPDict fails on PDict
gravatar for Aditya
15 days ago by
Aditya70 wrote:
# vcountPDict on a DNAStringSet works
bsgenome <-  BSgenome.Mmusculus.UCSC.mm10::Mmusculus
    min.mismatch = mismatch,
    max.mismatch = mismatch)

# vcountPDict on a PDict fails (contrary to documentation!)
    Biostrings::PDict(cas9seqdt$cas9seq, max.mismatch=0),
    min.mismatch = mismatch,
    max.mismatch = mismatch)
Error in .local(pdict, subject, max.mismatch, min.mismatch, fixed, algorithm,  : 
'pdict' must be a DNAStringSet object
biostrings • 39 views
ADD COMMENTlink modified 6 days ago by Hervé Pagès ♦♦ 14k • written 15 days ago by Aditya70
Answer: vcountPDict fails on PDict
gravatar for Hervé Pagès
6 days ago by
Hervé Pagès ♦♦ 14k
United States
Hervé Pagès ♦♦ 14k wrote:

Hi Aditya,

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

# 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:

# 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:


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.



ADD COMMENTlink modified 5 days ago • written 6 days ago by Hervé Pagès ♦♦ 14k

Oh, thank you Herve :-)

ADD REPLYlink written 6 days ago by Aditya70
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 290 users visited in the last hour