使用plink assoc输出绘制曼哈顿图和QQ图。

qqman的Python项目详细描述


Python的qqman

Install with pypi or anaconda

如果您想查看源代码或有任何问题,请在我的github存储库中留言。
这个库的灵感来自r-qqman(参见here)。
它还包含/将包含python用户的其他方法。


目录

  1. Introduction
    1.1条。Installation
    1.2条。Requirements
    1.3条。Features
  2. Manhattan Plot
    2.1条。Parameters
    2.2条。Examples
  3. QQ Plot
    3.1条。Parameters
    3.2条。Examples

1. Introduction

1.1. Installation

使用pip

$ pip install qqman

1.2. Requirements

  • matplotlib库
  • 熊猫
  • numpy公司

pip

^{pr2}$

阿南科达

$ conda install -c anaconda numpy
$ conda install -y -c anaconda pandas
$ conda install -y -c conda-forge matplotlib

1.3. Features

  1. Manhattan Plot
  2. QQ Plot

2. Manhattan Plot

从PLINK(assoc输出或包含[染色体/基对/p值]作为列的任何assoc格式的数据绘制曼哈顿图。在

2.1. Parameters

^{} : string or pandas.DataFrame - Input file path and name of the Plink assoc output.
- Pandas DataFrame with columns [chromosome/basepair/p-value]
^{} : string
( optional )
Output path and file name of the plot. (ie. out="./Manhattan.png")
^{} : Colormap
( optional : default=Greys_r )
A Colormap instance or registered colormap name. matplotlib.cm.get_cmap()
^{} : int or list
( optional : default=2 )
int : Number of colors to use
list : Specific colors to use in colormap
^{} : bool
( optional )
If true, the plot will be shown on your screen. (This option doesn't work in CUI environment.)
^{} : float
( optional : default=10)
A size of gaps between the group of scatter markers of each chromosome in Manhattan plot
^{} : subplot
( optional )
If given, this subplot is used to plot in instead of a new figure being created.
^{} : string
( optional )
A title of the plot.
^{} : int
( optional )
A size of the title of the plot.
^{} : int
( optional )
A size of x and y labels of the plot.
^{} : int
( optional )
A size of xtick labels.
^{} : int
( optional )
A size of ytick labels.
^{} : float
( optional )
A rotation degree of xtick labels.
^{} : float
( optional )
A rotation degree of ytick labels.
^{} : string
( optional : default="CHR" )
A string denoting the column name for the chromosome. Defaults to PLINK’s "CHR" Said column must be numeric.
If you have X, Y, or MT chromosomes, be sure to renumber these 23, 24, 25, etc.
^{} : string
( optional : default="BP" )
A string denoting the column name for the chromosomal position. Defaults to PLINK’s "BP" Said column must be numeric.
^{} : string
( optional : default="P" )
A string denoting the column name for the p-value. Defaults to PLINK’s "P" Said column must be numeric.
^{} : string
( optional : default="SNP" )
A string denoting the column name for the SNP name (rs number). Defaults to PLINK’s "SNP" Said column should be a character
^{} : string
( optional : default=-log_10(1e-5) )
Where to draw a "suggestive" line. Set to False to disable.
^{} : string
( optional : default=-log_10(5e-8) )
Where to draw a "genome-wide sigificant" line. Set to False to disable.

2.2. Examples

2.2.1。简单

fromqqmanimportqqmanif__name__=="__main__":qqman.manhattan("../../temp.assoc",out="./Manhattan.png")
Simple Manhattan Plot

2.2.2条。使用子批次

fromqqmanimportqqmanimportpandasaspdimportmatplotlib.pyplotaspltif__name__=="__main__":df_assoc=pd.read_csv("../../temp.assoc",header=0,delim_whitespace=True)figure,axes=plt.subplots(nrows=2,ncols=2,figsize=(20,20))qqman.manhattan("../../temp.assoc",ax=axes[0,0],title="Wider gap 100",gap=100)qqman.manhattan("../../temp.assoc",ax=axes[0,1],title="No lines",suggestiveline=False,genomewideline=False)qqman.manhattan("../../temp.assoc",ax=axes[1,0],title="Different colormap",cmap=plt.get_cmap("jet"),cmap_var=10)qqman.manhattan(df_assoc,ax=axes[1,1],title="From DataFrame with xtick rotation",xrotation=45)figure.tight_layout()plt.savefig("./manhattan.png",format="png")plt.clf()plt.close()
Simple Manhattan Plot

3. QQ Plot

从GWAS的p值绘制分位数-分位数图。在

3.1. Parameters

^{tb2}$

3.2. Examples

3.2.1。简单

fromqqmanimportqqmanif__name__=="__main__":qqman.qqplot("../../temp.assoc",out="./QQplot.png")
Simple Manhattan Plot

3.2.2。使用子批次

fromqqmanimportqqmanimportpandasaspdimportmatplotlib.pyplotaspltif__name__=="__main__":df_assoc=pd.read_csv("../../temp.assoc",header=0,delim_whitespace=True)p_vals=list(df_assoc['P'])figure,axes=plt.subplots(nrows=2,ncols=2,figsize=(20,20))qqman.qqplot("../../temp.assoc",ax=axes[0,0],title="From file")qqman.qqplot(p_vals,ax=axes[0,1],title="From list")qqman.qqplot(df_assoc.P,ax=axes[1,0],title="From Series")qqman.qqplot(df_assoc,ax=axes[1,1],title="From DataFrame")figure.tight_layout()plt.savefig("./SubQQplot.png",format="png")plt.clf()plt.close()
Simple Manhattan Plot

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java泛型方法重写   URL连接URL包含重音字符的java编码问题   java如何在安卓中获取移动网络活动计划使用历史记录   java CTRLC在Python中的行为不同   包含私有调用的jvm Java内联方法   java在没有web的情况下配置servlet模式。xml   java如果我在父类中调用父类的方法,它是否调用同名的子类方法   java长循环计数器似乎效率很低   java如何使用println按单位打印同一列中的数字列表?   java导航在一个webview中工作,而不是在另一个Android Studio中工作   文件获取java序列化中简单程序的编译错误   java无法在com上对null对象调用方法get()。谷歌。gms。谷歌服务。谷歌服务公司   java Spring数据JPA findAll()或findbyId()在Spring引导中返回错误的值   java安卓:如何使用截取检查是否成功地将JSON数据发送到服务器?   SpringWebFlux中JavaVoid与Mono的对比   Android 1.5中的java删除短信   java my 安卓应用程序在阿拉伯语系统上崩溃   java告诉Hibernate不要删除库项目的实体   java onActivityResult请求代码返回0