NCGfa

Struct NCGfa 

Source
pub struct NCGfa<T: OptFields> {
    pub header: Header,
    pub nodes: Vec<NCNode<T>>,
    pub paths: Vec<NCPath>,
    pub edges: Option<Vec<NCEdge<T>>>,
    pub mapper: Vec<String>,
}
Expand description

The graph contains of nodes, path and edges. NCGfa = NumericCompactGfa This is a compact graph representation of the GFA file.

Comment: Implementation here are much faster and do include some derivates of parser and data structures that are not parsing the whole file and/or are faster with the downside of more memory.

Fields§

§header: Header§nodes: Vec<NCNode<T>>§paths: Vec<NCPath>§edges: Option<Vec<NCEdge<T>>>§mapper: Vec<String>

Implementations§

Source§

impl<T: OptFields> NCGfa<T>

Source

pub fn new() -> Self

NGraph constructor

§Example
use gfa_reader::NCGfa;
let graph: NCGfa<()> = NCGfa::new();
Source

pub fn parse_gfa_file_direct(&mut self, file_name: &str, edge: bool)

Read the graph from a file

§Example
use gfa_reader::Gfa;
let mut graph = Gfa::new();
graph.parse_gfa_file("/path/to/graph");
´´´
Source

pub fn parse_gfa_file_and_convert(&mut self, file_name: &str, edges: bool)

Read the graph from a file

§Example
use gfa_reader::Gfa;
let mut graph = Gfa::new();
graph.parse_gfa_file("/path/to/graph");
´´´
Source

pub fn make_mapper(&mut self, graph: &Gfa<T>) -> HashMap<String, usize>

Creat a map from string node id -> numeric node id

Source

pub fn convert_with_mapper( &mut self, mapper: HashMap<String, usize>, graph: &Gfa<T>, )

Convert the “old” graph with the mapper

Using the mapper from “make_mapper”

Source

pub fn get_old_node(&self, node_id: &usize) -> &String

Get original (string) node

Source

pub fn to_file(self, file_name: &str)

Write the graph to a file

Source

pub fn check_numeric(&self) -> bool

Check if the graph is really numeric

Source

pub fn remove_mapper(&mut self)

Remove the mapper if not needed

Trait Implementations§

Source§

impl<T: Clone + OptFields> Clone for NCGfa<T>

Source§

fn clone(&self) -> NCGfa<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + OptFields> Debug for NCGfa<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for NCGfa<T>

§

impl<T> RefUnwindSafe for NCGfa<T>
where T: RefUnwindSafe,

§

impl<T> Send for NCGfa<T>
where T: Send,

§

impl<T> Sync for NCGfa<T>
where T: Sync,

§

impl<T> Unpin for NCGfa<T>
where T: Unpin,

§

impl<T> UnwindSafe for NCGfa<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.