Issue with assigning data as a matrix

Hey guys,

sorry if I make mistakes, but I'm trying to create a phylogenetic tree using the ape package. However, I've come across a problem where I'm not able to assign my data as a matrix. I think that's what I'm doing anyway.

Here's the code:

library(ape)

DNAL <- read.dna("AllSequences.aln", format = "clustal", as.matrix = TRUE)

My data are a clustal of DNA sequences found here: DNA sequences - Pastebin.com

I keep coming across an error saying
"Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent"

what is going on here?

Thanks for the help!

I think I fixed it, it believe it was due to the dashes on the first part of my DNA sequences!!

1 Like

It looks like maybe the first line is causing you some trouble:

CLUSTAL 2.1 multiple sequence alignment

If I add skip = 1 to the read.dna() function, it looks like it's able to read in the file:

DNAL <- read.dna("AllSequences.aln", format = "clustal", as.matrix = TRUE, skip = 1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.