I am using the msa package to align DNA sequences with Muscle (which works great!). Now I was wondering whether it's possible to extract a subset of an alignment. In the following example, I would like to extract just the first 3 rows from the alignment:
library(msa) mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa") mySequences <- readAAStringSet(mySequenceFile) mySequences aln <- msa(mySequences) # subset, get first 3 only rowmask(aln, invert=TRUE) <- IRanges(start=1, end=3) print(aln, show="complete")
However, the masked rows are still present and are showing up with # characters. How can I drop the masked parts in order to have just the first 3 rows in an alignment object?