Graph

Struct Graph 

Source
pub struct Graph { /* private fields */ }
Expand description

A safe, idiomatic Rust wrapper around a C++ odgi::graph_t object.

A Graph instance represents a pangenome graph loaded into memory. Once loaded, you can use its methods to perform various queries, such as retrieving node sequences, finding paths, and traversing the graph structure.

The only way to create a Graph is by calling Graph::load.

Implementations§

Source§

impl Graph

Source

pub fn load(_path: &str) -> Result<Self, Error>

Loads an ODGI graph from a file into memory.

Source

pub fn node_count(&self) -> u64

Returns the total number of nodes in the graph.

Source

pub fn get_path_names(&self) -> Vec<String>

Returns a list of all path names in the graph.

Source

pub fn project(&self, _path_name: &str, _pos: u64) -> Option<PathPosition>

Projects a 0-based linear coordinate on a path to graph coordinates.

Source

pub fn get_node_sequence(&self, _node_id: u64) -> String

Gets the DNA sequence for a given node ID.

Source

pub fn get_node_len(&self, _node_id: u64) -> u64

Gets the length of the sequence for a given node ID.

Source

pub fn get_successors(&self, _node_id: u64) -> Vec<Edge>

Gets all successor edges for a given node ID.

Source

pub fn get_predecessors(&self, _node_id: u64) -> Vec<Edge>

Gets all predecessor edges for a given node ID.

Source

pub fn get_paths_on_node(&self, _node_id: u64) -> Vec<String>

Gets the names of all paths that step on a given node ID.

Source

pub fn get_path_length(&self, _path_name: &str) -> Option<u64>

Gets the total length of a path in base pairs.

Source

pub fn get_paths_on_edge( &self, _from_node: u64, _from_orientation: bool, _to_node: u64, _to_orientation: bool, ) -> Vec<String>

Gets the names of all paths that traverse a specific directed edge.

Trait Implementations§

Source§

impl Send for Graph

Marks the Graph struct as safe to send between threads.

Source§

impl Sync for Graph

Marks the Graph struct as safe to share between threads.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.