[Rd] pairwiseAlignment Improvements

Dario Strbenac dstr7320 at uni.sydney.edu.au
Fri Apr 28 08:00:11 CEST 2017

Good day,

The location of indels can be retrieved from a PairwiseAlignmentsSingleSubject object by using indel. Determining any difference between the two sequences, including substitutions, is not quick nor easy. I suppose that summary displays details of the mismatches, but the variable is of class PairwiseAlignmentsSingleSubjectSummary which has no documented accessors. So, the code to access the information looks bad.

summaryAlign at mismatchSummary[["subject"]]

    SubjectPosition Subject Pattern Count Probability
1               2       T       A     1           1
2               3       T       A     1           1

This could be improved with accessors for end users.

Also, instead of being a data.frame, this would be better stored as IRanges with associated metadata columns, accessible with mcols, so that methods like reduce could easily be used to look for contiguous blocks of differences.

Is there a reason why the show method for the summary only shows mismatches, even if there are indels contained in it? This seems arbitrary and also misleading, because it always gives a false impression that there are no indels.

Could the return data types consistently be made to be IRanges ? Sometimes it's IntegerList, sometimes it's IRanges. For example,

> A
  11-letter "DNAString" instance
> B
  8-letter "DNAString" instance
> alignment <- pairwiseAlignment(A, B, gapOpening = 0, gapExtension = 1, substitutionMatrix = substitutions)
> alignment at subject@mismatch
IntegerList of length 1
[[1]] 2
> alignment at subject@indel
IRangesList of length 1
IRanges of length 1
    start end width
[1]     8   9     2

Lastly, why are functions like insertion, deletion, and indel documented in Numeric Summary Methods? Unlike nchar and score, they are not numerical summaries of the data.

It'd be nice to see this part of Biostrings thoroughly refactored with more focus on UX.

Dario Strbenac
University of Sydney
Camperdown NSW 2050

More information about the R-devel mailing list