Revised plate structure

This commit is contained in:
Emilia Allison 2023-05-11 22:47:59 -04:00
parent 3a91b99b6b
commit e8bd4ee0f3
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 2 additions and 19 deletions

View File

@ -1,7 +1,6 @@
pub struct Plate { pub struct Plate {
pub plate_type: PlateType, pub plate_type: PlateType,
pub plate_format: PlateFormat, pub plate_format: PlateFormat,
well_groups: Vec<u8>
} }
impl Plate { impl Plate {
@ -10,17 +9,12 @@ impl Plate {
Plate { Plate {
plate_type, plate_type,
plate_format, plate_format,
well_groups: Vec::with_capacity((l*w) as usize)
} }
} }
pub fn size(&self) -> (u8,u8) { pub fn size(&self) -> (u8,u8) {
self.plate_format.size() self.plate_format.size()
} }
pub fn get_well_group(&self, i: u8, j: u8) -> u8 {
self.well_groups[ ((i-1)*self.size().1 + (j-1)) as usize ]
}
} }
pub enum PlateType { pub enum PlateType {
@ -54,20 +48,9 @@ impl PlateFormat {
} }
} }
/*
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{Plate, PlateFormat, PlateType}; use super::{Plate, PlateFormat, PlateType};
#[test]
fn test_get_well_group() {
let plate = Plate { // Plate where we know every plate group number
plate_type: PlateType::Source,
plate_format: PlateFormat::W12,
well_groups: vec![1,2,3,4,5,6,7,8,9,10,11,12]
};
assert_eq!(plate.get_well_group(1, 3), 3);
assert_eq!(plate.get_well_group(2, 3), 7);
assert_eq!(plate.get_well_group(3, 1), 9);
}
} }
*/