pub struct GraphicalGenome {
pub anchor: HashMap<String, Value>,
pub edges: HashMap<String, Value>,
pub outgoing: HashMap<String, Vec<String>>,
pub incoming: HashMap<String, Vec<String>>,
}
Fields§
§anchor: HashMap<String, Value>
§edges: HashMap<String, Value>
§outgoing: HashMap<String, Vec<String>>
§incoming: HashMap<String, Vec<String>>
Implementations§
Source§impl GraphicalGenome
impl GraphicalGenome
Sourcepub fn load_graph(filename: &str) -> Result<GraphicalGenome>
pub fn load_graph(filename: &str) -> Result<GraphicalGenome>
Load a graphical genome from a file
§Arguments
filename
- A string slice that holds the name of the file to be loaded
§Returns
A Result containing the graphical genome if the file was successfully loaded
§Errors
- The file cannot be opened (e.g., permission issues, file not found).
- The file format is invalid (e.g., not a valid GZIP file or has unexpected content).
§Panics
- The file cannot be opened.
- The file is not a valid GZIP-compressed file.
- The annotation string is not valid JSON.
- There is a memory allocation error or other unexpected issue with the
HashMap
operations.
Sourcepub fn extract_single_sample_graph(
&self,
df_single_sample: &Array2<f64>,
anchorlist: &Vec<String>,
readset: &Vec<String>,
sample: &str,
) -> Result<GraphicalGenome>
pub fn extract_single_sample_graph( &self, df_single_sample: &Array2<f64>, anchorlist: &Vec<String>, readset: &Vec<String>, sample: &str, ) -> Result<GraphicalGenome>
Method to extract a single sample graph
§Arguments
df_single_sample
- A 2D array containing the imputed data matrixanchorlist
- A vector of strings containing the anchor namesreadset
- A vector of strings containing the read namessample
- A string slice containing the sample name
§Returns
A Result containing the graphical genome of the single sample
§Errors
- The
df_single_sample
array has an invalid shape. - The anchor or read indices are invalid.
- There is a memory allocation error.
- The JSON data is invalid.
- There is an unexpected data structure or other internal error.
§Panics
If the edge do not have outgoing anchor
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GraphicalGenome
impl RefUnwindSafe for GraphicalGenome
impl Send for GraphicalGenome
impl Sync for GraphicalGenome
impl Unpin for GraphicalGenome
impl UnwindSafe for GraphicalGenome
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.