Skip to content

Commit 7b6a00f

Browse files
committed
Allow for phased genotypes
1 parent 6c887ab commit 7b6a00f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

VPOT_1_1_VCF.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ def work_this_src_file_1(source_vcf, wrkf1): #
370370
if (int((Alt_reads/Sample_coverage)*100) >= int(VPOT_conf.Hete_Balance)) : # Pas QC for coverage and balance
371371
VPOT_conf.QC_PASS=True # Yes
372372
# print ("QC_PASS",VPOT_conf.QC_PASS) #
373-
GT_values=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # get the genotype fields
373+
# allow for normal 0/1 vs phased 0|1 genotypes
374+
GT_values=re.split('[|/]',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # get the genotype fields
375+
#GT_values=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # get the genotype fields
374376
# print GT_values #
375377
for j in range(len(GT_values)) : #
376378
# print (GT_values[j]) #
@@ -418,7 +420,9 @@ def check_this_variant(src_line, wrkf1): #
418420
#
419421
src_line1=re.split('\t|\n|\r',src_line) # split into file location and sample id
420422
SAMPLE1=re.split(':',src_line1[VPOT_conf.sample_loc]) # split the sample's FORMAT fields
421-
GENOTYPE1=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # split the sample's GENOTYPE fields
423+
# allow for normal 0/1 vs phased 0|1 genotypes
424+
GENOTYPE1=re.split('[|/]',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # split the sample's GENOTYPE fields
425+
#GENOTYPE1=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # split the sample's GENOTYPE fields
422426
# print (src_line1) #
423427
# print (SAMPLE1) #
424428
# print (GENOTYPE1) #

VPOT_1_2_TXT.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ def work_this_src_file(file_line): #
275275
VPOT_conf.QC_PASS=True # Yes
276276
# print ("QC_PASS",VPOT_conf.QC_PASS) #
277277
# print ("add") #
278-
GT_values=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # get the genotype fields
278+
# print ("add") #
279+
# Allow for phased genotypes like 0|1
280+
GT_values=re.split('[|/]',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # get the genotype fields
279281
# print GT_values #
280282
for j in range(len(GT_values)) : #
281283
# print GT_values[j] #
@@ -303,7 +305,8 @@ def check_this_variant(src_line, wrkf1): #
303305
#
304306
src_line1=re.split('\t|\n|\r',src_line) # split into file location and sample id
305307
SAMPLE1=re.split(':',src_line1[VPOT_conf.sample_loc]) # split the sample's FORMAT fields
306-
GENOTYPE1=re.split('/',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # split the sample's GENOTYPE fields
308+
# Allow for phased genotypes - e.g. 0|1
309+
GENOTYPE1=re.split('[|/]',SAMPLE1[VPOT_conf.sample_coverage_loc[VPOT_conf.GT_val]]) # split the sample's GENOTYPE fields
307310
header1=re.split('\t|\n|\r',VPOT_conf.header_ln) # split into file location and sample id
308311
# print "header : ",VPOT_conf.header_ln #
309312
# print (src_line1) #
@@ -612,4 +615,4 @@ def prioritise_variants_by_VT_types(INFO_details,header1): #
612615
###
613616
return val #
614617
##
615-
#
618+
#

0 commit comments

Comments
 (0)