pub struct Edge {
pub id: HashId,
pub source_node_id: HashId,
pub source_coordinate: i64,
pub source_strand: Strand,
pub target_node_id: HashId,
pub target_coordinate: i64,
pub target_strand: Strand,
}Fields§
§id: HashId§source_node_id: HashId§source_coordinate: i64§source_strand: Strand§target_node_id: HashId§target_coordinate: i64§target_strand: StrandImplementations§
Source§impl Edge
impl Edge
pub fn select(conn: &Connection) -> EdgeSelect<'_>
pub fn all(conn: &Connection) -> Result<Vec<Self>, ModelSelectError>
Source§impl Edge
impl Edge
pub fn create( conn: &GraphConnection, source_node_id: HashId, source_coordinate: i64, source_strand: Strand, target_node_id: HashId, target_coordinate: i64, target_strand: Strand, ) -> Result<Edge, EdgeError>
pub fn bulk_create(conn: &GraphConnection, edges: &[EdgeData]) -> Vec<HashId>
pub fn to_data(edge: Edge) -> EdgeData
pub fn edges_for_block_group_nodes( conn: &GraphConnection, block_group_id: &HashId, node_ids: &[HashId], history_ref: Option<&str>, ) -> Result<Vec<AugmentedEdge>, EdgeError>
Sourcepub fn blocks_from_edges(
conn: &GraphConnection,
workspace: &Workspace,
block_group_id: &HashId,
edges: &[AugmentedEdge],
history_ref: Option<&str>,
) -> Result<Vec<GroupBlock>, EdgeError>
pub fn blocks_from_edges( conn: &GraphConnection, workspace: &Workspace, block_group_id: &HashId, edges: &[AugmentedEdge], history_ref: Option<&str>, ) -> Result<Vec<GroupBlock>, EdgeError>
Computes the backing-node slices from the stored block group edges.
Graph construction, sequence enumeration, GFA export, and diff reconstruction use this as
the first half of the edge-to-GenGraph pipeline, the second half being the build_graph
method below. This method gathers coordinates, expands incomplete node descriptions from
the block group, and calls get_block_intervals to construct both blocks with sequences
and zero-width junction blocks.
For example, two adjacent deletions retain each original base while also exposing the path that skips both. Parenthesized nodes are zero-width junctions and bracketed nodes contain real sequence:
+----> [A] ----+
| |
[TAAT] -> (0,0) -+------------> (1,1) -+----> [T] ----+
| |
+-----------> [GATAA]The path (0,0) -> (1,1) deletes A; (1,1) -> [GATAA] deletes T. Following both
edges gives the iterative-deletion route from [TAAT] to [GATAA] without adding a
reconstructed bypass edge.
More generally, graph construction can produce a chain of junctions between sequence blocks:
[real sequence] -> (junction) -> (junction) -> [real sequence]
0 bases 0 basesTraversal passes through any number of junctions, consuming zero sequence, until it reaches another real block.
Sourcepub fn build_graph(
edges: &[AugmentedEdge],
blocks: &[GroupBlock],
) -> (GenGraph, HashMap<(i64, i64), Edge>)
pub fn build_graph( edges: &[AugmentedEdge], blocks: &[GroupBlock], ) -> (GenGraph, HashMap<(i64, i64), Edge>)
Computes a GenGraph from augmented edges and their computed blocks.
BlockGroup::get_graph, sequence enumeration, and graph export call this after
blocks_from_edges. The returned node-pair map retains the input Edge responsible for
each projected graph edge so downstream consumers can recover edge provenance.
Junctions and PRESERVE_EDIT_SITE_CHROMOSOME_INDEX have independent jobs:
- A junction is a generated zero-width graph node. It gives adjacent edges a shared endpoint so edges can link to the site of an edit instead of requiring a sequence to link to. This occurs in places such as deleting the first base of a node, or adjacent deletions.
PRESERVE_EDIT_SITE_CHROMOSOME_INDEXis metadata on anAugmentedEdge. It identifies a reference-healing connection. Importantly, these are in the database whereas junctions are in the built graph only.
When a marked same-coordinate edge meets a junction, one input edge can produce two in-memory graph connections:
[real sequence] -- preserve marker --> (junction) -- preserve marker --> [real sequence]
0 basesThe junction is the generated node. The two labels represent copied chromosome-index metadata on the projected connections; neither connection is added to the database.
pub fn is_start_edge(&self) -> bool
pub fn is_end_edge(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edge
impl<'de> Deserialize<'de> for Edge
Source§fn 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>,
impl Eq for Edge
Source§impl Ord for Edge
impl Ord for Edge
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Edge
impl PartialOrd for Edge
impl StructuralPartialEq for Edge
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl Sync for Edge
impl Unpin for Edge
impl UnsafeUnpin for Edge
impl UnwindSafe for Edge
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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