2
$\begingroup$

I have been attempting to extract particular clusters, given by hierarchical clustering outputs from the pheatmap function (in R).

Please find the dput output of the dataset in question below:

structure(list(`72v24.logFC` = c(-1.47511280138092, -1.10386310802134, 
-1.14476608274903, -1.63563574551239, -0.895377907265352, -1.35216488439027, 
-2.04949381135359, -1.0344565728341, -0.967008696515716, -1.11233305998901, 
-2.02663681865178, -1.74756562789736, -1.02076838668592, -1.27981009782201, 
-1.13181804725663, -1.19537930856639, -2.23476188503608, -1.67500131867632, 
-0.950059974858215, -2.3124598902615, -1.93757457440581, -3.24602437386808, 
-0.839869104053795, -1.40329424193006, -1.63484798229567, -0.912148120310492, 
-1.33467209346367, -1.27031027753064, -0.925498608058671, -0.802956638081314, 
-0.85457796397113, -1.0591348681193, -0.825278459132589, -0.671570119524199, 
-1.8439768319437, -0.947033608766851, -1.63849733567277, -1.40584263305038, 
-1.1317958487115, -1.40724695083764, -1.21842141154588, -2.29248800050516, 
-1.41699787526721, -0.879218050664484, -2.25064962332145, 1.4685855647974, 
-2.02553848518381, 1.32808748053321, -2.46062484389627, -2.45830217362141, 
-0.880536960021976, -0.689060222340137, -0.863262774594, -1.64961312646758, 
1.10572346456398, -0.891760767302047, -1.22716047163938, -0.680697741299578, 
-1.24551344420046, -0.891918251648935, -1.64722787848732, -0.832845262108387, 
-0.937129577660045, -0.891684122691785, 1.96452911491088, -1.59420664438654, 
-0.921295293242016, -1.8304480291305, -0.632859040349798, 1.69982819847455, 
-0.982668795391973, -1.61816842714933, -1.23602172818196, -2.15356245206668, 
-1.67961932563564, 1.15478114880933, 1.32665444151868, -1.04590896017973, 
-2.29770026795487, -1.27498150009975, -1.36310217581123, -1.09169550738617, 
1.5349413586602, -1.66842984591719, -0.760122936706606, -1.10054393155051, 
-1.00344072779106, -0.993259123487476, -1.43136824963825, -1.07214189069438, 
-0.990813303020613, -1.51324812740189, -1.23465012540084, -1.00098231964124, 
-1.92195764952845, -1.00139179559519, -0.940118366042393, -2.35969198434574, 
-0.574626090826994, -0.884870428965888, -0.87601460107501, 1.61336157755029, 
-0.777670642457121, -0.7312214522498, -0.812926777785119, -1.13443421373561, 
-1.56498420350444, -0.69126972981765, -1.44351026281231, -1.21962275860236, 
-2.21155555407497, -1.02015250027788, -0.604620179871691, -1.53013572266942, 
-0.790050747397837, -1.17950736026735, -0.781075150161975, -0.888554144538286, 
3.59172865862026, -0.8665071699621, -2.97701792242157, -1.44424941630738, 
-1.50528882788757, -0.772465957539335, -1.57664185213987, -1.02371443439054, 
-0.931807409493221, 1.77728969821973, -1.05455101137715, -1.09765136526264, 
-0.881436416213335, -0.985605985458853, -1.31644334991692, 2.26917914828263, 
-1.43844640540614, -1.75106843701475, -1.22483991752173, -1.65032906954133, 
-0.686319914242903, 2.45473055753775, -1.15594379837188, 1.46397122502826, 
-0.91260428248088, -0.726540148411507, -1.18227838019011, -0.940722690371935, 
-1.28074043595918, -0.629033607437977, 1.01053893402133, -0.735590704487842, 
-2.0620695625823, -0.692251638781327, -0.717818968339447, -0.564023101160995, 
1.51541391124355, -1.89444914881727, -0.737931396419173, -1.17763728235316, 
-0.887605568116903, -2.8392997898765, -1.48018352596355, 1.60698486226092, 
-1.96804216410227, -0.881437183709851, 3.08730764755417, -0.600282670155725, 
-0.905719394102218, -1.05553935946213, -1.13508709782814, -0.613381276596874, 
-0.642647139688194, -0.861929974132332, -1.30652597213552, -1.73647794867498, 
-0.619909931049252, -0.880145154869759, -0.60084263914673, -1.16825573255754, 
-0.942919502394457, -1.3709930239358, -0.80595477526712, -0.628115199442632, 
-1.11502998682131, -1.01274335471793, -1.16595378001606, -3.36098944183559, 
-1.19617345920841, -2.10811718229285, 3.33752122936, -1.67696701892834, 
-1.90639199489612, -0.574737209544065, -1.66853541929234, -0.595093777485911, 
-0.7964813653225, -0.791102813817634, -0.601987407016077, -1.52559881980829, 
1.15480324851026, -0.830167728660421), `72v0.logFC` = c(-5.10937036648522, 
-8.41670756910048, -8.18671783299995, -2.79415692883273, -3.62090016917187, 
-8.37523504570539, -3.79100494829738, -7.20659380156151, -5.46135634576091, 
3.43493215839382, -1.67650075643956, -2.99391647274475, -5.77357941089076, 
-5.22675557853878, 3.26436094268851, -5.98693257837598, -5.85864442290848, 
-2.39995052889286, -5.19221784614079, -4.72634343497625, -7.46407809296449, 
-3.04588366694082, -3.85014181238163, 4.44756662720351, -4.42031795110716, 
-2.58478993868624, -5.46121416816988, -2.09364835701952, -5.42397023596482, 
-5.26192471384563, -4.48979100280513, -5.14171942073048, -5.5267515390142, 
3.88762033289334, -5.88489034628499, -2.85490179670763, -5.31586479048071, 
-2.64877712735579, -6.24766069294439, -5.35826818217055, -4.97204642950896, 
-2.82989963758335, -4.75016577988789, -3.51684070536132, -3.20931950649022, 
-3.62394584217955, -2.81449967053025, -5.68308664428684, -3.11500402887324, 
-4.08965188145047, -5.43176189260205, -4.30737780091769, 2.52666133143524, 
-3.88213803962076, -5.517506523237, -3.27502948978619, -5.37724717693793, 
2.77090845859761, -4.22554364178978, -5.81944792042417, -2.23700806354102, 
-1.81804660477942, -3.45613077773548, -4.88444075082709, -5.48877199958173, 
-4.90077849970695, -3.79304730634383, -0.953597409660203, -5.573920008042, 
-1.83250444732307, -1.73248469438834, -2.35460087734472, -4.43029236446579, 
-3.37654864236982, -3.63410171518379, -2.78276966423079, -2.01664452557169, 
-3.54834187597395, -2.04395822264753, -2.15693095907293, -4.04759665569609, 
-4.87928960250415, 1.1358557257212, -4.89657506999093, -2.42698466771808, 
-4.55703295523896, -2.53230009478764, -1.74571568381108, 1.93875826054123, 
-2.29178704384166, -1.88631492984573, -4.17811684330152, -4.55155213716622, 
1.93093495783903, -3.66429213603731, 2.73817157445051, -3.96977406502995, 
-4.18487497756956, 2.17512996773018, -4.41168757499049, -2.96267804428878, 
-4.60683474159913, -3.0573109426718, -1.59500391193586, -4.65882130908176, 
-2.68903554919404, -4.44676809434802, 1.60275224879078, -3.83760729167497, 
-3.09907199540008, -2.37905633686461, -4.29650784478684, -1.88615561094275, 
-4.44026540480975, -2.01996858091239, -2.46842498723876, -4.24053886261736, 
-4.32561109033911, -2.96097578889787, -3.76708395833968, -2.45229520135946, 
-2.33856203921674, -4.23241140779399, -3.48627475173498, 2.25888018977625, 
-3.85271202182208, -4.61317704601435, -1.95186634348091, 1.3205477461731, 
-2.51561846705872, -1.7031812569795, -4.44717736673796, -3.88478215160905, 
-3.27547652595564, -2.81690169904308, -4.83981492357284, -2.4486942125238, 
-4.31360736969916, -4.22122930700826, -3.49045260391997, -2.87862947524065, 
-4.14268228866617, -2.62252967420329, -4.23902905919912, -4.14777621540367, 
-2.86056694414781, -1.70668584273452, 1.3624660569909, -2.59153842674144, 
-4.12393693326418, -2.12959469550212, 1.46923996462969, -1.98633421258236, 
3.22176343046404, -3.52110060349997, -2.69900299957347, -4.20126962458439, 
-4.68116989520068, 1.57592717464553, -3.93999603065316, -2.79446235029201, 
1.53128139579193, 2.65531461899762, -1.33692502254506, -1.40309746138702, 
7.1503230589606, -3.03232696595877, -3.99799016693196, 1.36106448869886, 
2.48321747034381, -1.81760324077147, -2.93792828398095, -4.24318581706171, 
-5.02935968459404, -2.8067837982494, -3.18182441332852, -3.17383228514224, 
-3.75210155230786, -3.87059449392306, -3.38923922246314, -3.8492188722049, 
-4.54207754798088, -3.65594980956956, -4.083692310451, 1.30846845334021, 
-2.14067263149232, 0.87594188820449, -2.36549598411797, -1.6026649015159, 
3.06122694909985, -2.80125769402892, -1.21061533381979, 2.45621751938726, 
-1.29479960958983, -1.32215076834374, -3.40665434275434, -3.87581533996246, 
2.25817917663687, -4.47531796954113, -3.0627832955887), `24v0.logFC` = c(-5.63038870666508, 
-6.44381761773614, -9.71855520117086, 2.83617729007977, -3.39220401105853, 
-9.03206578896647, 4.72316302034493, 2.69600384046815, -3.70005627557764, 
1.57004091545159, -2.69837465613229, -1.96398920017231, -6.78881951127235, 
2.88395305274553, 2.2815237548239, 4.26299665984366, 1.80759581466942, 
-6.13159865127454, 2.31984691801986, 2.42017005000243, 1.90522291464817, 
-6.08799743507621, 1.93712248733409, -2.85900752558212, -2.53314737897312, 
-5.39825301043452, -2.67723981805717, 1.99371094854688, -6.30018858053764, 
-5.51269257077614, 1.22241656195939, 2.21258569930309, -3.34360626488873, 
2.84622416535537, 1.62066860166637, -4.78372642162402, -5.70058663575352, 
-5.38484766744183, -5.09622306588101, 1.4720608195385, 2.81999896316429, 
-5.00082275569591, -4.22688753149231, 3.13575564914666, -3.65108053066376, 
-4.96357882349085, 1.41296031244116, 2.02777799934303, -2.69828900301196, 
3.3280993785528, -4.91524305899842, 1.33559456145784, -3.20704073441948, 
3.4589509748052, -4.76220190139647, -5.41080867153898, -2.52368474702804, 
2.35227625126478, -1.66843249760588, -5.98409816921998, 1.97783827997787, 
-5.05713668502354, -5.66050145489872, -3.23578154397873, -5.47590590732768, 
1.79478248294125, 1.53715323981994, 1.17924158724962, -3.38135082340585, 
-6.0533528170201, 3.64133939415158, -5.18911327526881, 1.12836935335145, 
-5.50962223997537, -5.13018380364927, 2.43347308480167, 3.09821960202745, 
1.08371028206663, 1.15073045150599, 1.66618928654645, -4.57926216582183, 
-4.39710926752864, 2.29767598663356, 1.11369483753166, 1.90655785334723, 
-4.57402537033236, -1.64795888694238, -4.90903507231585, -4.69225607476014, 
-3.78658812613927, 2.71158710397443, 2.0014280958994, 1.42976609883019, 
1.69469179645011, 2.02542067939079, 1.29620189704961, -2.11262483065018, 
-4.45917113273047, -5.00209626672923, -2.22313144605634, 2.28015100958449, 
2.99018492359164, -4.55487718731015, -4.4548605761304, -2.74564764773372, 
1.50453692418261, -1.80916071906589, -3.78464149018, 5.44303553967597, 
1.63876298449708, -2.55262897048338, -4.52516489294599, 1.86420921266273, 
1.92394285952202, -1.87942876800687, -4.72261410600152, -2.57805004195914, 
-4.47016439150427, -2.79823793519691, 1.49664827810044, -5.12377787039451, 
-1.64302437544027, -2.32977998370269, -1.54481646746192, 1.51575792656483, 
-1.66914425228449, -5.67499677983564, -2.41648326328024, 1.4178331810756, 
1.34477707145884, 1.6168542644666, 1.51101526992765, 2.85584943327062, 
-4.19149110174371, 1.69988651757158, 2.42852927065545, 1.66468253437414, 
3.21304236161755, 2.52923647014318, -3.32575501787469, 1.32217968706286, 
-4.3404208961354, 1.60065358035513, 1.11559852847827, 2.24622871386089, 
-2.07936338453629, -4.096641542765, -1.81072034410725, -1.71317603678557, 
3.48120770906848, -3.87801910383696, -4.08020770103266, 1.11478378387699, 
-3.46079055745071, 1.7322630648363, 1.54861321913459, 1.96850013686628, 
2.50282552968501, -1.81077760463368, 2.02487013804019, 1.95047564703855, 
-2.99930567848563, -1.79193606152703, -2.54724389366544, -4.15112678166129, 
1.13069494609896, -1.43241741260756, 2.36383913233529, 1.65786717131242, 
-2.29507370488367, 1.5786351022915, -3.31042999789919, 2.582031624397, 
-3.62438687496853, -4.20056844288066, 1.59787844454997, -4.39077226372811, 
-4.50758458577604, -3.5310616440773, 1.34960913912344, 1.56097908933761, 
1.80910781056029, -4.1248594098749, 1.5318048796277, -3.97753680837585, 
-2.80501778688795, -3.20129716412254, -1.98305552020422, -4.25045728757901, 
-4.08742040090535, -4.31190449886363, 1.39895836419766, 1.67102855271528, 
-5.13520809951127, -4.31701572736756, 0.832778953035371, 2.30899115735356, 
-3.18620970041199, -3.80052092618969, 1.59131320240714)), row.names = c("ENSMUSG00000097417.1", 
"ENSMUSG00000084950.7", "ENSMUSG00000021824.12", "ENSMUSG00000085505.1", 
"ENSMUSG00000018381.15", "ENSMUSG00000098716.1", "ENSMUSG00000092134.1", 
"ENSMUSG00000097272.1", "ENSMUSG00000039206.13", "ENSMUSG00000097860.1", 
"ENSMUSG00000047880.14", "ENSMUSG00000087700.1", "ENSMUSG00000094127.1", 
"ENSMUSG00000101162.2", "ENSMUSG00000079179.9", "ENSMUSG00000107317.1", 
"ENSMUSG00000102451.1", "ENSMUSG00000098609.1", "ENSMUSG00000109669.1", 
"ENSMUSG00000086836.1", "ENSMUSG00000092545.7", "ENSMUSG00000106093.1", 
"ENSMUSG00000090625.1", "ENSMUSG00000009585.17", "ENSMUSG00000047988.1", 
"ENSMUSG00000027950.7", "ENSMUSG00000086430.1", "ENSMUSG00000105941.1", 
"ENSMUSG00000004071.12", "ENSMUSG00000104208.1", "ENSMUSG00000022223.8", 
"ENSMUSG00000031145.15", "ENSMUSG00000047369.15", "ENSMUSG00000097347.1", 
"ENSMUSG00000086680.2", "ENSMUSG00000097660.1", "ENSMUSG00000002109.14", 
"ENSMUSG00000108524.1", "ENSMUSG00000067786.16", "ENSMUSG00000021485.13", 
"ENSMUSG00000097768.1", "ENSMUSG00000085437.8", "ENSMUSG00000086220.1", 
"ENSMUSG00000075576.12", "ENSMUSG00000102299.1", "ENSMUSG00000079293.11", 
"ENSMUSG00000090952.2", "ENSMUSG00000040723.14", "ENSMUSG00000027329.9", 
"ENSMUSG00000106005.1", "ENSMUSG00000085425.1", "ENSMUSG00000046027.17", 
"ENSMUSG00000006517.5", "ENSMUSG00000004221.16", "ENSMUSG00000049775.16", 
"ENSMUSG00000109881.1", "ENSMUSG00000023988.8", "ENSMUSG00000092371.1", 
"ENSMUSG00000087611.1", "ENSMUSG00000102349.1", "ENSMUSG00000092103.2", 
"ENSMUSG00000089636.1", "ENSMUSG00000086360.1", "ENSMUSG00000036138.16", 
"ENSMUSG00000045382.6", "ENSMUSG00000090081.1", "ENSMUSG00000107999.1", 
"ENSMUSG00000041774.14", "ENSMUSG00000030720.16", "ENSMUSG00000027398.13", 
"ENSMUSG00000090246.1", "ENSMUSG00000104823.1", "ENSMUSG00000032528.4", 
"ENSMUSG00000100783.1", "ENSMUSG00000082848.1", "ENSMUSG00000021250.13", 
"ENSMUSG00000009292.17", "ENSMUSG00000109491.1", "ENSMUSG00000090252.1", 
"ENSMUSG00000087443.1", "ENSMUSG00000110148.1", "ENSMUSG00000085754.7", 
"ENSMUSG00000064339.1", "ENSMUSG00000091160.1", "ENSMUSG00000108332.1", 
"ENSMUSG00000108321.1", "ENSMUSG00000048721.2", "ENSMUSG00000032363.15", 
"ENSMUSG00000003868.14", "ENSMUSG00000107075.1", "ENSMUSG00000102961.1", 
"ENSMUSG00000096957.1", "ENSMUSG00000093006.2", "ENSMUSG00000109754.1", 
"ENSMUSG00000027774.16", "ENSMUSG00000090016.1", "ENSMUSG00000012126.16", 
"ENSMUSG00000074136.9", "ENSMUSG00000089875.1", "ENSMUSG00000092190.1", 
"ENSMUSG00000074213.2", "ENSMUSG00000086564.9", "ENSMUSG00000055725.11", 
"ENSMUSG00000028451.12", "ENSMUSG00000078786.9", "ENSMUSG00000092655.1", 
"ENSMUSG00000098482.1", "ENSMUSG00000087442.1", "ENSMUSG00000108574.1", 
"ENSMUSG00000087669.1", "ENSMUSG00000053442.4", "ENSMUSG00000101674.6", 
"ENSMUSG00000078653.4", "ENSMUSG00000108353.1", "ENSMUSG00000097748.1", 
"ENSMUSG00000050010.8", "ENSMUSG00000029623.14", "ENSMUSG00000097060.1", 
"ENSMUSG00000050627.13", "ENSMUSG00000092386.1", "ENSMUSG00000085471.1", 
"ENSMUSG00000087607.1", "ENSMUSG00000061607.14", "ENSMUSG00000026729.9", 
"ENSMUSG00000097854.1", "ENSMUSG00000064330.9", "ENSMUSG00000039753.16", 
"ENSMUSG00000027706.8", "ENSMUSG00000029360.3", "ENSMUSG00000103864.1", 
"ENSMUSG00000085208.3", "ENSMUSG00000073628.5", "ENSMUSG00000102776.1", 
"ENSMUSG00000032487.8", "ENSMUSG00000086998.1", "ENSMUSG00000006728.12", 
"ENSMUSG00000021273.9", "ENSMUSG00000062591.5", "ENSMUSG00000040936.14", 
"ENSMUSG00000002985.16", "ENSMUSG00000046145.7", "ENSMUSG00000038274.11", 
"ENSMUSG00000087366.7", "ENSMUSG00000039452.5", "ENSMUSG00000087660.1", 
"ENSMUSG00000087206.1", "ENSMUSG00000079355.3", "ENSMUSG00000086693.1", 
"ENSMUSG00000030579.10", "ENSMUSG00000084878.1", "ENSMUSG00000108235.1", 
"ENSMUSG00000097077.1", "ENSMUSG00000101438.1", "ENSMUSG00000087367.1", 
"ENSMUSG00000064351.1", "ENSMUSG00000086312.1", "ENSMUSG00000097221.1", 
"ENSMUSG00000107090.1", "ENSMUSG00000037982.16", "ENSMUSG00000095280.1", 
"ENSMUSG00000017837.12", "ENSMUSG00000029422.14", "ENSMUSG00000102564.1", 
"ENSMUSG00000026749.11", "ENSMUSG00000067288.12", "ENSMUSG00000025353.4", 
"ENSMUSG00000109251.1", "ENSMUSG00000086600.8", "ENSMUSG00000052214.9", 
"ENSMUSG00000090330.2", "ENSMUSG00000090009.1", "ENSMUSG00000059791.14", 
"ENSMUSG00000101695.1", "ENSMUSG00000103698.1", "ENSMUSG00000097472.1", 
"ENSMUSG00000084128.10", "ENSMUSG00000026156.8", "ENSMUSG00000075297.10", 
"ENSMUSG00000055692.18", "ENSMUSG00000038502.16", "ENSMUSG00000015942.9", 
"ENSMUSG00000106478.1", "ENSMUSG00000039307.16", "ENSMUSG00000054556.6", 
"ENSMUSG00000045576.16", "ENSMUSG00000037936.15", "ENSMUSG00000087486.1", 
"ENSMUSG00000082180.1", "ENSMUSG00000014470.4", "ENSMUSG00000056078.5", 
"ENSMUSG00000049928.15", "ENSMUSG00000013997.10", "ENSMUSG00000105198.1", 
"ENSMUSG00000086714.1", "ENSMUSG00000109274.1", "ENSMUSG00000100548.1", 
"ENSMUSG00000053706.2", "ENSMUSG00000109854.1", "ENSMUSG00000060802.8", 
"ENSMUSG00000093598.1"), class = "data.frame")

Please note, I have checked out many posts regarding this, most notably: https://www.biostars.org/p/287512/#287518, which highlights how to perform this procedure. Regardless, there are some unanswered questions.

The problem is the following: After running the code suggested in the post, I do indeed obtain x number of clusters, depending on the height I decide to cut the tree at. However, they are in an incomprehensible order, making it extremely difficult to extract the clusters as they are observed in the heatmap. Please note, the dataframe I have uploaded is only a snippet of the true data - and is called logFC_mat, in the code below:

pheatmap(logFC_mat, 
         show_rownames=F, cluster_cols=F, cluster_rows=T, scale="row",
         cex=1, clustering_distance_rows="euclidean", cex=1,
         clustering_distance_cols="euclidean", 
         clustering_method="complete", border_color=FALSE) -> heatof

#make clusters based on h=1.5
sort(cutree(heatof$tree_row, h=1.5)) -> hi_clusters

#check if clusters are in same order as in heatmap
hi_clusters[hi_clusters==1] %>% names() -> clust1
hi_clusters[hi_clusters==2] %>% names() -> clust2

length(clust1) #56
length(clust2) #78
all(clust1 %in% 
      rownames(logFC_mat[heatof$tree_row$order[1:56],])) #TRUE

all(clust2 %in%
      rownames(logFC_mat[heatof$tree_row$order[57:134],])) #FALSE

Now, from visual inspection of the heatmap, it becomes clear that cluster 2 is in fact the last 78 genes rather than the middle cluster. The problem is, why is it labeled as cluster 2 then !? In addition, this is a snippet of the data. The real data contains in fact thousands of rows, and so such visual deductions can simply be impossible.

Now for the question: How to extract the clusters, such that they are in the SAME ORDER, as what is seen in the heatmap (Top to bottom)?

Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

I would recommend not to use h to cut the tree but to use k, as k instructs the number of clusters to obtain, and then leaves it to the function to find the correct height for that. From there on you can easily extract the genes per cluster, for example with this code obtaining the first three clusters:


heatof <- 
pheatmap(logFC_mat, 
         show_rownames=F, cluster_cols=F, cluster_rows=T, scale="row",
         cex=1, clustering_distance_rows="euclidean", cex=1,
         clustering_distance_cols="euclidean", 
         clustering_method="complete", border_color=FALSE)

#/ extract the top three clusters
k <- 3
sort(cutree(heatof$tree_row, k=3)) -> hi_clusters

genes_per_cluster <- do.call(rbind, lapply(unique(hi_clusters), function(x){
  
  data.frame(cluster=x, gene=names(hi_clusters[hi_clusters %in% x]))
             
  
}))

genes_per_cluster
#>     cluster                  gene
#> 1         1  ENSMUSG00000097417.1
#> 2         1  ENSMUSG00000084950.7
#> 3         1 ENSMUSG00000021824.12
#> 4         1 ENSMUSG00000018381.15
#> 5         1  ENSMUSG00000098716.1
#> 6         1 ENSMUSG00000039206.13
#> 7         1 ENSMUSG00000047880.14
#> 8         1  ENSMUSG00000094127.1
#> 9         1  ENSMUSG00000098609.1
#> 10        1  ENSMUSG00000106093.1
#> 11        1 ENSMUSG00000009585.17
#> 12        1  ENSMUSG00000027950.7
#> 13        1 ENSMUSG00000004071.12
#> 14        1  ENSMUSG00000104208.1
#> 15        1 ENSMUSG00000047369.15
#> 16        1  ENSMUSG00000097660.1
#> 17        1 ENSMUSG00000002109.14
#> 18        1  ENSMUSG00000108524.1
#> 19        1 ENSMUSG00000067786.16
#> 20        1  ENSMUSG00000085437.8
#> 21        1  ENSMUSG00000086220.1
#> 22        1  ENSMUSG00000102299.1
#> 23        1 ENSMUSG00000079293.11
#> 24        1  ENSMUSG00000085425.1
#> 25        1  ENSMUSG00000006517.5
#> 26        1 ENSMUSG00000049775.16
#> 27        1  ENSMUSG00000109881.1
#> 28        1  ENSMUSG00000102349.1
#> 29        1  ENSMUSG00000089636.1
#> 30        1  ENSMUSG00000086360.1
#> 31        1 ENSMUSG00000036138.16
#> 32        1  ENSMUSG00000045382.6
#> 33        1 ENSMUSG00000030720.16
#> 34        1 ENSMUSG00000027398.13
#> 35        1  ENSMUSG00000104823.1
#> 36        1  ENSMUSG00000100783.1
#> 37        1  ENSMUSG00000082848.1
#> 38        1  ENSMUSG00000110148.1
#> 39        1  ENSMUSG00000085754.7
#> 40        1  ENSMUSG00000108321.1
#> 41        1 ENSMUSG00000032363.15
#> 42        1 ENSMUSG00000003868.14
#> 43        1  ENSMUSG00000107075.1
#> 44        1  ENSMUSG00000074136.9
#> 45        1  ENSMUSG00000089875.1
#> 46        1 ENSMUSG00000055725.11
#> 47        1 ENSMUSG00000028451.12
#> 48        1  ENSMUSG00000078786.9
#> 49        1  ENSMUSG00000087442.1
#> 50        1  ENSMUSG00000053442.4
#> 51        1  ENSMUSG00000101674.6
#> 52        1  ENSMUSG00000097748.1
#> 53        1  ENSMUSG00000050010.8
#> 54        1 ENSMUSG00000029623.14
#> 55        1  ENSMUSG00000097060.1
#> 56        1 ENSMUSG00000050627.13
#> 57        1  ENSMUSG00000085471.1
#> 58        1 ENSMUSG00000039753.16
#> 59        1  ENSMUSG00000027706.8
#> 60        1  ENSMUSG00000032487.8
#> 61        1 ENSMUSG00000002985.16
#> 62        1 ENSMUSG00000038274.11
#> 63        1  ENSMUSG00000087206.1
#> 64        1  ENSMUSG00000079355.3
#> 65        1  ENSMUSG00000086693.1
#> 66        1 ENSMUSG00000030579.10
#> 67        1  ENSMUSG00000108235.1
#> 68        1  ENSMUSG00000097077.1
#> 69        1  ENSMUSG00000087367.1
#> 70        1 ENSMUSG00000037982.16
#> 71        1 ENSMUSG00000029422.14
#> 72        1 ENSMUSG00000026749.11
#> 73        1 ENSMUSG00000067288.12
#> 74        1  ENSMUSG00000090330.2
#> 75        1 ENSMUSG00000059791.14
#> 76        1  ENSMUSG00000103698.1
#> 77        1  ENSMUSG00000097472.1
#> 78        1  ENSMUSG00000026156.8
#> 79        1 ENSMUSG00000075297.10
#> 80        1 ENSMUSG00000055692.18
#> 81        1 ENSMUSG00000039307.16
#> 82        1 ENSMUSG00000045576.16
#> 83        1  ENSMUSG00000087486.1
#> 84        1  ENSMUSG00000014470.4
#> 85        1  ENSMUSG00000056078.5
#> 86        1 ENSMUSG00000049928.15
#> 87        1  ENSMUSG00000086714.1
#> 88        1  ENSMUSG00000109274.1
#> 89        1  ENSMUSG00000109854.1
#> 90        1  ENSMUSG00000060802.8
#> 91        2  ENSMUSG00000085505.1
#> 92        2  ENSMUSG00000092134.1
#> 93        2  ENSMUSG00000097272.1
#> 94        2  ENSMUSG00000087700.1
#> 95        2  ENSMUSG00000101162.2
#> 96        2  ENSMUSG00000107317.1
#> 97        2  ENSMUSG00000102451.1
#> 98        2  ENSMUSG00000109669.1
#> 99        2  ENSMUSG00000086836.1
#> 100       2  ENSMUSG00000092545.7
#> 101       2  ENSMUSG00000090625.1
#> 102       2  ENSMUSG00000047988.1
#> 103       2  ENSMUSG00000086430.1
#> 104       2  ENSMUSG00000105941.1
#> 105       2  ENSMUSG00000022223.8
#> 106       2 ENSMUSG00000031145.15
#> 107       2  ENSMUSG00000086680.2
#> 108       2 ENSMUSG00000021485.13
#> 109       2  ENSMUSG00000097768.1
#> 110       2 ENSMUSG00000075576.12
#> 111       2  ENSMUSG00000090952.2
#> 112       2 ENSMUSG00000040723.14
#> 113       2  ENSMUSG00000027329.9
#> 114       2  ENSMUSG00000106005.1
#> 115       2 ENSMUSG00000046027.17
#> 116       2 ENSMUSG00000004221.16
#> 117       2  ENSMUSG00000023988.8
#> 118       2  ENSMUSG00000087611.1
#> 119       2  ENSMUSG00000092103.2
#> 120       2  ENSMUSG00000090081.1
#> 121       2  ENSMUSG00000107999.1
#> 122       2 ENSMUSG00000041774.14
#> 123       2  ENSMUSG00000090246.1
#> 124       2  ENSMUSG00000032528.4
#> 125       2 ENSMUSG00000021250.13
#> 126       2 ENSMUSG00000009292.17
#> 127       2  ENSMUSG00000109491.1
#> 128       2  ENSMUSG00000090252.1
#> 129       2  ENSMUSG00000087443.1
#> 130       2  ENSMUSG00000064339.1
#> 131       2  ENSMUSG00000091160.1
#> 132       2  ENSMUSG00000108332.1
#> 133       2  ENSMUSG00000048721.2
#> 134       2  ENSMUSG00000102961.1
#> 135       2  ENSMUSG00000096957.1
#> 136       2  ENSMUSG00000093006.2
#> 137       2 ENSMUSG00000027774.16
#> 138       2 ENSMUSG00000012126.16
#> 139       2  ENSMUSG00000092190.1
#> 140       2  ENSMUSG00000074213.2
#> 141       2  ENSMUSG00000086564.9
#> 142       2  ENSMUSG00000092655.1
#> 143       2  ENSMUSG00000098482.1
#> 144       2  ENSMUSG00000108574.1
#> 145       2  ENSMUSG00000087669.1
#> 146       2  ENSMUSG00000078653.4
#> 147       2  ENSMUSG00000108353.1
#> 148       2  ENSMUSG00000092386.1
#> 149       2  ENSMUSG00000087607.1
#> 150       2 ENSMUSG00000061607.14
#> 151       2  ENSMUSG00000026729.9
#> 152       2  ENSMUSG00000064330.9
#> 153       2  ENSMUSG00000103864.1
#> 154       2  ENSMUSG00000085208.3
#> 155       2  ENSMUSG00000073628.5
#> 156       2  ENSMUSG00000102776.1
#> 157       2  ENSMUSG00000086998.1
#> 158       2 ENSMUSG00000006728.12
#> 159       2  ENSMUSG00000021273.9
#> 160       2  ENSMUSG00000062591.5
#> 161       2 ENSMUSG00000040936.14
#> 162       2  ENSMUSG00000046145.7
#> 163       2  ENSMUSG00000087366.7
#> 164       2  ENSMUSG00000039452.5
#> 165       2  ENSMUSG00000087660.1
#> 166       2  ENSMUSG00000084878.1
#> 167       2  ENSMUSG00000101438.1
#> 168       2  ENSMUSG00000064351.1
#> 169       2  ENSMUSG00000086312.1
#> 170       2  ENSMUSG00000097221.1
#> 171       2  ENSMUSG00000107090.1
#> 172       2  ENSMUSG00000095280.1
#> 173       2 ENSMUSG00000017837.12
#> 174       2  ENSMUSG00000109251.1
#> 175       2  ENSMUSG00000086600.8
#> 176       2  ENSMUSG00000090009.1
#> 177       2  ENSMUSG00000101695.1
#> 178       2 ENSMUSG00000084128.10
#> 179       2 ENSMUSG00000038502.16
#> 180       2  ENSMUSG00000015942.9
#> 181       2  ENSMUSG00000106478.1
#> 182       2  ENSMUSG00000054556.6
#> 183       2  ENSMUSG00000082180.1
#> 184       2 ENSMUSG00000013997.10
#> 185       2  ENSMUSG00000100548.1
#> 186       2  ENSMUSG00000053706.2
#> 187       2  ENSMUSG00000093598.1
#> 188       3  ENSMUSG00000097860.1
#> 189       3  ENSMUSG00000079179.9
#> 190       3  ENSMUSG00000097347.1
#> 191       3  ENSMUSG00000092371.1
#> 192       3  ENSMUSG00000109754.1
#> 193       3  ENSMUSG00000090016.1
#> 194       3  ENSMUSG00000097854.1
#> 195       3  ENSMUSG00000029360.3
#> 196       3  ENSMUSG00000102564.1
#> 197       3  ENSMUSG00000025353.4
#> 198       3  ENSMUSG00000052214.9
#> 199       3 ENSMUSG00000037936.15
#> 200       3  ENSMUSG00000105198.1

Created on 2022-07-07 by the reprex package (v2.0.1)

```
$\endgroup$
1
  • $\begingroup$ Thanks for the answer. I have no problem retrieving the genes in the clusters, just identifying the genes associated with the clusters observed in the heatmap. E.g. in my example, the first cluster (cluster 1) is the first cluster in the heatmap (on the top), however my second cluster is not my second cluster (cluster 2)... $\endgroup$
    – h3ab74
    Jul 7 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.