[−][src]Struct gb_io::seq::Seq
Fields
name: Option<String>
Name as specified in the LOCUS line
topology: Topology
Whether this molecule is linear or circular
date: Option<Date>
The date specified in the LOCUS line
len: Option<usize>
Length as specified in the LOCUS line. Note that this may differ from
seq.len()
, especially if contig
is Some
and seq
is empty. When
parsing a file, if sequence data is provided we check that this value is
equal to seq.len()
molecule_type: Option<String>
division: String
definition: Option<String>
accession: Option<String>
version: Option<String>
source: Option<Source>
dblink: Option<String>
keywords: Option<String>
references: Vec<Reference>
comments: Vec<String>
seq: Vec<u8>
contig: Option<Location>
features: Vec<Feature>
Methods
impl Seq
[src]
pub fn empty() -> Seq
[src]
Create a new, empty Seq
pub fn is_circular(&self) -> bool
[src]
pub fn len(&self) -> i64
[src]
Returns the "actual" length of the sequence. Note that this may not be equal to self.seq.len(), in the following circumstances:
self.seq
is empty andself.contig
is not, and the corresponding file's LOCUS line specified a length. The returned value is i64 to simplifiy arithmetic with coords fromLocation
pub fn unwrap_range(&self, start: i64, end: i64) -> (i64, i64)
[src]
"Normalises" an exclusive range on the chromosome, to make handling circular
sequences simpler. For linear sequences, it doesn't do anything except
panic unless start
and end
are both within the sequence, or if end <= start
. For circular sequences, all values, including negative values,
are allowed.
If end
<= start
, the range is assumed to wrap around. The returned
values will satisfy the following conditions:
0 <= first < len
first < last
This means that in the case of a range which wraps around,last
>=len
.
pub fn range_to_location(&self, start: i64, end: i64) -> Location
[src]
Given a range on this sequence, returns a corresponding Location
Note: this is a rust-style, exclusive range
pub fn wrap_location(&self, p: Location) -> Result<Location, LocationError>
[src]
"Wraps" a location on a circular sequence, so that coordinates that extend beyond the end of the sequence are are wrapped to the origin.
pub fn relocate_feature(
&self,
f: Feature,
shift: i64
) -> Result<Feature, LocationError>
[src]
&self,
f: Feature,
shift: i64
) -> Result<Feature, LocationError>
"Shifts" a feature forwards by shift
NTs (can be negative)
Note: If this fails you won't get the original Feature
back. If this is important, you should clone first
pub fn relocate_location(
&self,
p: Location,
shift: i64
) -> Result<Location, LocationError>
[src]
&self,
p: Location,
shift: i64
) -> Result<Location, LocationError>
"Shifts" a location forwards by shift
NTs (can be negative)
Note: If this fails you won't get the original Location
back. If this is important, you should clone first
pub fn revcomp_feature(&self, f: Feature) -> Result<Feature, LocationError>
[src]
Note: If this fails you won't get the original Feature
back. If this is important, you should clone first
pub fn revcomp(&self) -> Seq
[src]
Returns the reverse complement of a Seq
, skipping any features
which can't be processed with a warning
pub fn extract_range_seq(&self, start: i64, end: i64) -> Cow<[u8]>
[src]
Extracts just the sequence from start
to end
, taking into
account circularity. Note that end
is exclusive. Use
this instead of extract_range
if you don't need the
features.
pub fn extract_range(&self, start: i64, end: i64) -> Seq
[src]
Extracts from start
to end
, truncating features that
extend beyond this range. Note that end
is not
inclusive. Skips ambiguous features with a warning.
pub fn extract_location(&self, l: &Location) -> Result<Vec<u8>, LocationError>
[src]
Extract the sequence specified by l
. This version returns
Err(LocationError::External(_, NoFetcherError))
if it
encounters a reference to an external sequence.
See extract_location_with_fetcher
for details
pub fn extract_location_with_fetcher<'a, F, S>(
&self,
l: &Location,
ext_fetcher: F
) -> Result<Vec<u8>, LocationError> where
F: FnMut(&str) -> Result<S, Box<dyn Error>> + 'a,
S: Borrow<Seq> + 'a,
[src]
&self,
l: &Location,
ext_fetcher: F
) -> Result<Vec<u8>, LocationError> where
F: FnMut(&str) -> Result<S, Box<dyn Error>> + 'a,
S: Borrow<Seq> + 'a,
Extract the sequence specified by l
. If the location
references an external sequence, ext_fetcher
will be called
with the name of this sequence to retrieve it. Since an external
feature may be referenced multiple times, it might be best to
return &Seq
or similar from ext_fetcher
.
pub fn set_origin(&self, origin: i64) -> Seq
[src]
Returns a new Seq
, rotated so that origin
is at the start
pub fn write<T: Write>(&self, file: T) -> Result<()>
[src]
Trait Implementations
impl PartialEq<Seq> for Seq
[src]
impl Clone for Seq
[src]
fn clone(&self) -> Seq
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Seq
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,