Skip to content

Commit 576247f

Browse files
committed
updated code
1 parent e1f1ba8 commit 576247f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/cal_af_distribution.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def main():
237237
parser.add_argument('--threads', type=int, default=4,
238238
help="Max #threads to be used")
239239

240-
parser.add_argument('--phase_output', type=str2bool, default=False,
240+
parser.add_argument('--phase_output', type=str2bool, default=True,
241241
help="Output phasing INFO")
242242

243243
parser.add_argument('--samtools', type=str, default="samtools",

src/compare_vcf.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ def compare_vcf(args):
202202

203203
for k, v in input_variant_dict.items():
204204
columns = v.row_str.rstrip().split('\t')
205-
phaseable = columns[7] == 'H'
205+
# phaseable = columns[7] == 'H'
206+
phaseable = 'H' in columns[7].split(';')
206207
if phaseable:
207208
phasable_count += 1
208209
else:
@@ -258,7 +259,7 @@ def compare_vcf(args):
258259

259260
if benchmark_indel:
260261
ref_base, alt_base = input_variant_dict[key].reference_bases, input_variant_dict[key].alternate_bases[0]
261-
if len(ref_base) == 1 and len(alt_base) == 1:
262+
if len(ref_base) == 1 and len(alt_base) == 1 or len(input_variant_dict[key].alternate_bases) > 1:
262263
del input_variant_dict[key]
263264

264265
for key in list(truth_variant_dict.keys()):
@@ -304,6 +305,7 @@ def compare_vcf(args):
304305
tp_set = set()
305306
fp_qual_dict = defaultdict(float)
306307
tp_qual_dict = defaultdict(float)
308+
gt_mismatch_count = 0
307309
for key, vcf_infos in input_variant_dict.items():
308310
pos = key if args.ctg_name is not None else key[1]
309311
contig = args.ctg_name if args.ctg_name is not None else key[0]
@@ -323,8 +325,6 @@ def compare_vcf(args):
323325

324326
ref_base = vcf_infos.reference_bases
325327
alt_base = vcf_infos.alternate_bases[0]
326-
# if alt_base == '.':
327-
# alt_base = ref_base
328328
genotype = vcf_infos.genotype
329329
qual = vcf_infos.qual
330330
try:
@@ -359,6 +359,8 @@ def compare_vcf(args):
359359
continue
360360

361361
genotype_match = skip_genotyping or (truth_genotype == genotype)
362+
if not genotype_match:
363+
gt_mismatch_count += 1
362364
if truth_ref_base == ref_base and truth_alt_base == alt_base and genotype_match:
363365
tp_snv = tp_snv + 1 if is_snv else tp_snv
364366
tp_ins = tp_ins + 1 if is_ins else tp_ins
@@ -388,7 +390,8 @@ def compare_vcf(args):
388390
fp_fn_set.add(key)
389391

390392
truth_set.add(key)
391-
393+
if not skip_genotyping:
394+
print('[INFO] Genotype mismatch count/Total fp_fn count: {}/{}'.format(gt_mismatch_count, len(fp_fn_set)))
392395
for key, vcf_infos in truth_variant_dict.items():
393396
pos = key if args.ctg_name is not None else key[1]
394397
contig = args.ctg_name if args.ctg_name is not None else key[0]

src/concat_files.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def concat_files(args):
4949
output_fn = os.path.join(output_dir, output_fn)
5050

5151
if is_snv and output_fn is None:
52-
output_fn = os.path.join(output_dir, "CANDIDATES_FILES")
52+
output_fn = os.path.join(output_dir, "SNV_CANDIDATES_FILES")
5353
elif is_indel and output_fn is None:
5454
output_fn = os.path.join(output_dir, "INDEL_CANDIDATES_FILES")
5555

0 commit comments

Comments
 (0)