alignedPattern and @pattern have different returns
Close-your-eyes opened this issue · 1 comments
Close-your-eyes commented
With the alignment below alignedPattern(aln) and aln@pattern return different strings. Is that desired?
aln <- Biostrings::pairwiseAlignment("CCGGATCG", "ATCG", type = "global-local")
Global-Local PairwiseAlignmentsSingleSubject (1 of 1)
pattern: CCGGATCG
subject: [1] ----ATCG
score: -18.07298
as.character(Biostrings::alignedPattern(aln))
"CCGGATCG"
as.character(aln@pattern)
"ATCG"
hpages commented
That is how things are stored inside the object. But with S4 objects, you're not supposed to look at the content of their slots because that's ultimately internal business. So instead of doing direct slot access with @
, you should always use accessor functions like alignedPattern()
and alignedSubject()
. This is a strong principle for all S4 object manipulation in Bioconductor.