0.9148060 2 rs2 1 2 0.9370754 3 rs3 1 3 0.2861395 其中:SNP---snp名称,CHR---染色体编号,BP---碱基位置,P---p值; 1)最简单的manhattan : manhattan(gwasResults) ? 2)加入标题、调整颜色、部分SNP高亮等细节 head(snpOfInterest) #查看内置高亮snp数据, snpOfInterest可自行设置 manhattan(gwasResults, suggestiveline控制; 红色横线由参数genomewideline控制; 3)批量表示基因名 gwasResults[3057,1] <- "AA" #将最显著的点,自定义,可看出改变 manhattan 二、R-CMplot包 参数更多,图更美观;多表型manhattan图绘制;circos状展示; 1)沿用gwasResults数据:CMplot(gwasResults,plot.type="m",LOG10
曼哈顿距离(Manhattan Distance) 原理 曼哈顿距离(Manhattan Distance)也称为城市街区距离,是一种在几何空间中测量两点之间距离的度量方式。 公式 曼哈顿距离(Manhattan Distance),也称为城市街区距离(City Block Distance),是在多维空间中两点之间测量路径长度的一种方法。
曼哈顿街区熙熙攘攘,在高处向下望去,曼哈顿的建筑方方正正地排列在一条条街道上,仿佛一个个棋子排列在键盘上。
配图来源:GWAS Catalog ----/ START /---- 在GWAS研究中,Manhattan plot和QQ plot是最常画的两类图,它们可以把跟研究的性状(比如,基因型和身高)显著相关的基因位点清晰地展现出来 Manhattan plot(曼哈顿图)比较简单,它是把GWAS分析之后所有SNP位点的p-value在整个基因组上从左到右依次画出来。
Manhattan图算是GWAS分析的标配图了,可参考Bio|manhattan图 进行绘制。 由于Manhattan点太多,后期AI/PS修改的话难度有点大,如果可以“个性化”绘制的话那是极好的! 二 ggplot2绘制Manhattan图 1 纵坐标为P值转-log10() ggplot(Snp_pos, aes(x=BPcum, y=-log10(P))) + geom_point( 基本图形出来了,但是有点怪;不急,一点点改进: 横坐标标签设置在每个chr中间位置; 背景色去掉,线去掉等 去掉点和X轴之间的 “gap” (很多地方可用) 添加阈值线 2 绘制加强版Manhattan 以上就是ggplot2绘制一些常见的Manhattan图,好处当然就是兼容ggplot2的参数,也就可以根据需要自行设置。
作者丨郭浩宇@知乎 原文 | 【CVPR2022 Oral】Manhattan-SDF:从多视角图像做三维场景重建 编辑丨东岸因为@一点人工一点智能 我们介绍一篇2022 CVPR Oral的三维场景重建论文 :Neural 3D Scene Reconstruction with the Manhattan-world Assumption,该论文由浙江大学CAD&CG国家重点实验室/浙大-商汤三维视觉联合实验室提出
:0.9996 作图代码: manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic ") tiff("y1-曼哈顿图.tiff") manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic (d2,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") dev.off() tiff("y2-QQ图 (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan
:0.9996 作图代码: manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic ") tiff("y1-曼哈顿图.tiff") manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic (d2,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") dev.off() tiff("y2-QQ图 (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan
:0.9996 作图代码: manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic ") tiff("y1-曼哈顿图.tiff") manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic (d2,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") dev.off() tiff("y2-QQ图 (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan
示例曼哈顿图 manhattan(dat) 4. 打印显著性的SNP名称 这里,参数:annotatePval,注意,这里的值,不是-log10转化的,而是原始的p值,比如,这里,我们想打印1e-8的snp名称,默认一个染色体只显示一个snp名称: manhattan manhattan(dat,annotatePval = 1e-7,annotateTop = F) 设置p值为1e-3,看一下效果: manhattan(dat,annotatePval = 1e- 代码汇总: ## 曼哈顿图如何显示snp的名称 # qqman library(qqman) data("gwasResults") dat = gwasResults head(dat) manhattan (dat) manhattan(dat,annotatePval = 1e-8) manhattan(dat,annotatePval = 1e-7,annotateTop = F) manhattan
最近小编在后台看到有的小伙伴留言咨询曼哈顿图(Manhattan Plot) 的绘制方法,小编一开始也是比较不了解,奈何我又是一个宠读者的小编,这就汇总了曼哈顿图(Manhattan Plot) R和Python 主要内容如下: 曼哈顿图(Manhattan Plot)简介 曼哈顿图(Manhattan Plot) R绘制方法 曼哈顿图(Manhattan Plot) Python绘制方法 曼哈顿图(Manhattan Plot)简介 曼哈顿图(Manhattan Plot) 是一种散点图,通常用于显示具有大量数据点,许多非零振幅和更高振幅值分布的数据。 (大家知道意思就可以了哈~~),样例如下: 曼哈顿图样例 曼哈顿图(Manhattan Plot) R绘制方法 使用R绘制曼哈顿图(Manhattan Plot) 的方法很多,这里主要介绍R-CMplot Plot in Python 以上就是对曼哈顿图(Manhattan Plot) 绘制R和Python小例子,希望对小伙伴们有所帮助~~。
最近小编在后台看到有的小伙伴留言咨询曼哈顿图(Manhattan Plot) 的绘制方法,小编一开始也是比较不了解,奈何我又是一个宠读者的小编,这就汇总了曼哈顿图(Manhattan Plot) R和Python 主要内容如下: 曼哈顿图(Manhattan Plot)简介 曼哈顿图(Manhattan Plot) R绘制方法 曼哈顿图(Manhattan Plot) Python绘制方法 曼哈顿图(Manhattan Plot)简介 曼哈顿图(Manhattan Plot) 是一种散点图,通常用于显示具有大量数据点,许多非零振幅和更高振幅值分布的数据。 (大家知道意思就可以了哈~~),样例如下: 曼哈顿图样例 曼哈顿图(Manhattan Plot) R绘制方法 使用R绘制曼哈顿图(Manhattan Plot) 的方法很多,这里主要介绍R-CMplot Plot in Python 以上就是对曼哈顿图(Manhattan Plot) 绘制R和Python小例子,希望对小伙伴们有所帮助~~。
:0.9996 作图代码: manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic ") tiff("y1-曼哈顿图.tiff") manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic (d2,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") dev.off() tiff("y2-QQ图 (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan
:0.9996 作图代码: manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic ") tiff("y1-曼哈顿图.tiff") manhattan(d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic (d2,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") dev.off() tiff("y2-QQ图 (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan (d1,chr="Chr",bp="Pos",p="p",snp="Marker", main = "Manhattan plot: logistic") tiff("y1-曼哈顿图.tiff") manhattan
manhattan(gwasResults)#绘制曼哈顿图 ? manhattan(gwasResults, main ="Manhattan Plot", ylim = c(0, 10), cex = 0.6, cex.axis = 0.9, col = c manhattan(gwasResults, highlight =snpsOfInterest) ? manhattan(gwasResults, annotatePval = 0.01) ? manhattan(gwasResults, annotatePval =0.005, annotateTop = FALSE) ?
tc.distances.manhattan([1, 2, 3], [4, 5, 6]) tc.distances.manhattan({'a': 2, 'c': 4}, {'b': 3, 'c': # tc自带的tc.distances.manhattan距离 model = tc.nearest_neighbors.create(sf, features=['bedroom', 'bath', 'size'], distance=tc.distances.manhattan) knn = model.query(sf[:3 "distance check 2:", tc.distances.manhattan(sf_check[2], sf_check[14]) . 4.3 复合距离 案例一: my_dist = [[[ If the distance is ‘manhattan’ or ‘euclidean’ and the features are numeric or vectors of numeric
pandas中的SUMIF 使用布尔索引 要查找Manhattan区的电话总数。布尔索引是pandas中非常常见的技术。本质上,它对数据框架应用筛选,只选择符合条件的记录。 例如,如果想要Manhattan区的所有记录: df[df['Borough']=='MANHATTAN'] 图2:使用pandas布尔索引选择行 在整个数据集中,看到来自Manhattan的1076 在df[]中,这个表达式df['Borough']=='MANHATTAN'返回一个完整的True值或False值列表(2440个条目),因此命名为“布尔索引”。 df[df['Borough']=='MANHATTAN']['num_calls'].sum() 图4 如果想了解纽约所有5个行政区的投诉电话数量,该怎么办? 图6 与只传递1个条件Borough==‘Manhattan’的SUMIF示例类似,在SUMIFS中,传递多个条件(根据需要)。在这个示例中,只需要两个。
下面用代码演示一下: 1,示例代码 library(qqman) manhattan(gwasResults) 2,设置红线和蓝线 蓝色线设置为10的-2次方,红线设置为10的-4次方: manhattan (gwasResults,suggestiveline = -log10(1e-2),genomewideline = -log10(1e-4)) 3,去掉红线和蓝线 manhattan(gwasResults manhattan 如果想要在曼哈顿图中显示snp的信息,可以看这篇博客:GWAS中曼哈顿图如何显示snp的信息,以及多性状曼哈顿图绘制的方法:多性状或者多个模型的QQ和曼哈顿重叠图。
['id'] = manhattan_grids.index 上面的创建网格的方法非常实用,爱学习的朋友的可以仔细看懂之后记录下来。 (facecolor='none', edgecolor='black', ax=ax) # 标注每个网格的id for row in manhattan_grids.itertuples(): 以id=21的网格为例,对应着肯尼迪国际机场的区域,首先我们利用id对应的从manhattan_grids表中提取的网格面数据,基于空间连接来与od_points表进行关联,从而匹配到目标网格内对应原始 draw_gdf = ( manhattan_grids # 基于原始的网格矢量来更新放缩后的网格矢量 .assign(geometry=manhattan_grids [i, 'geometry'].centroid.x, manhattan_grids.at[i, 'geometry'].centroid.y))
['id'] = manhattan_grids.index 上面的创建网格的方法非常实用,爱学习的朋友的可以仔细看懂之后记录下来。 (facecolor='none', edgecolor='black', ax=ax) # 标注每个网格的id for row in manhattan_grids.itertuples(): 以id=21的网格为例,对应着肯尼迪国际机场的区域,首先我们利用id对应的从manhattan_grids表中提取的网格面数据,基于空间连接来与od_points表进行关联,从而匹配到目标网格内对应原始 draw_gdf = ( manhattan_grids # 基于原始的网格矢量来更新放缩后的网格矢量 .assign(geometry=manhattan_grids [i, 'geometry'].centroid.x, manhattan_grids.at[i, 'geometry'].centroid.y))