pgx-main from prod added
This commit is contained in:
56
pgx-main/scripts/slc15a2/hg38/bin/stellarpgx.py
Normal file
56
pgx-main/scripts/slc15a2/hg38/bin/stellarpgx.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import math
|
||||
from sv_modules import *
|
||||
|
||||
|
||||
print("--------------------------------------------\n")
|
||||
|
||||
print("${i^^} Variant Analysis with StellarPGx\n")
|
||||
|
||||
print("--------------------------------------------\n")
|
||||
|
||||
|
||||
infile = sys.argv[1]
|
||||
cov_file = sys.argv[2]
|
||||
|
||||
|
||||
def get_core_variants(infile, cn):
|
||||
core_vars = []
|
||||
for line in open(infile, "r"):
|
||||
line = line.strip()
|
||||
core_vars.append(line)
|
||||
core_vars = ";".join(sorted(core_vars))
|
||||
|
||||
if int(cn) == 1:
|
||||
core_vars = core_vars.replace("~0/1", "~1/1")
|
||||
|
||||
if os.stat(infile).st_size == 0:
|
||||
core_vars = "No core SNVs detected; haplotypes equivalent to GRCh38 content"
|
||||
|
||||
return core_vars
|
||||
|
||||
|
||||
|
||||
cn = get_total_CN(cov_file)[0]
|
||||
av_ctrl_cov = get_total_CN(cov_file)[2]
|
||||
exon_cov = get_total_CN(cov_file)[3]
|
||||
|
||||
print("Initially computed Copy Number = {}".format(cn))
|
||||
|
||||
for i in range(1, len(exon_cov)):
|
||||
|
||||
if exon_cov[i-1]/av_ctrl_cov < 0.45 :
|
||||
print ('Check exon {} for potential deletion if using high coverage WGS'.format(str(i)))
|
||||
else:
|
||||
pass
|
||||
|
||||
supp_core_vars = get_core_variants(infile, cn)
|
||||
|
||||
print("\nSample core variants:")
|
||||
print(supp_core_vars)
|
||||
|
||||
|
||||
37
pgx-main/scripts/slc15a2/hg38/bin/sv_modules.py
Normal file
37
pgx-main/scripts/slc15a2/hg38/bin/sv_modules.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import math
|
||||
|
||||
|
||||
def get_total_CN(cov_file):
|
||||
|
||||
all_reg =[]
|
||||
for line in open(cov_file, "r"):
|
||||
line = line.strip().split()
|
||||
all_reg.append(line)
|
||||
|
||||
av_slc15a2_cov = float(all_reg[0][3])/(float(all_reg[0][2]) - float(all_reg[0][1]))
|
||||
av_vdr_cov = float(all_reg[1][3])/(float(all_reg[1][2]) - float(all_reg[1][1]))
|
||||
av_egfr_cov = float(all_reg[2][3])/(float(all_reg[2][2]) - float(all_reg[2][1]))
|
||||
|
||||
exon_cov_list = []
|
||||
all_reg = all_reg[3:]
|
||||
|
||||
a = list(range(1, len(all_reg)))
|
||||
|
||||
for i in a:
|
||||
exon_cov = 'av_e' + str(i)
|
||||
exon_cov = float(all_reg[i-1][3])/(float(all_reg[i-1][2]) - float(all_reg[i-1][1]))
|
||||
exon_cov_list.append(exon_cov)
|
||||
|
||||
av_ctrl_cov = (av_vdr_cov + av_egfr_cov)/2
|
||||
|
||||
comp_av = av_slc15a2_cov/av_ctrl_cov
|
||||
temp_cn = 2 * comp_av
|
||||
total_cn = round(temp_cn)
|
||||
|
||||
|
||||
return [str(int(total_cn)), round(av_slc15a2_cov), round(av_ctrl_cov), exon_cov_list];
|
||||
|
||||
Reference in New Issue
Block a user