library(ape)
data(woodmouse)
#Just the third codon (assuming alignment is in-frame)
woodmouse[, seq(1, ncol(woodmouse), by=3) ]
## 15 DNA sequences in binary format stored in a matrix.
##
## All sequences of same length: 322
##
## Labels: No305 No304 No306 No0906S No0908S No0909S ...
##
## Base composition:
## a c g t
## 0.285 0.238 0.219 0.258
#skipping the thrid codon
woodmouse[, -seq(1, ncol(woodmouse), by=3) ]
## 15 DNA sequences in binary format stored in a matrix.
##
## All sequences of same length: 643
##
## Labels: No305 No304 No306 No0906S No0908S No0909S ...
##
## Base composition:
## a c g t
## 0.318 0.273 0.079 0.330
Ok, really good thanks!
I might not understand the command
AlignmentToFilter[, -seq(1, ncol(AlignmentToFilter), by=3) ]
.. but it is apparently skipping the first codon position in my hand while commandAlignmentToFilter[, -seq(3, ncol(AlignmentToFilter), by=3) ]
worked for me and omitted the 3rd codon position.