[BioC] matchPattern vmatchPattern vectorised

Hervé Pagès hpages at fhcrc.org
Sat Dec 14 21:10:17 CET 2013

Hi Stephen,

On 12/14/2013 08:05 AM, Henderson, Stephen wrote:
> thx Steve
> I hadn't heard of gmapR (and GSNAP) I will check it now. The Rsubread package is a possible as I have it installed and planned to use it later in the pipeline so there is little extra overhead -- in my case.
> However a quick look at the documentation and code (of both) suggests that they are creating indexed genomes, which is of course appropriate for multimillion read aligners.
> Yet I still think there is a gap for a simple tool (such a vmatchPattern) that matches a small exact vector or StringSet of patterns - rather than just a singleton in one pass. It's a pretty common mol bio lab task (what with all the new multiplexing techs).

matchPDict() does that. It will be fast (i.e. do only one pass) if all
your patterns have the same length, in which case you should
preprocess them with PDict() before passing them to matchPDict().
Otherwise (i.e. without preprocessing), matchPDict() will just
call matchPattern() in a loop.

See ?matchPDict in the Biostrings package.


> Stephen
> ----------------------
> On Sat, Dec 14, 2013 at 6:00 AM, Stephen [guest] <guest at bioconductor.org> wrote:
>> Hi
>> I am trying to write a package that will make a few shortcuts for my lazy coworkers. So I wrote a few bits of code that will find their primers in amongst a fastq of multiplexed reads (e.g 10-20).
>> Next I thought I would save them the trouble of copy pasting Primers, Chromosome, and Start into a shell script, by instead autogenerating the script - We have the excellent BSgenome and Mmusculus9 packages installed so this seems a good starting point:
>> So for the first primer this works well:
>>> system.time(vmatchPattern("CCAGCACTGTATAGCCGATC", Mmusculus))
>>     user  system elapsed
>>   45.853   2.702  50.273
>> This is fine for a single primer but it seems from the docs (and testing) that if I want to lookup 15 primers it will take 15 passes through the genome and 15x as long. About the same time it would take them to just copy them from their lab-books. I guess they could have a coffee...still...
>> My first question: Is there another function or package on BioC that I have missed that might help me with this? Or low level functions I should look at to build a vectorised search (exact match) through Mmusculus?
> There are packages which wrap aligners that you might consider using:
> * gmapR
>    http://bioconductor.org/packages/release/bioc/html/gmapR.html
> * Rsubread:
>    http://bioconductor.org/packages/release/bioc/html/Rsubread.html
> HTH,
> -steve
> --
> Steve Lianoglou
> Computational Biologist
> Genentech
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioconductor mailing list