Question: vcountPDict fails on PDict
0
gravatar for Aditya
3 months ago by
Aditya120
Germany
Aditya120 wrote:
# 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 • 89 views
ADD COMMENTlink modified 3 months ago by Hervé Pagès ♦♦ 14k • written 3 months ago by Aditya120
Answer: vcountPDict fails on PDict
2
gravatar for Hervé Pagès
3 months 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):

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 COMMENTlink modified 3 months ago • written 3 months ago by Hervé Pagès ♦♦ 14k

Oh, thank you Herve :-)

ADD REPLYlink written 3 months ago by Aditya120
Please log in to add an answer.

Help
Access

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