1

我注意到在使用 pheatmap 时,它会在观察和样本中从最高到最低的总体丰度进行绘制,但是我会对每行(每次观察)的模式感兴趣。

如何绘制每行而不是整体的丰度?(即:每一行的红色值最高,蓝色最低,而不是观测值 A 的分辨率最高,而观测值 X 的蓝色值最高)?

mat2<- structure(c(-0.213025934591574, -0.163248448659472, -0.248051103156083, 
-0.201819558885379, -0.0777405477523168, 0.135337006619379, -0.198109946359763, 
0.0141506212540676, 0.179828567693606, 0.169496780803287, 0.112068992889091, 
0.217499778725543, -0.0185614528176821, 0.176176866317959, 0.0965180577688898, 
-0.060319276538241, -0.0938731477785186, -0.311865889515179, 
-0.197846066983514, -0.0761936864442312, 0.221210237015839, -0.335261213085218, 
0.0994245449798807, 0.159002188482791, 0.127456715991414, -0.0626692691632176, 
0.087397037867305, -0.0382271124091016, 0.0372615146034683, 0.0544567326960959, 
-0.346683093614839, -0.313264582879986, -0.229455431736753, -0.207856818605521, 
-0.0605393606726814, 0.204826294637275, -0.133856996358563, -0.0733809698492127, 
0.19590822330537, 0.13330812001908, -0.0208147137237891, 0.0521659682392048, 
0.125626500818102, 0.0737935134822632, 0.0967655833099652, -0.306307575111596, 
-0.237365412302706, -0.182302631411446, -0.249473680048395, -0.135134604010949, 
0.107648011531367, 0.0318549519137541, -0.152849100843511, 0.264593901401556, 
0.138961997672778, -0.0229296746540051, 0.0288208958261311, 0.0328853120798769, 
-0.00906300848079766, 0.0836245247413885, -0.111973086674885, 
-0.181242551724756, -0.319499963096833, -0.124850749891658, 0.0444262459794889, 
0.19363190405517, -0.221273256749672, 0.245859902228112, 0.257129768450294, 
-0.0899181268582208, -0.181724789771588, -0.143578303381443, 
-0.00054056353777554, 0.0562417954366676, 0.196439524954817, 
0.678254243144726, -0.165861326793939, -0.128313190429012, 0.00636168794816427, 
0.327272951238317, -0.0997395148594364, -0.0333342962373244, 
-0.0793174911642129, 0.00106618055094643, 0.0398745065006914, 
-0.0929895071363784, -0.036893335508756, -0.113086132635203, 
0.0454601721793964, -0.0285827025970811, 0.549711641190227, -0.122270243142212, 
-0.0748206368291697, -0.162186875234685, 0.416061259270649, 0.148212948185435, 
0.00084839176003193, 0.0727215158850409, -0.132617308595968, 
-0.144912499958581, -0.177772405511423, -0.0941254131256972, 
-0.0228149545687675, 0.111659676426052, 0.00960940358365825, 
0.527043722415639, -0.258689171383937, -0.178665826519511, -0.251244674666973, 
0.274079500077432, 0.0377147139230143, -0.0717788678125331, 0.0226569807641663, 
-0.0335364209512665, 0.0177109529606359, -0.134270047714418, 
0.0349189778431871, 0.0943497326039147, 0.0893647140816753, -0.1017542638909, 
0.547376689744194, -0.11825216966821, -0.124295433480192, 0.091219520992821, 
0.168184485730496, -0.000644856240574754, 0.044904851402725, 
-0.115527689753369, -0.00370873685974793, 0.00204841916136012, 
-0.143101815785032, -0.170601749054116, 0.0141579404537371, -0.0261317766647551, 
-0.0612695091114137, 0.255965698576825, -0.167317045457947, 0.0223231193364679, 
0.270497481572482, 0.123637977859707, -0.0324319327867997, 0.0944584774984953, 
-0.0373601928617457, 0.0185452262258714, -0.0908389065015598, 
-0.0154468144194144, -0.0363726704030878, -0.0241913049418727, 
0.0583007113480853, -0.0507094156043397, 0.159921417427794, -0.0160800568548947, 
-0.00493434277751348, 0.0414353420096187, 0.0696761945097908, 
0.00998434502657197, 0.328733135964947, -0.0408920701159978, 
-0.0817557669358866, 0.0162659094505706, 0.0738743361307659, 
0.126364656528795, 0.0369219991164407, 0.0163207485254286, -0.0845244112921169, 
0.0142674312919997, 0.195777347815243, 0.331901729270365, 0.119222834315185, 
-0.178495239382576, -0.016122231937727, 0.135865626742293, 0.243464513369577, 
-0.163337673980003, 0.0799129559034828, 0.110301437491652, 0.0530057405983619, 
-0.202777592164589, -0.130613462874123, -0.132608434608645, -0.217125543412291, 
0.0402302571620261, 0.287161321285817, 0.0605742058562608, -0.207830264127418, 
-0.0946858133717257, 0.114972468297587, 0.174618588358014, -0.195284847941959, 
-0.203407110897798, 0.206583350215984, -0.124404748026413, 0.128837433348068, 
-0.054848205747188, -0.141013219253859, -0.264005431437871, 0.273849107695346, 
0.314597315168513, -0.0452992198483102, -0.185620445322483, 0.130170727885623, 
0.101502787218891, 0.0178013410677043, -0.112812285075028, 0.260405495456157, 
0.0778932597850019, 0.154408522685062, -0.180484123795496, -0.0201053000924123, 
-0.0725240151015605, -0.472493145573873, 0.448761825275545, 0.265638705567596, 
0.368341877148383, -0.146595262894772, -0.289311098540198, 0.13893015639194, 
0.00142518279566417, -0.110433449127701, -0.215189264254326, 
0.115938706106492, -0.0132075086795256, 0.129810006608052, -0.195858734009903, 
0.0818861824154986, -0.539684315963585, 0.435939836247055, 0.241765829903416, 
0.172948275253605, -0.225888035331538, -0.306178037070731, 0.00959192839936307, 
0.0193372281429252, -0.169311523931428, -0.18097033558017, -0.0614766885501403, 
-0.0726589834836702, 0.0961160487806758, -0.136716269627128, 
0.03555828227055, -0.200923440872639, 0.442905782451366, 0.338816428419507, 
0.309976419067912, -0.129301168726913, -0.349622704072482, -0.00804819898693943, 
-0.412132904257113, -0.0732760427114414, -0.0602056098688024, 
0.216535643810429, -0.0627388666508741, -0.0580217369383647, 
-0.0912429549046951, 0.0181276797190417), .Dim = c(15L, 17L), .Dimnames = list( c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"), c("S1", "S2", "S4", "S5", "S6", "S7", "S8", "S9", "S10", "S12", "S14", "S16", "S17", "S18", "S19", "S20", "S21")))

library(pheatmap)
pheatmap(mat2, show_rownames = T, show_colnames = T, cutree_cols = 3, cluster_cols = FALSE, main = "pheatmap")

在此处输入图像描述

4

1 回答 1

1

我找到了这个选项scale= 'row'并且工作正常!

pheatmap(mat2, show_rownames = T, show_colnames = T, cutree_cols = 3, cluster_cols = FALSE, main = "pheatmap", scale = 'row')
于 2020-11-29T19:55:55.567 回答