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§
Source§impl 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§
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Location
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more