Search code examples
rdendrogrambipartitephylogeny

Picante's pblm error: "Error in V1[rownames (assocs), rownames(assocs)]: subscript out of bounds"


I am trying to calculate signal strength using the pblm function from picante (for phylocom integration) in R. It seems like I don't understand how the input should be constructed. I built a simple example to test out the program with 2 simple phylogenetic trees (dendrograms) and a matrix for their association strength:

require(ape)
require(picante)

tree1<-read.tree(text="((C,B),A);")
tree2<-read.tree(text="((G,F),(E,D));")

web = matrix(
c(0, 5, 0, 10, 10, 0, 0, 3, 0, 0, 0, 1),
nrow=4,
ncol=3,
byrow = TRUE,
dimnames = list(c("D","E","F","G"),c("A","B","C")))

pblm(web,tree1=tree1,tree2=tree2)

However, this results in the following error:

Error in V1[rownames(assocs), rownames(assocs)] : subscript out of bounds

What is wrong with my input in pblm?


Solution

  • The error means that the function calls a row that is not present in the provided data. Here, the problem was that the matrix was transposed.

    pblm(t(web), tree1=tree1, tree2=tree2)