#[derive(Debug, Clone, PartialEq)]
pub struct HomologyRegion {
pub start1: i32,
pub end1: i32,
pub start2: i32,
pub end2: i32,
pub opt: f64,
pub overlapaa: i32,
pub extended: bool,
pub importance: f64,
pub rimportance: f64,
pub korh: u8,
pub nokori: i32,
}
impl Default for HomologyRegion {
fn default() -> Self {
Self {
start1: 0,
end1: 0,
start2: 0,
end2: 0,
opt: 0.0,
overlapaa: 0,
extended: false,
importance: 0.0,
rimportance: 0.0,
korh: b'h',
nokori: 0,
}
}
}
#[derive(Debug, Clone, Default)]
pub struct LocalHomologyTable {
pub nseq: usize,
entries: Vec<Vec<HomologyRegion>>,
}
impl LocalHomologyTable {
pub fn new(nseq: usize) -> Self {
Self {
nseq,
entries: vec![Vec::new(); nseq * nseq],
}
}
pub fn get(&self, i: usize, j: usize) -> &[HomologyRegion] {
&self.entries[i * self.nseq + j]
}
pub fn get_mut(&mut self, i: usize, j: usize) -> &mut Vec<HomologyRegion> {
&mut self.entries[i * self.nseq + j]
}
pub fn push(&mut self, i: usize, j: usize, region: HomologyRegion) {
self.entries[i * self.nseq + j].push(region);
}
}