Closed gevro closed 2 years ago
Hi,
However, the latest version of Biostrings simply returns the total number of alignments within the PairwiseAlignments object.
This has always been the case and is the expected behavior of length()
on a PairwiseAlignments object:
library(Biostrings)
pattern <- AAStringSet(c("PAWHEAE", "PAWHAE", "PAWWHEAE"))
subject <- AAString("HEAGAWGHEE")
x <- pairwiseAlignment(pattern, subject)
x
length(x)
# [1] 3
Also I don't see any contradiction with the documentation:
alignedPattern(x)
# AAStringSet object of length 3:
# width seq
# [1] 10 P---AWHEAE
# [2] 10 P---AW-HAE
# [3] 11 P---AWWHEAE
length(alignedPattern(x))
# [1] 3
alignedSubject(x)
# AAStringSet object of length 3:
# width seq
# [1] 10 HEAGAWGHEE
# [2] 10 HEAGAWGHEE
# [3] 11 HEAGAWGHE-E
length(alignedSubject(x))
# [1] 3
Use nchar()
if you want the lengths of each alignment in the PairwiseAlignments object:
nchar(x)
# [1] 10 10 11
Ok thank you.
Hi, Per the documentation, length should return the lengths of each alignment of a PairwiseAlignments object
However, the latest version of Biostrings simply returns the total number of alignments within the PairwiseAlignments object.
I believe this is a bug. Also, there does not seem to be a function to do what the documentation indicates.