How to plot dendrogram based on sample names
Hi,
I do have FPKM count and interested in dendrogram for samples cluster.
I used below code but it generate dendogram based on geneID instead of sampleID.
> countMatrix = read.table("Trinity_trans.counts.matrix.txt",header=T,sep='\t',check.names=F,row.names=1)
> dim(countMatrix)
[1] 142686 6
> head(countMatrix)
AS_0DAP AS_4DAP AS_8DAP NMK_0DAP NMK_4DAP NMK_8DAP
TRINITY_DN17944_c0_g1_i11 14.32 24.63 8.21 4.54 20 8.49
TRINITY_DN7591_c0_g1_i1 0.00 0.00 1.00 3.00 3 0.00
TRINITY_DN28918_c0_g1_i1 1.00 2.00 1.00 0.00 2 0.00
TRINITY_DN14082_c2_g2_i5 6.00 5.00 1.00 0.00 1 0.00
TRINITY_DN31994_c0_g1_i1 1.00 2.00 0.00 0.00 0 3.00
TRINITY_DN19560_c0_g1_i1 1.00 3.00 0.00 0.00 1 1.00
> rv <- rowVars(countMatrix)
> summary(rv)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.000e+00 1.000e+00 1.500e+01 3.570e+05 5.180e+02 4.122e+09
> (q75 <-quantile(rowVars(countMatrix), .75))
75%
518.3202
> m2 <- countMatrix[rv >q75, ]
> dim(m2)
[1] 35672 6
> summary(rowVars(m2))
Min. 1st Qu. Median Mean 3rd Qu. Max.
5.180e+02 1.670e+03 6.677e+03 1.428e+06 4.101e+04 4.122e+09
> d <- dist(m2, method="euclidean")
> h <-hclust(d, method="complete")
> plot(h)
I will be thankful for your time and help.
Regards
nabiyogesh
• 75 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello Bioinfonext
Duplicate of How to plot dendrogram based on sample names
For this reason we have closed your question.
sorry, by mistake I post it again.
Thanks bioinfonext
Absolutely no problem.