[BioC] List all alignments in Biostrings

Hervé Pagès hpages at fhcrc.org
Tue Mar 25 19:06:10 CET 2014


Hi Al,

On 03/25/2014 09:31 AM, Alpesh Querer wrote:
> Hello,
>
> I understand the pairwiseAlignment() returns the (first) best match only,
> is there a way for it to return all alignments for 2 sequences both local
> and global?

Short answer is no.

Long answer: I'm not sure what you'd like to get in case of a global
alignment ("global" is short for "global-global").
If you're doing "global-local" alignment, note that pairwiseAlignment()
returns the *last* best match, not the first:

   pattern <- DNAString("AAA")
   subject <- DNAString("TTAAACGTAAAATGAAT")

Then:

   > pairwiseAlignment(pattern, subject, type="global-local")
   Global-Local PairwiseAlignmentsSingleSubject (1 of 1)
   pattern:  [1] AAA
   subject: [10] AAA
   score: 5.945268

You can use matchPattern() to get all the matches that satisfy
some criteria (but this criteria must be expressed in terms of
edit distance):

   > matchPattern(pattern, subject, max.mismatch=1, with.indels=TRUE)
     Views on a 17-letter DNAString subject
   subject: TTAAACGTAAAATGAAT
   views:
       start end width
   [1]     3   5     3 [AAA]
   [2]     9  11     3 [AAA]
   [3]    10  12     3 [AAA]
   [4]    15  16     2 [AA]

This doesn't give you a score though nor does it guarantee that you'll
get a match. However, if the returned Views object is not empty, then
it's guaranteed to contain all the "best" matches. Even though the Views
object can be post-processed to keep the best matches only, there is no
way to ask matchPattern() something like "give me the best matches
only".

HTH,
H.

>
> Thanks,
> Al
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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