GIR

Struct GIR 

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

GIRL: Genomic intermediate representation language (GIRL) which us derived from sequence intermediate representation (SIR) a generic representation for sequence editing tasks, it is composite of 1- a vector of tasks, see(Tasks for more details) 2- an hashmap containing the bodundires of the resulting hashmap array 3- alt_stream: a vector of chars containing alterations, i.e. mutated amino acids 4- ref_stream: a vector of chars containing the reference stream 5- res_array: a vector of chars containing the resulting arrays the struct derives the Debug and the clone traits

Implementations§

Source§

impl GIR

Source

pub fn new( g_rep: Vec<Task>, annotation: HashMap<String, (usize, usize)>, alt_stream: Vec<char>, ref_stream: Vec<char>, res_array: Vec<char>, ) -> Self

§Summary

Create a new instance using the main 5 units needed for representation

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation:HashMap<String,(usize,usize)>=HashMap::new(); 
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
println!("The generated GIRL is: {:#?}",res);
Source

pub fn get_tasks(&self) -> &Vec<Task>

§Summary

Return a reference to the instance vector of tasks

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation:HashMap<String,(usize,usize)>=HashMap::new(); 
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// return a reference to the instance vector of tasks 
let task = res.get_tasks();
println!("The instance's tasks are: {:?}",task);
´´´
Source

pub fn consume_and_get_tasks(self) -> Vec<Task>

§Summary

Consume the instance and move its vector of tasks to the caller

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation:HashMap<String,(usize,usize)>=HashMap::new(); 
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// return a reference to the instance vector of tasks 
let task = res.consume_and_get_tasks();
println!("The instance's tasks are: {:?}",task);
//println!("This line will cause an error if printed as res has been consumed: {:#?}",res);
´´´
Source

pub fn consumer_and_get_resources( self, ) -> (Vec<Task>, HashMap<String, (usize, usize)>, Vec<char>, Vec<char>, Vec<char>)

§Summary

Consume the instance and return its component as a tuple of elements

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation:HashMap<String,(usize,usize)>=HashMap::new(); 
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// return a reference to the instance vector of tasks 
let task = res.consume_and_get_tasks();
println!("The instance's tasks are: {:?}",task);
//println!("This line will cause an error if printed as res has been consumed: {:#?}",res);
Source

pub fn get_annotation(&self) -> &HashMap<String, (usize, usize)>

§Summary

Return a hash map containing the annotations associated in the reference array

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation:HashMap<String,(usize,usize)>=HashMap::new(); 
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// return a reference to the instance vector of tasks 
let annotations = res.get_annotation();
println!("The instance's annotation is: {:?}",annotations);
Source

pub fn get_results_max(&self) -> usize

§Summary

Return the max index in the tasks vector

§Examples
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::task; 
use std::collections::HashMap; 
// let's define some place holders for a task 
let g_rep:Vec<Task>=Vec::new(); 
let annotation=HashMap::new(); 
// let's add some annotations to the code 
annotations.insert("Sequence_1".to_string(), (0 as usize,25 as usize));
annotations.insert("Sequence_2".to_string(), (25 as usize, 50 as usize))
let alt_stream:Vec<char>=Vec::new(); 
let ref_stream:Vec<char>=Vec::new(); 
let res_array:Vec<char> =Vec::new(); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// return a reference to the instance vector of tasks 
assert_eq!(res.get_results_max(),50 as usize);
Source

pub fn execute( self, engine: Engine, ) -> (Vec<char>, HashMap<String, (usize, usize)>)

§Summary

execute and consume the representation to return a vector of chars containing the edited sequences along with a hashmap containing index of features in the results vector

§Example
// let's load the need modules first 
use ppgg_rust::data_structures::internal_representation::{task,engines}; 
use std::collections::HashMap;
// let's define some dummy example data
let g_rep=Vec::new(); 
let g_rep.push(task::Task::new(0/* execution_code is zero, i.e. reference stream */,
                0 /* start copying from position 0 */,
                4 /* copies 4 amino acids*/, 
                0 /* insert at position 0 in the reference array */)); 
let g_rep.push(task::Task::new(1 /* execution_code is 1, i.e. alternative stream */,
                0 /* start copying from position 0 */,
                1 /* copies 1 amino acids*/, 
                4 /* insert at position 0 in the reference array */)); 
let annotation=HashMap::new(); 
annotation.insert("Seq_1".to_string(),(0 as usize,5 as usize)); 
let alt_stream=vec!['G']; 
let ref_stream=vec!['T','E','S','T']; 
let res_array:Vec<char> =Vec::with_capacity(5); 
let res=GIR::new(g_rep, annotation, alt_stream, ref_stream, res_array); 
// execute the GIR with a single threaded engine 
let (res_char_array, res_hashmap)=res.execute(engines::Engine::from_str("st")); 
println!("Results array: {:#?}",res_char_array); 
println!("Result hashmap is: {:#?}", res_hashmap);

Trait Implementations§

Source§

impl Clone for GIR

Source§

fn clone(&self) -> GIR

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 Debug for GIR

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for GIR

§

impl RefUnwindSafe for GIR

§

impl Send for GIR

§

impl Sync for GIR

§

impl Unpin for GIR

§

impl UnwindSafe for GIR

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.