Search
Question: Using log2FC distance matrix in Boot.Phylo to create bootstrapped trees
0
5 months ago by
Larry K.0
Larry K.0 wrote:

Hi,

I have a raw gene expression data matrix (data; matrix of 5000 rows [genes] and 100 columns [samples]). I want to take the log2FC distance matrix generated from plotMDS and run that through boot.phylo. I want to do this because I want to take their exact method for calculating log2FC on an abbreviated list of the top 500 genes. The problem appears to be how I am writing out the function step. Any help is appreciated.

Larry

d<-DGEList(data, group=group)

###Group membership is assigned in a different step. That's not the problem.

MDS<-plotMDS(d, gene.selection = "common")

###I want to take the MDS$distance.matrix and take it through boot.phylo. ###The matrix is asymmetrical, so I make it symmetrical first. MDSmatrix<-as.data.frame(MDS$distance.matrix)
upper<-t(MDSmatrix)
symmetrical.matrix<-upper + MDSmatrix
matrix<-as.matrix(symmetrical.matrix)
dist.matrix<-as.dist(matrix)
data.nj<-nj(dist.matrix)

####Now, put this into boot.phylo

pdf("Tree.pdf")
data.func<- function(x) nj(plotMDS(DGEList(x, group = group))gene.selection="common")
node.prob.1000<-boot.phylo(data.nj, data, data.func, B=1000)
plot(data.nj)
nodelabels(node.prob.1000)
mtext("log2 FC",  outer= T, cex = 1.4, font=2)
dev.off()