First parameter of as.DNAbin
should be a matrix or a list containing the DNA sequences, or an object of class "alignment". So, your idea is right.
Given x
is the structure from original post, the code below prepares matrix y
:
y <- t(sapply(strsplit(x[,2],""), tolower))
rownames(y) <- x[,1]
Then as.DNAbin(y)
shows:
4 DNA sequences in binary format stored in a matrix.
All sequences of same length: 83
Labels: 55548 43297 35309 34468
Base composition:
a c g t
0.289 0.262 0.205 0.244