Skip to content

Commit

Permalink
Merge pull request #24 from PacificBiosciences/sv_variant_relax
Browse files Browse the repository at this point in the history
syncing changes for 1.3.0
  • Loading branch information
holtjma authored Feb 2, 2024
2 parents 9428590 + ac14be8 commit 94118a4
Show file tree
Hide file tree
Showing 8 changed files with 265 additions and 130 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v1.3.0
## Changes
- Relaxes the requirements for SV deletion and insertion events such that they no longer require an alternate or reference allele, respectively, to have length 1

## Internal changes
- The interface for variant creation was modified to reduce panics from invalid variant construction. This modification changes all the return types for the various `Variant::new*(...)` functions from `Variant` to `Result<Variant, VariantError>`.

## Fixed
- SV events with a placeholder ALT sequence (e.g., \<DEL\>, \<INS\>) are now properly ignored by HiPhase instead of creating an error.

# v1.2.1
## Fixed
- Fixed [a rare issue](https://github.com/PacificBiosciences/pbbioconda/issues/640) where reference alleles with stripped IUPAC codes were throwing errors due to reference mismatch
Expand Down
56 changes: 34 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hiphase"
version = "1.2.1"
version = "1.3.0"
authors = ["J. Matthew Holt <[email protected]>"]
description = "A tool for jointly phasing small, structural, and tandem repeat variants for PacBio sequencing data"
edition = "2021"
Expand Down Expand Up @@ -31,6 +31,7 @@ rust-htslib = { version = "0.39.5", default-features = false, features = ["stati
rustc-hash = "1.1.0"
serde = "1.0.147"
simple-error = "0.2.3"
thiserror = "1.0.56"
threadpool = "1.8.1"

[profile.release]
Expand Down
19 changes: 14 additions & 5 deletions LICENSE-THIRDPARTY.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
},
{
"name": "hiphase",
"version": "1.2.1",
"version": "1.3.0",
"authors": "J. Matthew Holt <[email protected]>",
"repository": null,
"license": null,
Expand Down Expand Up @@ -910,7 +910,7 @@
},
{
"name": "proc-macro2",
"version": "1.0.58",
"version": "1.0.78",
"authors": "David Tolnay <[email protected]>|Alex Crichton <[email protected]>",
"repository": "https://github.com/dtolnay/proc-macro2",
"license": "Apache-2.0 OR MIT",
Expand All @@ -928,7 +928,7 @@
},
{
"name": "quote",
"version": "1.0.27",
"version": "1.0.35",
"authors": "David Tolnay <[email protected]>",
"repository": "https://github.com/dtolnay/quote",
"license": "Apache-2.0 OR MIT",
Expand Down Expand Up @@ -1160,6 +1160,15 @@
"license_file": null,
"description": "Parser for Rust source code"
},
{
"name": "syn",
"version": "2.0.48",
"authors": "David Tolnay <[email protected]>",
"repository": "https://github.com/dtolnay/syn",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "Parser for Rust source code"
},
{
"name": "termcolor",
"version": "1.1.3",
Expand All @@ -1171,7 +1180,7 @@
},
{
"name": "thiserror",
"version": "1.0.37",
"version": "1.0.56",
"authors": "David Tolnay <[email protected]>",
"repository": "https://github.com/dtolnay/thiserror",
"license": "Apache-2.0 OR MIT",
Expand All @@ -1180,7 +1189,7 @@
},
{
"name": "thiserror-impl",
"version": "1.0.37",
"version": "1.0.56",
"authors": "David Tolnay <[email protected]>",
"repository": "https://github.com/dtolnay/thiserror",
"license": "Apache-2.0 OR MIT",
Expand Down
8 changes: 7 additions & 1 deletion src/block_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn is_phasable_variant(record: &bcf::Record, sample_index: usize, min_qualit
VariantType::SvDuplication |
VariantType::SvInversion |
VariantType::SvBreakend |
VariantType::Unknown=> { Ok(false) }
VariantType::Unknown => { Ok(false) }
}
}
}
Expand Down Expand Up @@ -231,6 +231,12 @@ pub fn get_variant_type(record: &bcf::Record) -> Result<VariantType, Box<dyn std
// make sure these only have one ALT allele
let num_alleles = record.alleles().len();
assert_eq!(num_alleles, 2);

// make sure the alternate allele is not a placeholder like <DEL>; if so, return Unknown because we do not want to phase it
let alt_allele = std::str::from_utf8(record.alleles()[1]).unwrap_or("<unknown>");
if alt_allele.starts_with('<') && alt_allele.ends_with('>') {
return Ok(VariantType::Unknown);
}

let svtype_str = std::str::from_utf8(svtype[0]).unwrap();
let sv_tag = match svtype_str {
Expand Down
Loading

0 comments on commit 94118a4

Please sign in to comment.