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.
In reference TACG, deleting A gives TCG, deleting the adjacent C gives TAG, and
both deletions give TG. The empty position (2,2) between A and C joins the deletion
edges. Parenthesized nodes are zero-width positions; bracketed nodes contain sequence:
[T] --+--> [A] --+
| |
+----------+--> (2,2) --+--> [C] --+
| |
+----------+--> [G]Deleting A skips [A], and deleting C skips [C]. Their shared position joins the two
edges, so a path can take both deletions without adding a reconstructed bypass edge. A path
may pass through any number of consecutive zero-width positions before reaching a sequence
block; these steps consume no sequence.
Consider a substitution of the first base of TAAT, changing T to G while keeping the
original sequence:
+--> [T] --+
| |
[AC] --> (0,0) -----+--> [G] --+--> [AAT]The incoming edge reaches the start of TAAT; the substitution leaves that same boundary
for [G]. No TAAT bases precede its first T, so no nonempty sequence slice ends at that
boundary for the outgoing edit. (0,0) is an empty position at the start of TAAT, not a
graph coordinate, and supplies the shared endpoint. The two paths spell ACTAAT and
ACGAAT.
If the input has only the incoming edge from [AC] to TAAT, fetched neighboring edges
can reveal the substitution. Include those edges when choosing the zero-width blocks.
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:
[ATA] -- reference --> (3,3) -- reference --> [CG]
0 bases(3,3) is the generated node. The reference labels represent copied chromosome-index
metadata on the projected connections; neither connection is added to the database.
One stored edge may produce several graph links. Each link keeps the edge’s ID and metadata;
the pair map retains the original Edge, so pruning recognizes the links as one edit.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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