-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script to plot read balance for xx and xy individuals for chr19, …
…chrX, and chrY including fixed sites
- Loading branch information
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
analyses/Webster_etal_2018/scripts/Plot_read_balance_with_fixed_overall.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from __future__ import print_function | ||
from xyalign import variants as xyv | ||
import numpy as np | ||
import sys | ||
|
||
out_file = sys.argv[1] | ||
path_prefix = sys.argv[2] | ||
|
||
if path_prefix[-1] == "/": | ||
path_prefix = path_prefix[:-1] | ||
|
||
xx = xyv.VCFFile("{}/HG00513_wgs_hg19.noprocessing.vcf.gz".format(path_prefix)) | ||
xy = xyv.VCFFile("{}/HG00512_wgs_hg19.noprocessing.vcf.gz".format(path_prefix)) | ||
|
||
xx_19 = xx.parse_platypus_VCF(30, 30, 4, "chr19") | ||
xx_x = xx.parse_platypus_VCF(30, 30, 4, "chrX") | ||
xy_19 = xy.parse_platypus_VCF(30, 30, 4, "chr19") | ||
xy_x = xy.parse_platypus_VCF(30, 30, 4, "chrX") | ||
xy_y = xy.parse_platypus_VCF(30, 30, 4, "chrY") | ||
|
||
xyv.hist_read_balance( | ||
"chr19", xx_19[2], "HG000513_chr19", False, "{}/HG000513_chr19_with_fixed".format( | ||
path_prefix), include_fixed=True) | ||
|
||
xyv.hist_read_balance( | ||
"chrX", xx_x[2], "HG000513_chrX", False, "{}/HG000513_chrX_with_fixed".format( | ||
path_prefix), include_fixed=True) | ||
|
||
xyv.hist_read_balance( | ||
"chr19", xy_19[2], "HG000512_chr19", False, "{}/HG000512_chr19_with_fixed".format( | ||
path_prefix), include_fixed=True) | ||
|
||
xyv.hist_read_balance( | ||
"chrX", xy_x[2], "HG000512_chrX", False, "{}/HG000512_chrX_with_fixed".format( | ||
path_prefix), include_fixed=True) | ||
|
||
xyv.hist_read_balance( | ||
"chrY", xy_y[2], "HG000512_chrY", False, "{}/HG000512_chrY_with_fixed".format( | ||
path_prefix), include_fixed=True) | ||
|
||
parse_list = [xx_19, xx_x, xy_19, xy_x, xy_y] | ||
parse_list_names = ["XX_chr19", "XX_chrX", "XY_chr19", "XY_chrX", "XY_chrY"] | ||
|
||
with open(out_file, "w") as f: | ||
f.write("sample_chrom\tmean_read_balance\tnum_sites\n") | ||
for idx, i in enumerate(parse_list): | ||
f.write("{}\t{}\t{}\n".format( | ||
parse_list_names[idx], np.mean(i[2]), len(i[2]))) |