Skip to content
Snippets Groups Projects
Commit 889f393c authored by ameyner2's avatar ameyner2
Browse files

Updated generating IGV scripts

parent 06a48fb1
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# all G2P variants found in the individual VCF # all G2P variants found in the individual VCF
# #
# Author: MH # Author: MH
# last modified: MAR 23, 2020 # last modified: AUG 04, 2021
...@@ -420,6 +420,7 @@ def read_G2P(in_file): ...@@ -420,6 +420,7 @@ def read_G2P(in_file):
# go thru all of their variants # go thru all of their variants
pro_vars = KIDS_G2P_DICT[pro_id] # a dict with keys: chr,start,end,ref,alt and values: (GT,gene_name,transcript) pro_vars = KIDS_G2P_DICT[pro_id] # a dict with keys: chr,start,end,ref,alt and values: (GT,gene_name,transcript)
for var_loc,var_info in pro_vars.iteritems(): for var_loc,var_info in pro_vars.iteritems():
var_chr,var_start,var_end,var_ref,var_alt = var_loc.split(':') #~#
found_in_all = True found_in_all = True
# check if seen in all probands excl this one # check if seen in all probands excl this one
...@@ -429,13 +430,16 @@ def read_G2P(in_file): ...@@ -429,13 +430,16 @@ def read_G2P(in_file):
found_in_all = False found_in_all = False
break break
# if variant found, check if GT matches # if variant found, check if GT matches (excl GT match requirement on chrX)
else: else:
o_info = KIDS_G2P_DICT[o_id][var_loc] if var_chr == 'chrX': #~#
if var_info[0] != o_info[0]: pass #~#
print " Excluding variant %s in %s (GT = %s); it is seen in %s but GT does not match (ST = %s)" % (var_loc,pro_id,var_info[0],o_id,o_info[0]) else: #~#
found_in_all = False o_info = KIDS_G2P_DICT[o_id][var_loc]
break if var_info[0] != o_info[0]:
print " Excluding variant %s in %s (GT = %s); it is seen in %s but GT does not match (ST = %s)" % (var_loc,pro_id,var_info[0],o_id,o_info[0])
found_in_all = False
break
if found_in_all: # this variant has been found in all affected probands with matching GT, keep it if found_in_all: # this variant has been found in all affected probands with matching GT, keep it
if var_loc not in SHARED_DICT: # it has not been recorded previously when considering another proband if var_loc not in SHARED_DICT: # it has not been recorded previously when considering another proband
...@@ -459,7 +463,7 @@ def read_G2P(in_file): ...@@ -459,7 +463,7 @@ def read_G2P(in_file):
new_key = '%s:%s:%s:%s' % (chr,start,ref,alt) new_key = '%s:%s:%s:%s' % (chr,start,ref,alt)
SHARED_DICT[new_key] = var_info SHARED_DICT[new_key] = var_info
print " Keeping %s found in all affected probands, same GT" % (new_key) print " Keeping %s found in all affected probands, same GT (no check of GT match on chrX)" % (new_key)
print "---------------------" print "---------------------"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# all G2P variants found in the individual VCF # all G2P variants found in the individual VCF
# #
# Author: MH # Author: MH
# last modified: SEPT 16, 2020 # last modified: AUG 04, 2021
...@@ -426,6 +426,7 @@ def read_G2P(in_file): ...@@ -426,6 +426,7 @@ def read_G2P(in_file):
# go thru all of their variants # go thru all of their variants
pro_vars = KIDS_G2P_DICT[pro_id] # a dict with keys: chr,start,end,ref,alt and values: (GT,gene_name,transcript) pro_vars = KIDS_G2P_DICT[pro_id] # a dict with keys: chr,start,end,ref,alt and values: (GT,gene_name,transcript)
for var_loc,var_info in pro_vars.iteritems(): for var_loc,var_info in pro_vars.iteritems():
var_chr,var_start,var_end,var_ref,var_alt = var_loc.split(':') #~#
found_in_all = True found_in_all = True
# check if seen in all probands excl this one # check if seen in all probands excl this one
...@@ -435,13 +436,16 @@ def read_G2P(in_file): ...@@ -435,13 +436,16 @@ def read_G2P(in_file):
found_in_all = False found_in_all = False
break break
# if variant found, check if GT matches # if variant found, check if GT matches (excl GT match requirement on chrX)
else: else:
o_info = KIDS_G2P_DICT[o_id][var_loc] if var_chr == 'chrX': #~#
if var_info[0] != o_info[0]: pass #~#
print " Excluding variant %s in %s (GT = %s); it is seen in %s but GT does not match (ST = %s)" % (var_loc,pro_id,var_info[0],o_id,o_info[0]) else: #~#
found_in_all = False o_info = KIDS_G2P_DICT[o_id][var_loc]
break if var_info[0] != o_info[0]:
print " Excluding variant %s in %s (GT = %s); it is seen in %s but GT does not match (ST = %s)" % (var_loc,pro_id,var_info[0],o_id,o_info[0])
found_in_all = False
break
if found_in_all: # this variant has been found in all affected probands with matching GT, keep it if found_in_all: # this variant has been found in all affected probands with matching GT, keep it
if var_loc not in SHARED_DICT: # it has not been recorded previously when considering another proband if var_loc not in SHARED_DICT: # it has not been recorded previously when considering another proband
...@@ -465,7 +469,7 @@ def read_G2P(in_file): ...@@ -465,7 +469,7 @@ def read_G2P(in_file):
new_key = '%s:%s:%s:%s' % (chr,start,ref,alt) new_key = '%s:%s:%s:%s' % (chr,start,ref,alt)
SHARED_DICT[new_key] = var_info SHARED_DICT[new_key] = var_info
print " Keeping %s found in all affected probands, same GT" % (new_key) print " Keeping %s found in all affected probands, same GT (no check of GT match on chrX)" % (new_key)
print "---------------------" print "---------------------"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment