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
impl GIR
Sourcepub fn new(
g_rep: Vec<Task>,
annotation: HashMap<String, (usize, usize)>,
alt_stream: Vec<char>,
ref_stream: Vec<char>,
res_array: Vec<char>,
) -> Self
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);Sourcepub fn get_tasks(&self) -> &Vec<Task>
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);
´´´Sourcepub fn consume_and_get_tasks(self) -> Vec<Task>
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);
´´´Sourcepub fn consumer_and_get_resources(
self,
) -> (Vec<Task>, HashMap<String, (usize, usize)>, Vec<char>, Vec<char>, Vec<char>)
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);Sourcepub fn get_annotation(&self) -> &HashMap<String, (usize, usize)>
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);Sourcepub fn get_results_max(&self) -> usize
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);Sourcepub fn execute(
self,
engine: Engine,
) -> (Vec<char>, HashMap<String, (usize, usize)>)
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);