Skip to content

Commit 9d2b86e

Browse files
committed
Merge branch 'release/v2.0.2'
Patch fixing PS tag
2 parents 3e64941 + 6b830f7 commit 9d2b86e

File tree

10 files changed

+26
-4
lines changed

10 files changed

+26
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kanpig"
3-
version = "2.0.1"
3+
version = "2.0.2"
44
edition = "2021"
55

66
[dependencies]

repo_utils/kanpig_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ TESTS=(
66
"plat"
77
"mims"
88
"pybind"
9+
"ps_test"
910
)
1011

1112
# Run from truvari's base directory
685 Bytes
Binary file not shown.
144 Bytes
Binary file not shown.
661 Bytes
Binary file not shown.
146 Bytes
Binary file not shown.

repo_utils/ps_test/baseline.vcf.gz

1.72 KB
Binary file not shown.

repo_utils/ps_test/run_test.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
OD=$1
2+
SRC=$2
3+
4+
$kanpig gt \
5+
--reads ${SRC}/HG002_withHP.plup.gz \
6+
--input ${SRC}/baseline.vcf.gz \
7+
--reference ${REF} \
8+
-o ${OD}/with.vcf
9+
10+
result=$(bcftools query -f "[%PS]\n" ${OD}/with.vcf)
11+
test "$result" = "8903002" || exit 1
12+
13+
14+
$kanpig gt \
15+
--reads ${SRC}/HG002_woHP.plup.gz \
16+
--input ${SRC}/baseline.vcf.gz \
17+
--reference ${REF} \
18+
-o ${OD}/without.vcf
19+
20+
result=$(bcftools query -f "[%PS]\n" ${OD}/without.vcf)
21+
test "$result" = "9015824" || exit 1

src/kplib/annotator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ fn finalize_annotation(
285285
// Either use haplotagging PS or NE (+1 for 1-based like in the VCF)
286286
let ps = paths
287287
.first()
288-
.and_then(|p| p.meta.ps.get(sample_idx).copied())
289-
.unwrap_or(Some((neigh_group + 1) as u32));
288+
.and_then(|p| p.meta.ps.get(sample_idx).and_then(|&ps| ps))
289+
.or(Some((neigh_group + 1) as u32));
290290

291291
let ad = vec![Some(ref_cov as i32), Some((alt_cov1 + alt_cov2) as i32)];
292292

0 commit comments

Comments
 (0)