Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/SNPRelate_Main.r
To perform hierarchical cluster analysis on the dissimilarity matrix
1 | snpgdsHCluster(dist, sample.id=NULL, need.mat=TRUE, hang=0.25)
|
dist |
an object of "snpgdsDissClass" from |
sample.id |
to specify sample id, only work if dist is a matrix |
need.mat |
if TRUE, store the dissimilarity matrix in the result |
hang |
The fraction of the plot height by which labels should hang below the rest of the plot. A negative value will cause the labels to hang down from 0. |
Call the function hclust
to perform hierarchical cluster analysis,
using method = "complete"
.
Return a list (class "snpgdsHCClass"):
sample.id |
the sample ids used in the analysis |
hclust |
an object returned from |
dendrogram |
|
dist |
the dissimilarity matrix, if |
Xiuwen Zheng
snpgdsIBS
, snpgdsDiss
, snpgdsCutTree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # open an example dataset (HapMap)
genofile <- openfn.gds(snpgdsExampleFileName())
pop.group <- as.factor(read.gdsn(index.gdsn(genofile, "sample.annot/pop.group")))
pop.level <- levels(pop.group)
diss <- snpgdsDiss(genofile)
hc <- snpgdsHCluster(diss)
rv <- snpgdsCutTree(hc)
rv
# call 'plot' to draw a dendrogram
plot(rv$dendrogram, leaflab="none", main="HapMap Phase II")
# the distribution of Z scores
snpgdsDrawTree(rv, type="z-score", main="HapMap Phase II")
# draw dendrogram
snpgdsDrawTree(rv, main="HapMap Phase II",
edgePar=list(col=rgb(0.5,0.5,0.5, 0.75), t.col="black"))
# close the genotype file
closefn.gds(genofile)
|
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
Hint: it is suggested to call `snpgdsOpen' to open a SNP GDS file instead of `openfn.gds'.
Individual dissimilarity analysis on genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 1 SNP (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
Working space: 279 samples, 8,722 SNPs
using 1 (CPU) core
Dissimilarity: the sum of all selected genotypes (0,1,2) = 2446510
Dissimilarity: Wed Nov 15 06:09:11 2017 0%
Dissimilarity: Wed Nov 15 06:09:13 2017 100%
Determine groups by permutation (Z threshold: 15, outlier threshold: 5):
Create 3 groups.
$sample.id
[1] "NA19152" "NA19139" "NA18912" "NA19160" "NA07034"
[6] "NA07055" "NA12814" "NA10847" "NA18532" "NA18561"
[11] "NA18942" "NA18940" "NA18515" "NA19222" "NA18508"
[16] "NA19129" "NA12056" "NA10863" "NA10857" "NA12006"
[21] "NA18605" "NA18542" "NA18945" "NA18949" "NA19238"
[26] "NA19194" "NA19142" "NA18913" "NA12145" "NA12763"
[31] "NA07357" "NA12144" "NA18550" "NA18608" "NA18964"
[36] "NA18953" "NA19154" "NA19138" "NA18852" "NA19120"
[41] "NA07019" "NA10831" "NA07000" "NA11832" "NA18564"
[46] "NA18961" "NA18972" "NA19210" "NA19204" "NA18507"
[51] "NA19159" "NA06991" "NA11840" "NA12802" "NA12813"
[56] "NA18571" "NA18620" "NA18967" "NA18976" "NA19211"
[61] "NA18516" "NA18523" "NA12761" "NA10830" "NA10855"
[66] "NA18623" "NA18576" "NA18981" "NA18971" "NA18862"
[71] "NA19205" "NA19101" "NA19102" "NA06994" "NA11993"
[76] "NA11995" "NA12891" "NA18582" "NA18633" "NA18994"
[81] "NA18872" "NA19192" "NA19172" "NA19092" "NA12864"
[86] "NA12751" "NA10839" "NA12717" "NA18637" "NA18594"
[91] "NA18998" "NA19000" "NA12753" "NA12707" "NA11839"
[96] "NA10859" "NA18526" "NA18524" "NA18529" "NA18558"
[101] "NA18502" "NA19145" "NA18505" "NA18856" "NA12875"
[106] "NA12156.dup" "NA12156" "NA07056" "NA18562" "NA18537"
[111] "NA18603" "NA18540" "NA19153" "NA19137" "NA19202"
[116] "NA19239" "NA12044" "NA11992" "NA11829" "NA07022"
[121] "NA18545" "NA18572" "NA18547" "NA18609.dup" "NA18857"
[126] "NA19238.dup" "NA18501" "NA19240" "NA06993.dup" "NA12239"
[131] "NA12154" "NA12762" "NA18609" "NA18552" "NA18611"
[136] "NA18555" "NA19223" "NA18500" "NA18861" "NA12716"
[141] "NA12878" "NA10856" "NA12874" "NA18566" "NA18563"
[146] "NA18570" "NA18612" "NA19201" "NA19144" "NA19193"
[151] "NA18503" "NA12760" "NA11993.dup" "NA06985" "NA12003"
[156] "NA18621" "NA18594.dup" "NA18622" "NA18573" "NA18504"
[161] "NA19203" "NA19143" "NA18871" "NA07348" "NA12750"
[166] "NA11831" "NA10835" "NA18577" "NA18624" "NA18579"
[171] "NA18632" "NA18870" "NA19200" "NA18517" "NA19221"
[176] "NA12146" "NA11882" "NA18635" "NA18592" "NA18636"
[181] "NA18593" "NA18863" "NA18855" "NA18862.dup" "NA19209"
[186] "NA18951.dup" "NA18943" "NA18947" "NA18944" "NA18521"
[191] "NA18858" "NA19141" "NA19093" "NA10861" "NA12005"
[196] "NA10851" "NA12234" "NA18948" "NA18951" "NA18952"
[201] "NA18956" "NA19099" "NA18854" "NA19132" "NA12004"
[206] "NA07345" "NA07029" "NA12892" "NA18968" "NA18959"
[211] "NA18969" "NA18960" "NA19206" "NA18506" "NA19098"
[216] "NA19130" "NA07048" "NA10854" "NA12248" "NA10846"
[221] "NA18965" "NA18973" "NA18966" "NA18975" "NA19128"
[226] "NA19131" "NA18522" "NA19208" "NA12801" "NA12872"
[231] "NA12155" "NA06993" "NA18978" "NA18970" "NA18980"
[236] "NA18995.dup" "NA18859.dup" "NA19116" "NA18914" "NA19127"
[241] "NA11830" "NA12865" "NA10838" "NA12249" "NA18974"
[246] "NA18987" "NA18990" "NA18991" "NA19094" "NA19161"
[251] "NA18853" "NA19173" "NA12057" "NA10860" "NA12812"
[256] "NA11881" "NA18992" "NA18995" "NA18997" "NA19012"
[261] "NA19171" "NA19140" "NA18859" "NA19119" "NA11994"
[266] "NA12873" "NA12815" "NA19005" "NA18999" "NA19007"
[271] "NA19003" "NA18860" "NA19207" "NA19100" "NA19103"
[276] "NA12740" "NA12752" "NA12043" "NA12264"
$z.threshold
[1] 15
$outlier.n
[1] 5
$samp.order
[1] 83 252 261 1 37 113 50 15 214 227 62 190 251 39 203 139 182 70
[19] 184 226 204 216 82 26 150 237 263 191 272 114 2 38 193 84 249 72
[37] 73 275 162 102 149 48 60 185 240 16 225 51 4 250 104 125 183 262
[55] 27 192 273 213 228 215 202 274 3 116 128 25 126 28 239 137 14 175
[73] 101 127 138 173 115 148 172 81 163 238 40 264 161 49 71 103 151 160
[91] 61 13 174 198 171 180 78 9 33 124 133 110 144 56 269 24 257 91
[109] 233 212 260 11 247 146 147 99 109 67 111 169 34 21 178 89 168 156
[127] 10 22 98 100 145 179 136 79 121 57 181 112 246 201 268 245 122 259
[145] 158 187 47 92 46 270 35 234 224 90 157 68 222 200 97 134 248 235
[163] 186 199 170 223 36 189 221 188 210 58 12 209 80 236 258 23 271 69
[181] 211 123 45 59 135 66 159 265 76 194 152 63 277 205 155 243 53 95
[199] 218 30 93 132 5 6 217 75 153 118 254 129 232 52 154 108 41 120
[217] 208 77 141 7 54 267 86 165 276 20 87 195 117 19 278 105 143 242
[235] 140 88 94 197 18 279 106 107 42 231 74 43 207 241 119 142 253 17
[253] 196 130 8 176 64 131 166 44 65 32 29 220 55 229 255 177 96 256
[271] 230 85 266 219 167 244 31 164 206
$samp.group
[1] G001 G001 G001 G001 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001
[16] G001 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003
[31] G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003 G003 G002
[46] G002 G002 G001 G001 G001 G001 G003 G003 G003 G003 G002 G002 G002 G002 G001
[61] G001 G001 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003
[76] G003 G003 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003 G003 G002 G002
[91] G002 G002 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003
[106] G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003 G003
[121] G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003 G003 G002 G002 G002
[136] G002 G001 G001 G001 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001
[151] G001 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003
[166] G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G002 G002 G002
[181] G002 G001 G001 G001 G001 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003
[196] G003 G003 G002 G002 G002 G002 G001 G001 G001 G003 G003 G003 G003 G002 G002
[211] G002 G002 G001 G001 G001 G001 G003 G003 G003 G003 G002 G002 G002 G002 G001
[226] G001 G001 G001 G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001
[241] G003 G003 G003 G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003
[256] G003 G002 G002 G002 G002 G001 G001 G001 G001 G003 G003 G003 G002 G002 G002
[271] G002 G001 G001 G001 G001 G003 G003 G003 G003
Levels: G001 G002 G003
$dmat
G001 G002 G003
G001 0.9532539 1.0965483 1.0956439
G002 1.0965483 0.8313777 0.9752263
G003 1.0956439 0.9752263 0.8966300
$dendrogram
'dendrogram' with 2 branches and 279 members total, at height 1.096101
$merge
z n1 n2
1 0.0000000 1 1
2 0.0000000 1 1
3 0.0000000 1 1
4 0.0000000 1 1
5 0.0000000 1 1
6 0.0000000 1 1
7 0.0000000 1 1
8 0.0000000 1 1
9 0.0000000 1 1
10 0.0000000 1 1
11 0.0000000 1 1
12 0.0000000 1 1
13 0.0000000 1 1
14 0.0000000 1 1
15 0.0000000 1 1
16 0.0000000 1 1
17 0.0000000 1 1
18 0.0000000 1 1
19 0.0000000 1 1
20 0.0000000 1 1
21 0.0000000 1 1
22 0.0000000 1 1
23 0.0000000 1 1
24 0.0000000 1 1
25 0.0000000 1 1
26 0.0000000 1 1
27 0.0000000 1 1
28 0.0000000 1 1
29 0.0000000 1 1
30 0.0000000 1 1
31 0.0000000 1 1
32 0.0000000 1 1
33 0.0000000 1 1
34 0.0000000 1 1
35 0.0000000 1 1
36 0.0000000 1 1
37 0.0000000 1 1
38 0.0000000 1 1
39 0.0000000 1 1
40 0.0000000 1 1
41 0.0000000 1 1
42 0.0000000 1 1
43 0.0000000 1 1
44 0.0000000 1 1
45 0.0000000 1 1
46 0.0000000 1 1
47 0.0000000 1 1
48 0.0000000 1 1
49 0.0000000 1 1
50 0.0000000 1 1
51 0.0000000 1 1
52 0.0000000 1 1
53 0.0000000 1 1
54 0.0000000 1 1
55 0.0000000 1 1
56 0.0000000 1 1
57 0.0000000 1 1
58 0.0000000 1 1
59 0.0000000 1 1
60 0.0000000 1 1
61 1.3638282 1 2
62 0.0000000 1 1
63 0.0000000 1 1
64 0.0000000 1 1
65 0.0000000 1 1
66 0.0000000 1 1
67 0.0000000 1 1
68 0.0000000 1 1
69 0.0000000 1 1
70 0.0000000 1 1
71 1.4482647 2 2
72 0.7390494 1 2
73 0.7039434 1 2
74 0.7277381 1 2
75 0.7684354 1 2
76 0.7420365 1 2
77 0.7113715 1 2
78 0.7116093 1 2
79 0.7454017 1 2
80 0.7462467 1 2
81 0.7131430 1 2
82 0.7021757 1 2
83 0.7062733 1 2
84 0.7209080 1 2
85 0.7249172 1 2
86 0.7396840 1 2
87 1.3937387 2 2
88 0.7297161 1 2
89 1.4227964 2 2
90 0.7330108 1 2
91 0.7368740 1 2
92 0.7375057 1 2
93 0.7008112 1 2
94 0.7302575 1 2
95 0.7812503 1 2
96 0.0000000 1 1
97 0.7282952 1 2
98 1.4031132 2 2
99 0.0000000 1 1
100 0.7487250 1 2
101 1.3981013 1 2
102 0.7556895 1 2
103 0.7269099 1 2
104 0.0000000 1 1
105 1.2233716 1 2
106 0.0000000 1 1
107 0.0000000 1 1
108 0.0000000 1 1
109 0.0000000 1 1
110 0.0000000 1 1
111 0.0000000 1 1
112 1.0121914 1 3
113 0.0000000 1 1
114 0.0000000 1 1
115 0.0000000 1 1
116 1.3900229 1 2
117 1.5793353 1 3
118 0.0000000 1 1
119 0.0000000 1 1
120 1.4160020 1 2
121 1.1546490 2 2
122 1.2960775 1 4
123 1.4370767 1 2
124 0.0000000 1 1
125 0.7735091 1 2
126 0.0000000 1 1
127 0.0000000 1 1
128 1.7215734 2 3
129 1.4120242 4 5
130 0.9099560 1 2
131 1.4216617 1 2
132 1.3264103 1 2
133 0.0000000 1 1
134 0.0000000 1 1
135 1.2222259 2 2
136 1.3172536 3 4
137 0.9986064 1 3
138 1.2827773 3 5
139 0.0000000 1 1
140 0.0000000 1 1
141 1.0053367 1 2
142 1.0791136 9 2
143 0.0000000 1 1
144 0.0000000 1 1
145 0.0000000 1 1
146 2.1550224 8 11
147 0.0000000 1 1
148 2.2803589 4 3
149 0.7278600 1 2
150 1.6396708 1 3
151 1.2629575 2 2
152 0.0000000 1 1
153 1.3425754 3 7
154 0.0000000 1 1
155 2.9806043 19 10
156 2.7360316 3 4
157 0.0000000 1 1
158 0.9677148 1 2
159 2.1413513 4 29
160 1.3152406 1 2
161 2.0986760 4 33
162 1.4037635 1 7
163 2.2153429 2 7
164 0.7416932 1 2
165 0.7139170 1 2
166 1.3664105 1 2
167 2.2075469 2 9
168 2.0558042 2 37
169 4.8275532 8 11
170 0.7445724 1 2
171 1.5049564 1 39
172 2.1031931 2 40
173 5.7638138 19 42
174 0.7136383 1 2
175 2.2505817 2 3
176 2.0833239 3 3
177 1.5823281 2 5
178 3.0362998 61 6
179 0.0000000 1 1
180 0.7538566 1 2
181 3.4212450 7 67
182 1.8038069 2 74
183 0.7223233 1 2
184 1.8257049 2 76
185 0.0000000 1 1
186 0.0000000 1 1
187 0.7130895 1 2
188 1.4113170 1 2
189 2.2943400 2 78
190 2.2057341 2 80
191 0.7297567 1 2
192 2.2930268 2 82
193 0.7591149 1 2
194 2.3454544 2 84
195 0.7623672 1 2
196 2.9394231 3 86
197 1.6890431 1 89
198 1.7646686 1 90
199 0.7249850 1 2
200 0.7759160 1 2
201 2.9073371 2 91
202 0.7551952 1 2
203 0.7399055 1 2
204 0.7440729 1 2
205 2.3509376 1 93
206 0.7365277 1 2
207 0.7188603 1 2
208 0.8232728 1 2
209 0.7001525 1 2
210 0.7363890 1 2
211 0.7405525 1 2
212 1.4279717 2 2
213 0.7949090 1 2
214 0.7295879 1 2
215 0.7358765 1 2
216 0.7030017 1 2
217 2.2742015 2 4
218 1.6858063 1 3
219 2.3076343 3 3
220 2.2960735 3 3
221 2.7978060 3 6
222 2.8029092 4 3
223 1.9760874 2 3
224 2.3183594 3 3
225 3.1688945 3 9
226 2.9944673 4 6
227 3.4629145 3 12
228 2.3832674 3 3
229 2.3167512 3 3
230 3.6151112 3 15
231 3.2563177 3 10
232 4.1190719 5 18
233 4.3947157 6 23
234 2.8715075 3 6
235 6.0623840 13 29
236 4.3481450 6 42
237 2.8108986 3 4
238 5.0202097 9 48
239 3.1398046 3 57
240 2.3079567 3 3
241 2.9023338 3 60
242 4.7201573 7 63
243 4.5254452 7 70
244 3.0192113 3 77
245 3.1013724 3 80
246 5.4676640 6 83
247 1.6013843 1 6
248 4.6169105 3 89
249 2.1043249 3 3
250 3.5383167 3 7
251 2.2793199 3 3
252 2.2651791 3 3
253 4.4028787 10 6
254 2.3349294 3 3
255 2.2273269 3 3
256 2.4156476 3 3
257 3.1724305 3 16
258 2.7574660 3 6
259 3.0975448 3 19
260 2.8206617 3 6
261 4.2840453 6 22
262 2.8387700 3 6
263 3.3169135 4 6
264 5.1225656 28 9
265 3.3837329 4 9
266 4.8340190 9 37
267 6.0792923 13 46
268 5.7356409 10 59
269 2.3525896 3 3
270 2.9337775 3 69
271 2.8125204 3 6
272 5.4512446 72 9
273 3.1129065 3 81
274 3.0198300 3 84
275 3.0102429 3 87
276 3.7517016 3 90
277 118.8427088 94 92
278 61.0507005 93 186
$clust.count
cluster
G001 G002 G003
93 94 92
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.