pub enum Location {
Range((i64, Before), (i64, After)),
Between(i64, i64),
Complement(Box<Location>),
Join(Vec<Location>),
Order(Vec<Location>),
Bond(Vec<Location>),
OneOf(Vec<Location>),
External(String, Option<Box<Location>>),
Gap(GapLength),
}
Expand description
Represents a Genbank “location”, used to specify the location of features and in the CONTIG line. See http://www.insdc.org/files/feature_table.html for a detailed description of what they mean.
Note that locations specified here must always refer to a
nucleotide within the sequence. Ranges are inclusive in Genbank
format, but represented as exclusive ranges, using 0-based
indexing in this library. For example, 1..3
will be represented
as Range((0, Before(false)), (4, After(false)))
.
To specify a range that wraps around on a circular sequence,
Genbank files use join(x..last,1..y)
.
Variants
Range((i64, Before), (i64, After))
Represents a range of positions, indicated with [<]x..[>]y in
the Genbank file. If <
or >
are present, then Before
or
After
will be true, respectively. This means that the
feature starts before/extends beyond the end point. Genbank
files represent locations consisting of a single position with
a single number. In this library this is represented using
Range
, i.e. 1
becomes Range((0, Before(false)), (1, After(false)))
.
Between(i64, i64)
Represented as n^n+1
: This means that the location is
between the two adjacent positions specified. On a circular
sequence the last and first positions are also allowed.
Complement(Box<Location>)
INSDC: “Find the complement of the presented sequence in the span specified by “location” (i.e., read the complement of the presented strand in its 5’-to-3’ direction)“
Join(Vec<Location>)
INSDC: “The indicated elements should be joined (placed end-to-end) to form one contiguous sequence”
Order(Vec<Location>)
INSDC: “The elements can be found in the specified order (5’ to 3’ direction), but nothing is implied about the reasonableness about joining them”
Bond(Vec<Location>)
OneOf(Vec<Location>)
External(String, Option<Box<Location>>)
Gap(GapLength)
Implementations
sourceimpl Location
impl Location
sourcepub fn simple_range(a: i64, b: i64) -> Location
pub fn simple_range(a: i64, b: i64) -> Location
Convenience constructor for this commonly used variant
pub fn single(a: i64) -> Location
sourcepub fn find_bounds(&self) -> Result<(i64, i64), LocationError>
pub fn find_bounds(&self) -> Result<(i64, i64), LocationError>
Try to get the start and end of a location. Returns the starting and finishing locations, as an exclusive range.
sourcepub fn truncate(&self, start: i64, end: i64) -> Option<Location>
pub fn truncate(&self, start: i64, end: i64) -> Option<Location>
Truncates this location, limiting it to the given bounds.
Note: higher
is exclusive.
None
is returned if no part of the location lies within the bounds.
pub fn to_gb_format(&self) -> String
pub fn from_gb_format(s: &str) -> Result<Location, GbParserError>
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Location
impl<'de> Deserialize<'de> for Location
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Location
Auto Trait Implementations
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more