Skip to content

Commit

Permalink
is_bnd fix
Browse files Browse the repository at this point in the history
pysam.VariantFile.allele_variant_types isn't reliable
  • Loading branch information
ACEnglish committed Jan 29, 2025
1 parent 24859cf commit 664fd5b
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 70 deletions.
1 change: 0 additions & 1 deletion repo_utils/answer_key/bench/bench_bnd/candidate.refine.bed
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ chr13 56380894 56381040
chr13 114073358 114074122
chr14 102919538 102919632
chr15 31496974 31637324
chr15 40450778 40450800
chr15 44117191 44248483
chr15 74894096 74894117
chr15 90787610 90889113
Expand Down
Binary file modified repo_utils/answer_key/bench/bench_bnd/fn.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/fn.vcf.gz.tbi
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/fp.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/fp.vcf.gz.tbi
Binary file not shown.
40 changes: 20 additions & 20 deletions repo_utils/answer_key/bench/bench_bnd/log.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2025-01-09 21:35:26,687 [INFO] Truvari v5.0.0
2025-01-09 21:35:26,688 [INFO] Command /data/truvari/__main__.py bench -b repo_utils/test_files/variants/bnd.base.vcf.gz -c repo_utils/test_files/variants/bnd.comp.vcf.gz -p 0 -o test_results/bench_bnd/ --no-decompose
2025-01-09 21:35:26,688 [INFO] Params:
2025-01-29 01:41:34,415 [INFO] Truvari v5.0.1.dev0+24859cf.uc
2025-01-29 01:41:34,416 [INFO] Command /data/truvari/__main__.py bench -b repo_utils/test_files/variants/bnd.base.vcf.gz -c repo_utils/test_files/variants/bnd.comp.vcf.gz -p 0 -o test_results/bench_bnd/ --no-decompose
2025-01-29 01:41:34,418 [INFO] Params:
{
"base": "/data/repo_utils/test_files/variants/bnd.base.vcf.gz",
"comp": "/data/repo_utils/test_files/variants/bnd.comp.vcf.gz",
Expand Down Expand Up @@ -36,27 +36,27 @@
"skip_gt": false,
"max_resolve": 25000
}
2025-01-09 21:35:26,723 [WARNING] 193 contigs present in comparison VCF header are not in baseline VCF.
2025-01-09 21:35:26,898 [INFO] Zipped 439 variants Counter({'comp': 243, 'base': 196})
2025-01-09 21:35:26,899 [INFO] 223 chunks of 439 variants Counter({'comp': 243, 'base': 186, '__filtered': 10})
2025-01-09 21:35:26,974 [INFO] Stats: {
"TP-base": 119,
"TP-comp": 119,
2025-01-29 01:41:34,484 [WARNING] 193 contigs present in comparison VCF header are not in baseline VCF.
2025-01-29 01:41:34,766 [INFO] Zipped 439 variants Counter({'comp': 243, 'base': 196})
2025-01-29 01:41:34,767 [INFO] 226 chunks of 439 variants Counter({'comp': 243, 'base': 195, '__filtered': 1})
2025-01-29 01:41:34,907 [INFO] Stats: {
"TP-base": 120,
"TP-comp": 120,
"FP": 102,
"FN": 67,
"precision": 0.5384615384615384,
"recall": 0.6397849462365591,
"f1": 0.5847665847665847,
"base cnt": 186,
"comp cnt": 221,
"TP-comp_TP-gt": 99,
"FN": 75,
"precision": 0.5405405405405406,
"recall": 0.6153846153846154,
"f1": 0.5755395683453237,
"base cnt": 195,
"comp cnt": 222,
"TP-comp_TP-gt": 100,
"TP-comp_FP-gt": 20,
"TP-base_TP-gt": 99,
"TP-base_TP-gt": 100,
"TP-base_FP-gt": 20,
"gt_concordance": 0.8319327731092437,
"gt_concordance": 0.8333333333333334,
"gt_matrix": {
"(0, 1)": {
"(0, 1)": 94,
"(0, 1)": 95,
"(0, 0)": 19,
"(1, 1)": 1
},
Expand All @@ -68,4 +68,4 @@
}
}
}
2025-01-09 21:35:26,974 [INFO] Finished bench
2025-01-29 01:41:34,908 [INFO] Finished bench
24 changes: 12 additions & 12 deletions repo_utils/answer_key/bench/bench_bnd/summary.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"TP-base": 119,
"TP-comp": 119,
"TP-base": 120,
"TP-comp": 120,
"FP": 102,
"FN": 67,
"precision": 0.5384615384615384,
"recall": 0.6397849462365591,
"f1": 0.5847665847665847,
"base cnt": 186,
"comp cnt": 221,
"TP-comp_TP-gt": 99,
"FN": 75,
"precision": 0.5405405405405406,
"recall": 0.6153846153846154,
"f1": 0.5755395683453237,
"base cnt": 195,
"comp cnt": 222,
"TP-comp_TP-gt": 100,
"TP-comp_FP-gt": 20,
"TP-base_TP-gt": 99,
"TP-base_TP-gt": 100,
"TP-base_FP-gt": 20,
"gt_concordance": 0.8319327731092437,
"gt_concordance": 0.8333333333333334,
"gt_matrix": {
"(0, 1)": {
"(0, 1)": 94,
"(0, 1)": 95,
"(0, 0)": 19,
"(1, 1)": 1
},
Expand Down
Binary file modified repo_utils/answer_key/bench/bench_bnd/tp-base.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/tp-base.vcf.gz.tbi
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/tp-comp.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd/tp-comp.vcf.gz.tbi
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/fn.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/fn.vcf.gz.tbi
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/fp.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/fp.vcf.gz.tbi
Binary file not shown.
44 changes: 22 additions & 22 deletions repo_utils/answer_key/bench/bench_bnd_decomp/log.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2025-01-28 22:35:15,820 [INFO] Truvari v5.0.1.dev0+31b79f9
2025-01-28 22:35:15,822 [INFO] Command /data/truvari/__main__.py bench -b repo_utils/test_files/variants/bnd.base.vcf.gz -c repo_utils/test_files/variants/bnd.comp2.vcf.gz --sizemax 1000000000 -p 0 --pick multi -o test_results/bench_bnd_decomp/
2025-01-28 22:35:15,823 [INFO] Params:
2025-01-29 01:41:36,655 [INFO] Truvari v5.0.1.dev0+24859cf.uc
2025-01-29 01:41:36,657 [INFO] Command /data/truvari/__main__.py bench -b repo_utils/test_files/variants/bnd.base.vcf.gz -c repo_utils/test_files/variants/bnd.comp2.vcf.gz --sizemax 1000000000 -p 0 --pick multi -o test_results/bench_bnd_decomp/
2025-01-29 01:41:36,658 [INFO] Params:
{
"base": "/data/repo_utils/test_files/variants/bnd.base.vcf.gz",
"comp": "/data/repo_utils/test_files/variants/bnd.comp2.vcf.gz",
Expand Down Expand Up @@ -36,27 +36,27 @@
"skip_gt": false,
"max_resolve": 25000
}
2025-01-28 22:35:15,911 [WARNING] 193 contigs present in comparison VCF header are not in baseline VCF.
2025-01-28 22:35:39,849 [INFO] Zipped 30098 variants Counter({'comp': 29902, 'base': 196})
2025-01-28 22:35:39,850 [INFO] 20659 chunks of 30098 variants Counter({'comp': 29902, 'base': 186, '__filtered': 10})
2025-01-28 22:35:45,581 [INFO] Stats: {
"TP-base": 147,
"TP-comp": 128,
"FP": 28402,
"FN": 39,
"precision": 0.004486505432877673,
"recall": 0.7903225806451613,
"f1": 0.008922360385402724,
"base cnt": 186,
"comp cnt": 28530,
2025-01-29 01:41:36,746 [WARNING] 193 contigs present in comparison VCF header are not in baseline VCF.
2025-01-29 01:41:58,627 [INFO] Zipped 30098 variants Counter({'comp': 29902, 'base': 196})
2025-01-29 01:41:58,627 [INFO] 20660 chunks of 30098 variants Counter({'comp': 29902, 'base': 195, '__filtered': 1})
2025-01-29 01:42:03,703 [INFO] Stats: {
"TP-base": 152,
"TP-comp": 131,
"FP": 28401,
"FN": 43,
"precision": 0.004591336043740362,
"recall": 0.7794871794871795,
"f1": 0.009128901026932595,
"base cnt": 195,
"comp cnt": 28532,
"TP-comp_TP-gt": 1,
"TP-comp_FP-gt": 127,
"TP-comp_FP-gt": 130,
"TP-base_TP-gt": 1,
"TP-base_FP-gt": 146,
"gt_concordance": 0.0078125,
"TP-base_FP-gt": 151,
"gt_concordance": 0.007633587786259542,
"gt_matrix": {
"(0, 1)": {
"(0, 0)": 133,
"(0, 0)": 137,
"(0, 1)": 1
},
"(0, 0, 1)": {
Expand All @@ -66,7 +66,7 @@
"(0, 0)": 2
},
"(0, 0, 0, 1)": {
"(0, 0)": 1
"(0, 0)": 2
},
"(0, 0, 1, 0)": {
"(0, 0)": 1
Expand All @@ -79,4 +79,4 @@
}
}
}
2025-01-28 22:35:45,582 [INFO] Finished bench
2025-01-29 01:42:03,704 [INFO] Finished bench
28 changes: 14 additions & 14 deletions repo_utils/answer_key/bench/bench_bnd_decomp/summary.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"TP-base": 147,
"TP-comp": 128,
"FP": 28402,
"FN": 39,
"precision": 0.004486505432877673,
"recall": 0.7903225806451613,
"f1": 0.008922360385402724,
"base cnt": 186,
"comp cnt": 28530,
"TP-base": 152,
"TP-comp": 131,
"FP": 28401,
"FN": 43,
"precision": 0.004591336043740362,
"recall": 0.7794871794871795,
"f1": 0.009128901026932595,
"base cnt": 195,
"comp cnt": 28532,
"TP-comp_TP-gt": 1,
"TP-comp_FP-gt": 127,
"TP-comp_FP-gt": 130,
"TP-base_TP-gt": 1,
"TP-base_FP-gt": 146,
"gt_concordance": 0.0078125,
"TP-base_FP-gt": 151,
"gt_concordance": 0.007633587786259542,
"gt_matrix": {
"(0, 1)": {
"(0, 0)": 133,
"(0, 0)": 137,
"(0, 1)": 1
},
"(0, 0, 1)": {
Expand All @@ -25,7 +25,7 @@
"(0, 0)": 2
},
"(0, 0, 0, 1)": {
"(0, 0)": 1
"(0, 0)": 2
},
"(0, 0, 1, 0)": {
"(0, 0)": 1
Expand Down
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/tp-base.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/tp-base.vcf.gz.tbi
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/tp-comp.vcf.gz
Binary file not shown.
Binary file modified repo_utils/answer_key/bench/bench_bnd_decomp/tp-comp.vcf.gz.tbi
Binary file not shown.
2 changes: 1 addition & 1 deletion truvari/variant_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def is_bnd(self):
"""
Returns if a record is a resolved BND
"""
return self.alleles_variant_types[1] == 'BND'
return '[' in self._record.alts[0] or ']' in self._record.alts[0]

def is_filtered(self, values=None):
"""
Expand Down

0 comments on commit 664fd5b

Please sign in to comment.