Stacked Manhattan and regional plot¶
Load gwaslab and sumstats¶
Note: Available since v3.4.39
In [1]:
Copied!
import gwaslab as gl
import gwaslab as gl
In [2]:
Copied!
gl1 = gl.Sumstats("../examples/bbj_bmi_female.txt.gz",snpid="SNP",chrom="CHR",ea="ALT",nea="REF",pos="POS",p="P", build="19",sep="\t", verbose=False)
gl2 = gl.Sumstats("../examples/bbj_bmi_male.txt.gz",snpid="SNP",chrom="CHR",ea="ALT",nea="REF",pos="POS",p="P", build="19",sep="\t", verbose=False)
gl1.basic_check(verbose=False)
gl2.basic_check(verbose=False)
gl1 = gl.Sumstats("../examples/bbj_bmi_female.txt.gz",snpid="SNP",chrom="CHR",ea="ALT",nea="REF",pos="POS",p="P", build="19",sep="\t", verbose=False)
gl2 = gl.Sumstats("../examples/bbj_bmi_male.txt.gz",snpid="SNP",chrom="CHR",ea="ALT",nea="REF",pos="POS",p="P", build="19",sep="\t", verbose=False)
gl1.basic_check(verbose=False)
gl2.basic_check(verbose=False)
Stacked Manhattan plot¶
In [3]:
Copied!
gl.plot_stacked_mqq(objects=[gl1,gl2],
mode="m",
skip=3,
titles=["Female - BMI","Male - BMI"],
check=False,
verbose=False)
gl.plot_stacked_mqq(objects=[gl1,gl2],
mode="m",
skip=3,
titles=["Female - BMI","Male - BMI"],
check=False,
verbose=False)
2024/07/02 14:19:45 #WARNING! Genomic coordinates version is unknown. 2024/07/02 14:19:47 #WARNING! Genomic coordinates version is unknown.
Out[3]:
(<Figure size 2000x1600 with 2 Axes>, <gwaslab.g_Log.Log at 0x7fc603263f10>)
Multiple subplots¶
In [4]:
Copied!
gl.plot_stacked_mqq(objects=[gl1,gl1,gl1,gl1],
mode="m",
skip=3,
titles=["BMI 1","BMI 2", "BMI 3", "BMI 4"],
check=False,
verbose=False)
gl.plot_stacked_mqq(objects=[gl1,gl1,gl1,gl1],
mode="m",
skip=3,
titles=["BMI 1","BMI 2", "BMI 3", "BMI 4"],
check=False,
verbose=False)
2024/07/02 14:19:51 #WARNING! Genomic coordinates version is unknown. 2024/07/02 14:19:54 #WARNING! Genomic coordinates version is unknown. 2024/07/02 14:19:57 #WARNING! Genomic coordinates version is unknown. 2024/07/02 14:20:00 #WARNING! Genomic coordinates version is unknown.
Out[4]:
(<Figure size 2000x3200 with 4 Axes>, <gwaslab.g_Log.Log at 0x7fc603263f10>)
Add title and annotation¶
In [5]:
Copied!
gl.plot_stacked_mqq(objects=[gl1,gl2],
mode="m",
skip=3,
anno=True,
anno_style="expand",
titles=["Female - BMI","Male - BMI"],
region_hspace=0.4, # increase the space between each subplot
xpadl=0.05, # increase left padding for X axis
title_pos=[0, 1.3], # adjust title position
check=False,
verbose=False)
gl.plot_stacked_mqq(objects=[gl1,gl2],
mode="m",
skip=3,
anno=True,
anno_style="expand",
titles=["Female - BMI","Male - BMI"],
region_hspace=0.4, # increase the space between each subplot
xpadl=0.05, # increase left padding for X axis
title_pos=[0, 1.3], # adjust title position
check=False,
verbose=False)
2024/07/02 14:20:04 #WARNING! Genomic coordinates version is unknown. 2024/07/02 14:20:06 #WARNING! Genomic coordinates version is unknown.
Out[5]:
(<Figure size 2000x1600 with 2 Axes>, <gwaslab.g_Log.Log at 0x7fc603263f10>)
Stacked regional plot¶
In [6]:
Copied!
gl.plot_stacked_mqq(objects=[gl1,gl2],
vcfs=[gl.get_path("1kg_eas_hg19"), gl.get_path("1kg_eas_hg19")],
region=(19,46214297 - 300000, 46214297 + 300000),
build="19",
mode="r",
anno=True,
anno_style="tight",
titles=["Male","Female"],
title_args={"size":20},
anno_args={"rotation":0}, verbose=False, check=False)
gl.plot_stacked_mqq(objects=[gl1,gl2],
vcfs=[gl.get_path("1kg_eas_hg19"), gl.get_path("1kg_eas_hg19")],
region=(19,46214297 - 300000, 46214297 + 300000),
build="19",
mode="r",
anno=True,
anno_style="tight",
titles=["Male","Female"],
title_args={"size":20},
anno_args={"rotation":0}, verbose=False, check=False)
INFO:root:Extracted GTF attributes: ['gene_id', 'gene_name', 'gene_biotype']
Out[6]:
(<Figure size 3200x2400 with 6 Axes>, <gwaslab.g_Log.Log at 0x7fc603263f10>)
Note: Available since v3.4.47
In [7]:
Copied!
gl.plot_stacked_mqq(objects=[gl1,gl2],
vcfs=[gl.get_path("1kg_eas_hg19"), gl.get_path("1kg_eas_hg19")],
region=(19,46214297 - 100000, 46214297 + 100000),
region_ref =["rs35560038","rs1055220","rs4802274"],
build="19",
anno="SNPID",
fontsize=12,
mode="r",
region_chromatin_files=["../examples/E098_15_coreMarks_mnemonics.bed.gz"],
region_chromatin_labels=["E098_15"],
cbar_fontsize=11,
marker_size=(100,100),
titles=["Male","Female"],
title_args={"size":20},
anno_args={"rotation":0,"fontsize":12},
verbose=False, check=False)
gl.plot_stacked_mqq(objects=[gl1,gl2],
vcfs=[gl.get_path("1kg_eas_hg19"), gl.get_path("1kg_eas_hg19")],
region=(19,46214297 - 100000, 46214297 + 100000),
region_ref =["rs35560038","rs1055220","rs4802274"],
build="19",
anno="SNPID",
fontsize=12,
mode="r",
region_chromatin_files=["../examples/E098_15_coreMarks_mnemonics.bed.gz"],
region_chromatin_labels=["E098_15"],
cbar_fontsize=11,
marker_size=(100,100),
titles=["Male","Female"],
title_args={"size":20},
anno_args={"rotation":0,"fontsize":12},
verbose=False, check=False)
INFO:root:Extracted GTF attributes: ['gene_id', 'gene_name', 'gene_biotype']
Out[7]:
(<Figure size 3200x3200 with 7 Axes>, <gwaslab.g_Log.Log at 0x7fc603263f10>)
In [ ]:
Copied!
In [ ]:
Copied!