refactor: Well struct

most devious refactoring
This commit is contained in:
Emilia Allison 2024-08-10 02:39:37 -04:00
parent ca142ef594
commit 7771ce1786
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
10 changed files with 129 additions and 100 deletions

View File

@ -7,6 +7,7 @@ use super::{string_well_to_pt, TransferRecord, read_csv};
use crate::plate::{PlateFormat, PlateType};
use crate::plate_instances::PlateInstance;
use crate::transfer::Transfer;
use crate::Well;
use crate::transfer_region::{CustomRegion, Region, TransferRegion};
use std::collections::HashSet;
@ -107,7 +108,7 @@ fn find_unique_plates(records: &[TransferRecord]) -> UniquePlates {
fn guess_plate_size(plate_filtered_records: &[&TransferRecord], which: PlateType) -> PlateFormat {
let mut guess = PlateFormat::W96; // Never guess smaller than 96
for record in plate_filtered_records {
if let Some((row, col)) = string_well_to_pt(match which {
if let Some(Well { row, col }) = string_well_to_pt(match which {
PlateType::Source => &record.source_well,
PlateType::Destination => &record.destination_well,
}) {
@ -169,8 +170,8 @@ fn get_transfer_for_pair(
return None;
}
let mut source_wells: HashSet<(u8, u8)> = HashSet::new();
let mut destination_wells: HashSet<(u8, u8)> = HashSet::new();
let mut source_wells: HashSet<Well> = HashSet::new();
let mut destination_wells: HashSet<Well> = HashSet::new();
for record in filtered_records {
let source_point_opt = string_well_to_pt(&record.source_well);
let destination_point_opt = string_well_to_pt(&record.destination_well);
@ -183,8 +184,8 @@ fn get_transfer_for_pair(
destination_wells.insert(destination_point);
}
}
let source_wells_vec: Vec<(u8, u8)> = source_wells.into_iter().collect();
let destination_wells_vec: Vec<(u8, u8)> = destination_wells.into_iter().collect();
let source_wells_vec: Vec<Well> = source_wells.into_iter().collect();
let destination_wells_vec: Vec<Well> = destination_wells.into_iter().collect();
let custom_region: Region =
Region::Custom(CustomRegion::new(source_wells_vec, destination_wells_vec));

View File

@ -1,7 +1,10 @@
use crate::transfer::Transfer;
use crate::util::*;
use crate::{transfer::Transfer, Well};
use super::{alternative_formats::EchoClientTransferRecord, mangle_headers::mangle_headers, transfer_record::TransferRecordDeserializeIntermediate, TransferRecord};
use super::{
alternative_formats::EchoClientTransferRecord, mangle_headers::mangle_headers,
transfer_record::TransferRecordDeserializeIntermediate, TransferRecord,
};
use lazy_static::lazy_static;
use regex::Regex;
use std::error::Error;
@ -22,9 +25,13 @@ pub fn transfer_to_records(
for d_well in dest_wells {
records.push(TransferRecord {
source_plate: src_barcode.to_string(),
source_well: format!("{}{}", num_to_letters(s_well.0).unwrap(), s_well.1),
source_well: format!("{}{}", num_to_letters(s_well.row).unwrap(), s_well.col),
destination_plate: dest_barcode.to_string(),
destination_well: format!("{}{}", num_to_letters(d_well.0).unwrap(), d_well.1),
destination_well: format!(
"{}{}",
num_to_letters(d_well.row).unwrap(),
d_well.col
),
volume: tr.volume,
concentration: None,
})
@ -53,7 +60,7 @@ pub fn records_to_echo_client_csv(trs: Vec<TransferRecord>) -> Result<String, Bo
}
/// Converts "spreadsheet format" well identification to coordinates
pub fn string_well_to_pt(input: &str) -> Option<(u8, u8)> {
pub fn string_well_to_pt(input: &str) -> Option<Well> {
lazy_static! {
static ref REGEX: Regex = Regex::new(r"([A-Z,a-z]+)(\d+)").unwrap();
@ -62,9 +69,9 @@ pub fn string_well_to_pt(input: &str) -> Option<(u8, u8)> {
}
if let Some(c1) = REGEX.captures(input) {
if let (Some(row), Some(col)) = (letters_to_num(&c1[1]), c1[2].parse::<u8>().ok()) {
return Some((row, col))
return Some(Well { row, col });
} else {
return None
return None;
}
}
None

View File

@ -4,3 +4,6 @@ pub mod plate_instances;
pub mod transfer;
pub mod transfer_region;
pub mod util;
mod well;
pub use well::Well;

View File

@ -1,31 +1,32 @@
use serde::{Deserialize, Serialize};
use super::plate::Plate;
use crate::Well;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub struct CustomRegion {
src: Vec<(u8, u8)>,
dest: Vec<(u8, u8)>,
src: Vec<Well>,
dest: Vec<Well>,
}
impl CustomRegion {
pub fn new(src: Vec<(u8, u8)>, dest: Vec<(u8, u8)>) -> Self {
pub fn new(src: Vec<Well>, dest: Vec<Well>) -> Self {
CustomRegion { src, dest }
}
}
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum Region {
Rect((u8, u8), (u8, u8)),
Point((u8, u8)),
Rect(Well, Well),
Point(Well),
Custom(CustomRegion),
}
impl Default for Region {
fn default() -> Self {
Region::Point((1, 1))
Region::Point(Well { row: 1, col: 1 })
}
}
impl TryFrom<Region> for ((u8, u8), (u8, u8)) {
impl TryFrom<Region> for (Well, Well) {
type Error = &'static str;
fn try_from(region: Region) -> Result<Self, Self::Error> {
if let Region::Rect(c1, c2) = region {
@ -37,12 +38,10 @@ impl TryFrom<Region> for ((u8, u8), (u8, u8)) {
}
}
type Corner = (u8, u8);
type Rectangle = (Corner, Corner);
impl Region {
pub fn new_custom(transfers: &Vec<Rectangle>) -> Self {
let mut src_pts: Vec<(u8, u8)> = Vec::with_capacity(transfers.len());
let mut dest_pts: Vec<(u8, u8)> = Vec::with_capacity(transfers.len());
pub fn new_custom(transfers: &Vec<(Well, Well)>) -> Self {
let mut src_pts: Vec<Well> = Vec::with_capacity(transfers.len());
let mut dest_pts: Vec<Well> = Vec::with_capacity(transfers.len());
for transfer in transfers {
src_pts.push(transfer.0);
@ -80,10 +79,10 @@ impl Default for TransferRegion {
}
impl TransferRegion {
pub fn get_source_wells(&self) -> Vec<(u8, u8)> {
pub fn get_source_wells(&self) -> Vec<Well> {
match &self.source_region {
Region::Rect(c1, c2) => {
let mut wells = Vec::<(u8, u8)>::new();
let mut wells = Vec::<Well>::new();
let (ul, br) = standardize_rectangle(c1, c2);
let (interleave_i, interleave_j) = self.interleave_source;
// NOTE: This will panic if either is 0!
@ -93,12 +92,12 @@ impl TransferRegion {
let (interleave_i, interleave_j) =
(i8::max(interleave_i, 1), i8::max(interleave_j, 1));
for i in (ul.0..=br.0).step_by(i8::abs(interleave_i) as usize) {
for j in (ul.1..=br.1).step_by(i8::abs(interleave_j) as usize) {
for i in (ul.row..=br.row).step_by(i8::abs(interleave_i) as usize) {
for j in (ul.col..=br.col).step_by(i8::abs(interleave_j) as usize) {
// NOTE: It looks like we're ignoring negative interleaves,
// because it wouldn't make a difference here---the same
// wells will still be involved in the transfer.
wells.push((i, j))
wells.push(Well { row: i, col: j })
}
}
wells
@ -108,14 +107,14 @@ impl TransferRegion {
}
}
pub fn get_destination_wells(&self) -> Vec<(u8, u8)> {
pub fn get_destination_wells(&self) -> Vec<Well> {
match &self.source_region {
Region::Custom(c) => c.dest.clone(),
_ => {
let map = self.calculate_map();
let source_wells = self.get_source_wells();
let mut wells = Vec::<(u8, u8)>::new();
let mut wells = Vec::<Well>::new();
for well in source_wells {
if let Some(mut dest_wells) = map(well) {
@ -129,14 +128,14 @@ impl TransferRegion {
}
#[allow(clippy::type_complexity)] // Resolving gives inherent associated type error
pub fn calculate_map(&self) -> Box<dyn Fn((u8, u8)) -> Option<Vec<(u8, u8)>> + '_> {
pub fn calculate_map(&self) -> Box<dyn Fn(Well) -> Option<Vec<Well>> + '_> {
// By validating first, we have a stronger guarantee that
// this function will not panic. :)
// log::debug!("Validating: {:?}", self.validate());
if let Err(msg) = self.validate() {
eprintln!("{}", msg);
eprintln!("This transfer will be empty.");
return Box::new(|(_, _)| None);
return Box::new(|_| None);
}
// log::debug!("What is ild? {:?}", self);
@ -144,10 +143,10 @@ impl TransferRegion {
let il_dest = self.interleave_dest;
let il_source = self.interleave_source;
let source_corners: ((u8, u8), (u8, u8)) = match self.source_region {
Region::Point((x, y)) => ((x, y), (x, y)),
let source_corners: (Well, Well) = match self.source_region {
Region::Point(w) => (w, w),
Region::Rect(c1, c2) => (c1, c2),
Region::Custom(_) => ((0, 0), (0, 0)),
Region::Custom(_) => (Well { row: 0, col: 0 }, Well { row: 0, col: 0 }),
};
let (source_ul, _) = standardize_rectangle(&source_corners.0, &source_corners.1);
// This map is not necessarily injective or surjective,
@ -157,43 +156,44 @@ impl TransferRegion {
// Non-replicate transfers:
match &self.dest_region {
Region::Point((x, y)) => {
Box::new(move |(i, j)| {
if source_wells.contains(&(i, j)) {
Region::Point(Well { row: x, col: y }) => {
Box::new(move |Well { row: i, col: j }| {
if source_wells.contains(&Well { row: i, col: j }) {
// Validity here already checked by self.validate()
Some(vec![(
x + i
.checked_sub(source_ul.0)
Some(vec![Well {
row: x + i
.checked_sub(source_ul.row)
.expect("Point cannot have been less than UL")
.checked_div(il_source.0.unsigned_abs())
.expect("Source interleave cannot be 0")
.mul(il_dest.0.unsigned_abs()),
y + j
.checked_sub(source_ul.1)
col: y + j
.checked_sub(source_ul.col)
.expect("Point cannot have been less than UL")
.checked_div(il_source.1.unsigned_abs())
.expect("Source interleave cannot be 0")
.mul(il_dest.1.unsigned_abs()),
)])
}])
} else {
None
}
})
}
Region::Rect(c1, c2) => {
Box::new(move |(i, j)| {
if source_wells.contains(&(i, j)) {
Box::new(move |w| {
let Well { row: i, col: j } = w;
if source_wells.contains(&w) {
let possible_destination_wells = create_dense_rectangle(c1, c2);
let (d_ul, d_br) = standardize_rectangle(c1, c2);
let (s_ul, s_br) =
standardize_rectangle(&source_corners.0, &source_corners.1);
let s_dims = (
s_br.0.checked_sub(s_ul.0).unwrap() + 1,
s_br.1.checked_sub(s_ul.1).unwrap() + 1,
s_br.row.checked_sub(s_ul.row).unwrap() + 1,
s_br.col.checked_sub(s_ul.col).unwrap() + 1,
);
let d_dims = (
d_br.0.checked_sub(d_ul.0).unwrap() + 1,
d_br.1.checked_sub(d_ul.1).unwrap() + 1,
d_br.row.checked_sub(d_ul.row).unwrap() + 1,
d_br.col.checked_sub(d_ul.col).unwrap() + 1,
);
let number_used_src_wells = (
// Number of used source wells
@ -222,34 +222,34 @@ impl TransferRegion {
.unwrap() as u8,
);
let i = i
.saturating_sub(s_ul.0)
.saturating_sub(s_ul.row)
.saturating_div(il_source.0.unsigned_abs());
let j = j
.saturating_sub(s_ul.1)
.saturating_sub(s_ul.col)
.saturating_div(il_source.1.unsigned_abs());
Some(
possible_destination_wells
.into_iter()
.filter(|(x, _)| {
x.checked_sub(d_ul.0).unwrap()
.filter(|Well { row: x , ..}| {
x.checked_sub(d_ul.row).unwrap()
% (number_used_src_wells.0 * il_dest.0.unsigned_abs()) // Counter along x
== (il_dest.0.unsigned_abs() *i)
% (number_used_src_wells.0 * il_dest.0.unsigned_abs())
})
.filter(|(_, y)| {
y.checked_sub(d_ul.1).unwrap()
.filter(|Well { col: y, .. }| {
y.checked_sub(d_ul.col).unwrap()
% (number_used_src_wells.1 * il_dest.1.unsigned_abs()) // Counter along u
== (il_dest.1.unsigned_abs() *j)
% (number_used_src_wells.1 * il_dest.1.unsigned_abs())
})
.filter(|(x, y)| {
.filter(|Well { row: x, col: y }| {
// How many times have we replicated? < How many are we allowed
// to replicate?
x.checked_sub(d_ul.0).unwrap().div_euclid(
x.checked_sub(d_ul.row).unwrap().div_euclid(
number_used_src_wells.0 * il_dest.0.unsigned_abs(),
) < count.0
&& y.checked_sub(d_ul.1).unwrap().div_euclid(
&& y.checked_sub(d_ul.col).unwrap().div_euclid(
number_used_src_wells.1 * il_dest.1.unsigned_abs(),
) < count.1
})
@ -260,14 +260,14 @@ impl TransferRegion {
}
})
}
Region::Custom(c) => Box::new(move |(i, j)| {
Region::Custom(c) => Box::new(move |Well { row: i, col: j }| {
let src = c.src.clone();
let dest = c.dest.clone();
let points: Vec<(u8, u8)> = src
let points: Vec<Well> = src
.iter()
.enumerate()
.filter(|(_index, (x, y))| *x == i && *y == j)
.filter(|(_index, Well { row: x, col: y })| *x == i && *y == j)
.map(|(index, _)| dest[index])
.collect();
if points.is_empty() {
@ -296,15 +296,15 @@ impl TransferRegion {
// later
Region::Rect(s1, s2) => {
// Check if all source wells exist:
if s1.0 == 0 || s1.1 == 0 || s2.0 == 0 || s2.1 == 0 {
if s1.row == 0 || s1.col == 0 || s2.row == 0 || s2.col == 0 {
return Err("Source region is out-of-bounds! (Too small)");
}
// Sufficient to check if the corners are in-bounds
let source_max = self.source_plate.size();
if s1.0 > source_max.0 || s2.0 > source_max.0 {
if s1.row > source_max.0 || s2.row > source_max.0 {
return Err("Source region is out-of-bounds! (Too tall)");
}
if s1.1 > source_max.1 || s2.1 > source_max.1 {
if s1.col > source_max.1 || s2.col > source_max.1 {
// log::debug!("s1.1: {}, max.1: {}", s1.1, source_max.1);
return Err("Source region is out-of-bounds! (Too wide)");
}
@ -325,28 +325,34 @@ impl TransferRegion {
}
}
fn create_dense_rectangle(c1: &(u8, u8), c2: &(u8, u8)) -> Vec<(u8, u8)> {
fn create_dense_rectangle(c1: &Well, c2: &Well) -> Vec<Well> {
// Creates a vector of every point between two corners
let (c1, c2) = standardize_rectangle(c1, c2);
let mut points = Vec::<(u8, u8)>::new();
for i in c1.0..=c2.0 {
for j in c1.1..=c2.1 {
points.push((i, j));
let mut points = Vec::<Well>::new();
for i in c1.row..=c2.row {
for j in c1.col..=c2.col {
points.push(Well { row: i, col: j });
}
}
points
}
fn standardize_rectangle(c1: &(u8, u8), c2: &(u8, u8)) -> ((u8, u8), (u8, u8)) {
let upper_left_i = u8::min(c1.0, c2.0);
let upper_left_j = u8::min(c1.1, c2.1);
let bottom_right_i = u8::max(c1.0, c2.0);
let bottom_right_j = u8::max(c1.1, c2.1);
fn standardize_rectangle(c1: &Well, c2: &Well) -> (Well, Well) {
let upper_left_i = u8::min(c1.row, c2.row);
let upper_left_j = u8::min(c1.col, c2.col);
let bottom_right_i = u8::max(c1.row, c2.row);
let bottom_right_j = u8::max(c1.col, c2.col);
(
(upper_left_i, upper_left_j),
(bottom_right_i, bottom_right_j),
Well {
row: upper_left_i,
col: upper_left_j,
},
Well {
row: bottom_right_i,
col: bottom_right_j,
},
)
}
@ -363,7 +369,7 @@ impl fmt::Display for TransferRegion {
let mut source_string = String::new();
for i in 1..=source_dims.0 {
for j in 1..=source_dims.1 {
if source_wells.contains(&(i, j)) {
if source_wells.contains(&Well { row: i, col: j }) {
source_string.push('x')
} else {
source_string.push('.')
@ -379,7 +385,7 @@ impl fmt::Display for TransferRegion {
let mut dest_string = String::new();
for i in 1..=dest_dims.0 {
for j in 1..=dest_dims.1 {
if dest_wells.contains(&(i, j)) {
if dest_wells.contains(&Well { row: i, col: j }) {
dest_string.push('x')
} else {
dest_string.push('.')

View File

@ -0,0 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Debug, Hash)]
pub struct Well {
/// Top to bottom assuming landscape, i.e. lettered
pub row: u8,
/// Left to right assuming landscape, i.e. numbered
pub col: u8,
}

View File

@ -12,6 +12,7 @@ use crate::components::states::MainState;
use plate_tool_lib::transfer::Transfer;
use plate_tool_lib::transfer_region::{Region, TransferRegion};
use plate_tool_lib::Well;
use plate_tool_lib::csv::{auto, string_well_to_pt, TransferRecord};
@ -238,7 +239,7 @@ pub fn import_transfer_csv_submit_callback(
let from_dest = from_dest.value();
let to_dest = to_dest.value();
let records: Vec<((u8, u8), (u8, u8))> = records
let records: Vec<(Well, Well)> = records
.iter()
.filter(|record| record.source_plate == from_source)
.filter(|record| record.destination_plate == from_dest)

View File

@ -8,6 +8,7 @@ use crate::components::states::{CurrentTransfer, MainState};
use plate_tool_lib::plate::PlateType;
use plate_tool_lib::transfer::Transfer;
use plate_tool_lib::transfer_region::Region;
use plate_tool_lib::Well;
// Color Palette for the Source Plates, can be changed here
use crate::components::plates::util::Palettes;
@ -32,24 +33,24 @@ pub fn Plate(props: &PlateProps) -> Html {
PlateType::Destination => ct_state.transfer.transfer_region.dest_region.clone(),
};
let (pt1, pt2) = match region {
Region::Point((x, y)) => ((x, y), (x, y)),
Region::Rect(c1, c2) => (c1, c2),
Region::Point(Well {row: x, col: y }) => ((x, y), (x, y)),
Region::Rect(c1, c2) => ((c1.row, c1.col ), (c2.row, c2.col)),
Region::Custom(_) => ((0, 0), (0, 0)),
};
m_start_handle.set(Some(pt1));
m_end_handle.set(Some(pt2));
}
let tooltip_map: HashMap<(u8, u8), Vec<&Transfer>>;
let volume_map: HashMap<(u8, u8), f32>;
let tooltip_map: HashMap<Well, Vec<&Transfer>>;
let volume_map: HashMap<Well, f32>;
let volume_max: f32;
{
let transfers = main_state.transfers.iter().filter(|t| match props.ptype {
PlateType::Source => t.source_id == props.source_plate.get_uuid(),
PlateType::Destination => t.dest_id == props.destination_plate.get_uuid(),
});
let mut tooltip_map_temp: HashMap<(u8, u8), Vec<&Transfer>> = HashMap::new();
let mut volume_map_temp: HashMap<(u8,u8), f32> = HashMap::new();
let mut tooltip_map_temp: HashMap<Well, Vec<&Transfer>> = HashMap::new();
let mut volume_map_temp: HashMap<Well, f32> = HashMap::new();
let mut volume_max_temp: f32 = f32::NEG_INFINITY;
for transfer in transfers {
let wells = match props.ptype {
@ -135,22 +136,22 @@ pub fn Plate(props: &PlateProps) -> Html {
.map(|j| {
let color = {
if !main_state.preferences.volume_heatmap {
tooltip_map.get(&(i,j))
tooltip_map.get(&Well { row: i, col: j })
.and_then(|t| t.last())
.map(|t| PALETTE.get_ordered(t.get_uuid(), &ordered_ids))
} else {
volume_map.get(&(i,j))
volume_map.get(&Well { row: i, col: j })
.map(|t| PALETTE.get_linear(*t as f64, volume_max as f64))
}
};
let title = {
let mut out = String::new();
let used_by = tooltip_map.get(&(i,j)).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
let used_by = tooltip_map.get(&Well { row: i, col: j }).map(|transfers| format!("Used by: {}", transfers.iter().map(|t| t.name.clone())
.collect::<Vec<_>>().join(", ")));
if let Some(val) = used_by {
out += &val;
}
let volume_sum = volume_map.get(&(i,j))
let volume_sum = volume_map.get(&Well { row: i, col: j })
.map(|t| format!("Volume: {}", t));
if let Some(val) = volume_sum {
if !out.is_empty() { out += "\n" }
@ -162,7 +163,7 @@ pub fn Plate(props: &PlateProps) -> Html {
<PlateCell i={i} j={j}
selected={in_rect(*m_start_handle.clone(), *m_end_handle.clone(), (i,j))}
mouse={mouse_callback.clone()}
in_transfer={wells.contains(&(i,j)) && main_state.preferences.in_transfer_hashes}
in_transfer={wells.contains(&Well { row: i, col: j }) && main_state.preferences.in_transfer_hashes}
color={ color }
cell_height={props.cell_height}
title={title}

View File

@ -41,7 +41,7 @@ pub fn mouseup_callback(
m_stat_handle.set(false);
if let Some(ul) = *m_start_handle {
if let Some(br) = *m_end_handle {
if let Ok(rd) = RegionDisplay::try_from((ul.0, ul.1, br.0, br.1)) {
if let Ok(rd) = RegionDisplay::try_from((ul.1, ul.0, br.1, br.0)) {
ct_dispatch.reduce_mut(|state| {
match ptype {
PlateType::Source => state.transfer.transfer_region.source_region = Region::from(&rd),

View File

@ -1,6 +1,7 @@
#![allow(non_snake_case)]
use lazy_static::lazy_static;
use plate_tool_lib::Well;
use regex::Regex;
use serde::{Deserialize, Serialize};
use yew::prelude::*;
@ -233,10 +234,10 @@ impl TryFrom<&str> for RegionDisplay {
impl From<&Region> for RegionDisplay {
fn from(value: &Region) -> Self {
match *value {
Region::Point((col, row)) => {
Region::Point(Well { row, col }) => {
RegionDisplay::try_from((col, row, col, row)).ok().unwrap()
}
Region::Rect(c1, c2) => RegionDisplay::try_from((c1.0, c1.1, c2.0, c2.1))
Region::Rect(c1, c2) => RegionDisplay::try_from((c1.row, c1.col, c2.row, c2.col))
.ok()
.unwrap(),
Region::Custom(_) => RegionDisplay {
@ -252,11 +253,11 @@ impl From<&Region> for RegionDisplay {
impl From<&RegionDisplay> for Region {
fn from(value: &RegionDisplay) -> Self {
if value.col_start == value.col_end && value.row_start == value.row_end {
Region::Point((value.col_start, value.row_start))
Region::Point(Well { row: value.row_start, col: value.col_start })
} else {
Region::Rect(
(value.col_start, value.row_start),
(value.col_end, value.row_end),
Well { row: value.row_start, col: value.col_start },
Well { row: value.row_end, col: value.col_end },
)
}
}

View File

@ -25,9 +25,9 @@ pub fn plate_test() {
let transfer = transfer_region::TransferRegion {
source_plate: source,
source_region: transfer_region::Region::Rect((1, 1), (2, 2)),
source_region: transfer_region::Region::Rect(Well { row: 1, col: 1 }, Well { row: 2, col: 2 }),
dest_plate: destination,
dest_region: transfer_region::Region::Rect((2, 2), (11, 11)),
dest_region: transfer_region::Region::Rect(Well { row: 2, col: 2 }, Well { row: 11, col: 11 }),
interleave_source: (1, 1),
interleave_dest: (3, 3),
};