pub enum NucleotideCoordinate {
Known {
anchor: NucleotideAnchor,
coordinate: i32,
offset: i32,
},
Unknown,
}Expand description
Nucleotide coordinate written as a known position or ?.
Known coordinates keep the sign written in the HGVS string. For example,
c.-1 becomes coordinate() == Some(-1), while c.*1 becomes
coordinate() == Some(1). CDS-anchored intronic positions keep the same
primary coordinate plus a signed secondary offset, e.g. c.-106+2 becomes
coordinate() == Some(-106) and offset() == Some(2).
§Examples
use tinyhgvs::{NucleotideAnchor, VariantDescription, parse_hgvs};
let five_prime = parse_hgvs("NM_007373.4:c.-1C>T").unwrap();
let three_prime = parse_hgvs("NM_001272071.2:c.*1C>T").unwrap();
let five_prime_intronic = parse_hgvs("NM_001385026.1:c.-106+2T>A").unwrap();
match five_prime.description {
VariantDescription::Nucleotide(description) => {
assert_eq!(description.location.start().unwrap().anchor(), Some(NucleotideAnchor::RelativeCdsStart));
assert_eq!(description.location.start().unwrap().coordinate(), Some(-1));
assert_eq!(description.location.start().unwrap().offset(), Some(0));
}
_ => unreachable!("expected nucleotide variant"),
}
match three_prime.description {
VariantDescription::Nucleotide(description) => {
assert_eq!(description.location.start().unwrap().anchor(), Some(NucleotideAnchor::RelativeCdsEnd));
assert_eq!(description.location.start().unwrap().coordinate(), Some(1));
assert_eq!(description.location.start().unwrap().offset(), Some(0));
}
_ => unreachable!("expected nucleotide variant"),
}
match five_prime_intronic.description {
VariantDescription::Nucleotide(description) => {
assert_eq!(description.location.start().unwrap().anchor(), Some(NucleotideAnchor::RelativeCdsStart));
assert_eq!(description.location.start().unwrap().coordinate(), Some(-106));
assert_eq!(description.location.start().unwrap().offset(), Some(2));
}
_ => unreachable!("expected nucleotide variant"),
}Variants§
Known
Known nucleotide coordinate with anchor and optional offset.
Unknown
Unknown nucleotide coordinate written as ?.
Implementations§
Source§impl NucleotideCoordinate
impl NucleotideCoordinate
Sourcepub fn known(anchor: NucleotideAnchor, coordinate: i32, offset: i32) -> Self
pub fn known(anchor: NucleotideAnchor, coordinate: i32, offset: i32) -> Self
Builds a known nucleotide coordinate.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true when this coordinate is written as ?.
Sourcepub fn anchor(&self) -> Option<NucleotideAnchor>
pub fn anchor(&self) -> Option<NucleotideAnchor>
Returns the anchor when this coordinate is known.
Sourcepub fn coordinate(&self) -> Option<i32>
pub fn coordinate(&self) -> Option<i32>
Returns the primary coordinate when it is known.
Sourcepub fn is_intronic(&self) -> bool
pub fn is_intronic(&self) -> bool
Returns true for intronic coordinates such as 357+1, -106+2,
and *639-1.
Sourcepub fn is_cds_start_anchored(&self) -> bool
pub fn is_cds_start_anchored(&self) -> bool
Returns true if variant’s location is relative to the CDS start, such
as c.-1 and c.-106+2.
Sourcepub fn is_cds_end_anchored(&self) -> bool
pub fn is_cds_end_anchored(&self) -> bool
Returns true if variant’s location is relative to the CDS end, such
as c.*1 and c.*639-1.
Sourcepub fn is_five_prime_utr(&self) -> bool
pub fn is_five_prime_utr(&self) -> bool
Returns true for exonic 5’ UTR coordinates such as c.-81.
Sourcepub fn is_three_prime_utr(&self) -> bool
pub fn is_three_prime_utr(&self) -> bool
Returns true for exonic 3’ UTR coordinates such as c.*24.
Trait Implementations§
Source§impl Clone for NucleotideCoordinate
impl Clone for NucleotideCoordinate
Source§fn clone(&self) -> NucleotideCoordinate
fn clone(&self) -> NucleotideCoordinate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more