Compare commits
4 Commits
51093f5efd
...
83d74cfc6f
Author | SHA1 | Date |
---|---|---|
Emilia Allison | 83d74cfc6f | |
Emilia Allison | 9aad876a31 | |
Emilia Allison | b25d1eb0c6 | |
Emilia Allison | c6d3b86237 |
|
@ -167,9 +167,7 @@ fn get_transfer_for_pair(
|
||||||
.filter(|x| x.source_plate == source_name && x.destination_plate == destination_name)
|
.filter(|x| x.source_plate == source_name && x.destination_plate == destination_name)
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
if filtered_records.peek().is_none() {
|
filtered_records.peek()?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut source_wells: HashSet<Well> = HashSet::new();
|
let mut source_wells: HashSet<Well> = HashSet::new();
|
||||||
let mut destination_wells: HashSet<Well> = HashSet::new();
|
let mut destination_wells: HashSet<Well> = HashSet::new();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
pub fn mangle_headers(data: &str) -> String {
|
pub fn mangle_headers(data: &str) -> String {
|
||||||
let (header, rows) = data.split_at(data.find('\n').unwrap());
|
let (header, rows) = data.split_at(data.find('\n').unwrap());
|
||||||
let fields = header.trim().split(",");
|
let fields = header.trim().split(',');
|
||||||
let mut modified_headers: Vec<String> = Vec::new();
|
let mut modified_headers: Vec<String> = Vec::new();
|
||||||
for field in fields {
|
for field in fields {
|
||||||
if let Some(f) = detect_field(field) {
|
if let Some(f) = detect_field(field) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{plate::PlateFormat, transfer::Transfer, util::num_to_letters};
|
use crate::{plate::PlateFormat, util::num_to_letters};
|
||||||
|
|
||||||
/// Represents a single line of a CSV picklist.
|
/// Represents a single line of a CSV picklist.
|
||||||
/// In practice, this is generated from the deserialize intermediate.
|
/// In practice, this is generated from the deserialize intermediate.
|
||||||
|
|
|
@ -399,134 +399,130 @@ impl fmt::Display for TransferRegion {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use wasm_bindgen_test::*;
|
use crate::plate::*;
|
||||||
|
use crate::transfer_region::*;
|
||||||
use crate::data::plate::*;
|
|
||||||
use crate::data::transfer_region::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn test_simple_transfer() {
|
fn test_simple_transfer() {
|
||||||
let source = Plate::new(PlateType::Source, PlateFormat::W96);
|
let source = Plate::new(PlateType::Source, PlateFormat::W96);
|
||||||
let destination = Plate::new(PlateType::Destination, PlateFormat::W384);
|
let destination = Plate::new(PlateType::Destination, PlateFormat::W384);
|
||||||
|
|
||||||
let transfer1 = TransferRegion {
|
let transfer1 = TransferRegion {
|
||||||
source_plate: source,
|
source_plate: source,
|
||||||
source_region: Region::Rect((1, 1), (3, 3)),
|
source_region: Region::Rect(Well{ row: 1, col: 1}, Well { row: 1, col: 1 }),
|
||||||
dest_plate: destination,
|
dest_plate: destination,
|
||||||
dest_region: Region::Point((3, 3)),
|
dest_region: Region::Point(Well {row: 3, col: 3}),
|
||||||
interleave_source: (1, 1),
|
interleave_source: (1, 1),
|
||||||
interleave_dest: (1, 1),
|
interleave_dest: (1, 1),
|
||||||
};
|
};
|
||||||
let transfer1_map = transfer1.calculate_map();
|
let transfer1_map = transfer1.calculate_map();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((1, 1)),
|
transfer1_map(Well {row: 1, col: 1}),
|
||||||
Some(vec! {(3,3)}),
|
Some(vec! {Well {row: 3, col: 3}}),
|
||||||
"Failed basic shift transfer 1"
|
"Failed basic shift transfer 1"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((1, 2)),
|
transfer1_map(Well{ row: 1, col: 2}),
|
||||||
Some(vec! {(3,4)}),
|
Some(vec! {Well{ row: 3, col: 4}}),
|
||||||
"Failed basic shift transfer 2"
|
"Failed basic shift transfer 2"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((2, 2)),
|
transfer1_map(Well{ row: 2, col: 2}),
|
||||||
Some(vec! {(4,4)}),
|
Some(vec! {Well{ row: 4, col: 4}}),
|
||||||
"Failed basic shift transfer 3"
|
"Failed basic shift transfer 3"
|
||||||
);
|
);
|
||||||
|
|
||||||
let transfer2 = TransferRegion {
|
let transfer2 = TransferRegion {
|
||||||
source_plate: source,
|
source_plate: source,
|
||||||
source_region: Region::Rect((1, 1), (3, 3)),
|
source_region: Region::Rect(Well{ row: 1, col: 1}, Well{ row: 3, col: 3}),
|
||||||
dest_plate: destination,
|
dest_plate: destination,
|
||||||
dest_region: Region::Point((3, 3)),
|
dest_region: Region::Point(Well{ row: 3, col: 3}),
|
||||||
interleave_source: (2, 2),
|
interleave_source: (2, 2),
|
||||||
interleave_dest: (1, 1),
|
interleave_dest: (1, 1),
|
||||||
};
|
};
|
||||||
let transfer2_map = transfer2.calculate_map();
|
let transfer2_map = transfer2.calculate_map();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_map((1, 1)),
|
transfer2_map(Well{ row: 1, col: 1}),
|
||||||
Some(vec! {(3,3)}),
|
Some(vec! {Well{ row: 3, col: 3}}),
|
||||||
"Failed source interleave, type simple 1"
|
"Failed source interleave, type simple 1"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_map((1, 2)),
|
transfer2_map(Well{ row: 1, col: 2}),
|
||||||
None,
|
None,
|
||||||
"Failed source interleave, type simple 2"
|
"Failed source interleave, type simple 2"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_map((2, 2)),
|
transfer2_map(Well{ row: 2, col: 2}),
|
||||||
None,
|
None,
|
||||||
"Failed source interleave, type simple 3"
|
"Failed source interleave, type simple 3"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_map((3, 3)),
|
transfer2_map(Well{ row: 3, col: 3}),
|
||||||
Some(vec! {(4,4)}),
|
Some(vec! {Well{ row: 4, col: 4}}),
|
||||||
"Failed source interleave, type simple 4"
|
"Failed source interleave, type simple 4"
|
||||||
);
|
);
|
||||||
|
|
||||||
let transfer3 = TransferRegion {
|
let transfer3 = TransferRegion {
|
||||||
source_plate: source,
|
source_plate: source,
|
||||||
source_region: Region::Rect((1, 1), (3, 3)),
|
source_region: Region::Rect(Well{ row: 1, col: 1}, Well{ row: 3, col: 3}),
|
||||||
dest_plate: destination,
|
dest_plate: destination,
|
||||||
dest_region: Region::Point((3, 3)),
|
dest_region: Region::Point(Well{ row: 3, col: 3}),
|
||||||
interleave_source: (1, 1),
|
interleave_source: (1, 1),
|
||||||
interleave_dest: (2, 3),
|
interleave_dest: (2, 3),
|
||||||
};
|
};
|
||||||
let transfer3_map = transfer3.calculate_map();
|
let transfer3_map = transfer3.calculate_map();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer3_map((1, 1)),
|
transfer3_map(Well{ row: 1, col: 1}),
|
||||||
Some(vec! {(3,3)}),
|
Some(vec! {Well{ row: 3, col: 3}}),
|
||||||
"Failed destination interleave, type simple 1"
|
"Failed destination interleave, type simple 1"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer3_map((2, 1)),
|
transfer3_map(Well{ row: 2, col: 1}),
|
||||||
Some(vec! {(5,3)}),
|
Some(vec! {Well{ row: 5, col: 3}}),
|
||||||
"Failed destination interleave, type simple 2"
|
"Failed destination interleave, type simple 2"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer3_map((1, 2)),
|
transfer3_map(Well{ row: 1, col: 2}),
|
||||||
Some(vec! {(3,6)}),
|
Some(vec! {Well{ row: 3, col: 6}}),
|
||||||
"Failed destination interleave, type simple 3"
|
"Failed destination interleave, type simple 3"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer3_map((2, 2)),
|
transfer3_map(Well{ row: 2, col: 2}),
|
||||||
Some(vec! {(5,6)}),
|
Some(vec! {Well{ row: 5, col: 6}}),
|
||||||
"Failed destination interleave, type simple 4"
|
"Failed destination interleave, type simple 4"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn test_replicate_transfer() {
|
fn test_replicate_transfer() {
|
||||||
let source = Plate::new(PlateType::Source, PlateFormat::W96);
|
let source = Plate::new(PlateType::Source, PlateFormat::W96);
|
||||||
let destination = Plate::new(PlateType::Destination, PlateFormat::W384);
|
let destination = Plate::new(PlateType::Destination, PlateFormat::W384);
|
||||||
|
|
||||||
let transfer1 = TransferRegion {
|
let transfer1 = TransferRegion {
|
||||||
source_plate: source,
|
source_plate: source,
|
||||||
source_region: Region::Rect((1, 1), (2, 2)),
|
source_region: Region::Rect(Well{ row: 1, col: 1}, Well{ row: 2, col: 2}),
|
||||||
dest_plate: destination,
|
dest_plate: destination,
|
||||||
dest_region: Region::Rect((2, 2), (11, 11)),
|
dest_region: Region::Rect(Well{ row: 2, col: 2}, Well{row:11, col:11}),
|
||||||
interleave_source: (1, 1),
|
interleave_source: (1, 1),
|
||||||
interleave_dest: (3, 3),
|
interleave_dest: (3, 3),
|
||||||
};
|
};
|
||||||
let transfer1_map = transfer1.calculate_map();
|
let transfer1_map = transfer1.calculate_map();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((1, 1)),
|
transfer1_map(Well{ row: 1, col: 1}),
|
||||||
Some(vec! {(2, 2), (2, 8), (8, 2), (8, 8)}),
|
Some(vec! {Well{ row: 2, col: 2}, Well{ row: 2, col: 8}, Well{ row: 8, col: 2}, Well{ row: 8, col: 8}}),
|
||||||
"Failed type replicate 1"
|
"Failed type replicate 1"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((2, 1)),
|
transfer1_map(Well{ row: 2, col: 1}),
|
||||||
Some(vec! {(5, 2), (5, 8), (11, 2), (11, 8)}),
|
Some(vec! {Well{ row: 5, col: 2}, Well{ row: 5, col: 8}, Well{ row: 11, col: 2}, Well{ row: 11, col: 8}}),
|
||||||
"Failed type replicate 1"
|
"Failed type replicate 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
let transfer2 = TransferRegion {
|
let transfer2 = TransferRegion {
|
||||||
source_plate: Plate::new(PlateType::Source, PlateFormat::W384),
|
source_plate: Plate::new(PlateType::Source, PlateFormat::W384),
|
||||||
dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384),
|
dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384),
|
||||||
source_region: Region::Rect((1, 1), (2, 3)),
|
source_region: Region::Rect(Well{ row: 1, col: 1}, Well{ row: 2, col: 3}),
|
||||||
dest_region: Region::Rect((2, 2), (11, 16)),
|
dest_region: Region::Rect(Well{ row: 2, col: 2}, Well{ row: 11, col: 16}),
|
||||||
interleave_source: (1, 1),
|
interleave_source: (1, 1),
|
||||||
interleave_dest: (2, 2),
|
interleave_dest: (2, 2),
|
||||||
};
|
};
|
||||||
|
@ -534,71 +530,69 @@ mod tests {
|
||||||
let transfer2_dest = transfer2.get_destination_wells();
|
let transfer2_dest = transfer2.get_destination_wells();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_source,
|
transfer2_source,
|
||||||
vec![(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)],
|
vec![Well{ row: 1, col: 1}, Well{ row: 1, col: 2}, Well{ row: 1, col: 3}, Well{ row: 2, col: 1}, Well{ row: 2, col: 2}, Well{ row: 2, col: 3}],
|
||||||
"Failed type replicate 2 source"
|
"Failed type replicate 2 source"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer2_dest,
|
transfer2_dest,
|
||||||
vec![
|
vec![
|
||||||
(2, 2),
|
Well{ row: 2, col: 2},
|
||||||
(2, 8),
|
Well{ row: 2, col: 8},
|
||||||
(6, 2),
|
Well{ row: 6, col: 2},
|
||||||
(6, 8),
|
Well{ row: 6, col: 8},
|
||||||
(2, 4),
|
Well{ row: 2, col: 4},
|
||||||
(2, 10),
|
Well{ row: 2, col: 10},
|
||||||
(6, 4),
|
Well{ row: 6, col: 4},
|
||||||
(6, 10),
|
Well{ row: 6, col: 10},
|
||||||
(2, 6),
|
Well{ row: 2, col: 6},
|
||||||
(2, 12),
|
Well{ row: 2, col: 12},
|
||||||
(6, 6),
|
Well{ row: 6, col: 6},
|
||||||
(6, 12),
|
Well{ row: 6, col: 12},
|
||||||
(4, 2),
|
Well{ row: 4, col: 2},
|
||||||
(4, 8),
|
Well{ row: 4, col: 8},
|
||||||
(8, 2),
|
Well{ row: 8, col: 2},
|
||||||
(8, 8),
|
Well{ row: 8, col: 8},
|
||||||
(4, 4),
|
Well{ row: 4, col: 4},
|
||||||
(4, 10),
|
Well{ row: 4, col: 10},
|
||||||
(8, 4),
|
Well{ row: 8, col: 4},
|
||||||
(8, 10),
|
Well{ row: 8, col: 10},
|
||||||
(4, 6),
|
Well{ row: 4, col: 6},
|
||||||
(4, 12),
|
Well{ row: 4, col: 12},
|
||||||
(8, 6),
|
Well{ row: 8, col: 6},
|
||||||
(8, 12)
|
Well{ row: 8, col: 12}
|
||||||
],
|
],
|
||||||
"Failed type replicate 2 destination"
|
"Failed type replicate 2 destination"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn test_pooling_transfer() {
|
fn test_pooling_transfer() {
|
||||||
|
use std::collections::HashSet;
|
||||||
let transfer1 = TransferRegion {
|
let transfer1 = TransferRegion {
|
||||||
source_plate: Plate::new(PlateType::Source, PlateFormat::W384),
|
source_plate: Plate::new(PlateType::Source, PlateFormat::W384),
|
||||||
dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384),
|
dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384),
|
||||||
source_region: Region::Rect((1, 4), (3, 7)),
|
source_region: Region::Rect(Well{ row: 1, col: 4}, Well{ row: 3, col: 7}),
|
||||||
dest_region: Region::Point((1, 9)),
|
dest_region: Region::Point(Well{ row: 1, col: 9}),
|
||||||
interleave_source: (1, 1),
|
interleave_source: (1, 1),
|
||||||
interleave_dest: (0, 2),
|
interleave_dest: (0, 2),
|
||||||
};
|
};
|
||||||
//let transfer1_source = transfer1.get_source_wells();
|
//let transfer1_source = transfer1.get_source_wells();
|
||||||
let mut transfer1_dest = transfer1.get_destination_wells();
|
let transfer1_dest: HashSet<Well> = transfer1.get_destination_wells().into_iter().collect();
|
||||||
transfer1_dest.sort();
|
|
||||||
transfer1_dest.dedup(); // Makes our check easier, otherwise we have repeated wells
|
|
||||||
let transfer1_map = transfer1.calculate_map();
|
let transfer1_map = transfer1.calculate_map();
|
||||||
// Skipping source check---it's just 12 wells.
|
// Skipping source check---it's just 12 wells.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_dest,
|
transfer1_dest,
|
||||||
vec![(1, 9), (1, 11), (1, 13), (1, 15)],
|
vec![Well{ row: 1, col: 9}, Well{ row: 1, col: 11}, Well{ row: 1, col: 13}, Well{ row: 1, col: 15}].into_iter().collect(),
|
||||||
"Failed type pool 1 dest"
|
"Failed type pool 1 dest"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((2, 6)),
|
transfer1_map(Well{ row: 2, col: 6}),
|
||||||
Some(vec![(1, 13)]),
|
Some(vec![Well{ row: 1, col: 13}]),
|
||||||
"Failed type pool 1 map 1"
|
"Failed type pool 1 map 1"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
transfer1_map((3, 7)),
|
transfer1_map(Well{ row: 3, col: 7}),
|
||||||
Some(vec![(1, 15)]),
|
Some(vec![Well{ row: 1, col: 15}]),
|
||||||
"Failed type pool 1 map 2"
|
"Failed type pool 1 map 2"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,11 +296,11 @@ fn auto_callback(
|
||||||
Closure::<dyn FnMut(_)>::new(move |_| {
|
Closure::<dyn FnMut(_)>::new(move |_| {
|
||||||
let res = auto(&records);
|
let res = auto(&records);
|
||||||
main_dispatch.reduce_mut(|state| {
|
main_dispatch.reduce_mut(|state| {
|
||||||
state.source_plates.extend(res.sources.into_iter());
|
state.source_plates.extend(res.sources);
|
||||||
state
|
state
|
||||||
.destination_plates
|
.destination_plates
|
||||||
.extend(res.destinations.into_iter());
|
.extend(res.destinations);
|
||||||
state.transfers.extend(res.transfers.into_iter());
|
state.transfers.extend(res.transfers);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@ use crate::components::states::MainState;
|
||||||
|
|
||||||
use super::create_close_button;
|
use super::create_close_button;
|
||||||
|
|
||||||
type NoParamsCallback = Box<dyn Fn(())>;
|
|
||||||
|
|
||||||
pub fn input_json_input_callback(
|
pub fn input_json_input_callback(
|
||||||
main_dispatch: Dispatch<MainState>,
|
main_dispatch: Dispatch<MainState>,
|
||||||
modal: HtmlDialogElement,
|
modal: HtmlDialogElement,
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use js_sys::Function;
|
|
||||||
use wasm_bindgen::{prelude::*, JsCast};
|
use wasm_bindgen::{prelude::*, JsCast};
|
||||||
use web_sys::{
|
use web_sys::{
|
||||||
FileReader, HtmlButtonElement, HtmlDialogElement, HtmlElement, HtmlFormElement,
|
HtmlDialogElement, HtmlFormElement, HtmlOptionElement, HtmlSelectElement,
|
||||||
HtmlInputElement, HtmlOptionElement, HtmlSelectElement,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
|
@ -14,8 +13,6 @@ use crate::components::states::{CsvExportType, MainState};
|
||||||
|
|
||||||
use super::create_close_button;
|
use super::create_close_button;
|
||||||
|
|
||||||
type NoParamsCallback = Box<dyn Fn(())>;
|
|
||||||
|
|
||||||
pub fn toggle_in_transfer_hashes_callback(
|
pub fn toggle_in_transfer_hashes_callback(
|
||||||
main_dispatch: Dispatch<MainState>,
|
main_dispatch: Dispatch<MainState>,
|
||||||
) -> Callback<web_sys::MouseEvent> {
|
) -> Callback<web_sys::MouseEvent> {
|
||||||
|
|
|
@ -4,8 +4,6 @@ use wasm_bindgen::{prelude::*, JsCast};
|
||||||
use web_sys::HtmlElement;
|
use web_sys::HtmlElement;
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
|
|
||||||
type NoParamsCallback = Box<dyn Fn(())>;
|
|
||||||
|
|
||||||
pub fn create_close_button(close: &Closure<dyn FnMut(Event)>) -> HtmlElement {
|
pub fn create_close_button(close: &Closure<dyn FnMut(Event)>) -> HtmlElement {
|
||||||
let document = web_sys::window().unwrap().document().unwrap();
|
let document = web_sys::window().unwrap().document().unwrap();
|
||||||
let close_button = document
|
let close_button = document
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use plate_tool_lib::{plate::PlateType, plate_instances::PlateInstance};
|
use plate_tool_lib::{plate::PlateType};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use wasm_bindgen::{prelude::*, JsCast};
|
use wasm_bindgen::{prelude::*, JsCast};
|
||||||
use web_sys::{
|
use web_sys::{
|
||||||
HtmlDialogElement, HtmlElement, HtmlFormElement, HtmlInputElement, HtmlOptionElement,
|
HtmlDialogElement, HtmlElement, HtmlOptionElement,
|
||||||
HtmlSelectElement,
|
HtmlSelectElement,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ fn find_plate_type(main_dispatch: Dispatch<MainState>, id: Uuid) -> Option<Plate
|
||||||
.iter()
|
.iter()
|
||||||
.any(|x| x.get_uuid() == id)
|
.any(|x| x.get_uuid() == id)
|
||||||
{
|
{
|
||||||
return Some(PlateType::Source);
|
Some(PlateType::Source)
|
||||||
} else if main_dispatch
|
} else if main_dispatch
|
||||||
.get()
|
.get()
|
||||||
.destination_plates
|
.destination_plates
|
||||||
|
|
|
@ -17,7 +17,9 @@ pub struct NewPlateDialogProps {
|
||||||
pub enum NewPlateDialogType {
|
pub enum NewPlateDialogType {
|
||||||
SourceOnly,
|
SourceOnly,
|
||||||
DestinationOnly,
|
DestinationOnly,
|
||||||
Both,
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
Both, // Retained old functionality
|
||||||
}
|
}
|
||||||
|
|
||||||
#[function_component]
|
#[function_component]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ops::Deref;
|
|
||||||
use plate_tool_lib::transfer_region::TransferRegion;
|
|
||||||
use plate_tool_lib::transfer_volume::TransferVolume;
|
use plate_tool_lib::transfer_volume::TransferVolume;
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
@ -281,7 +281,7 @@ fn count_plate_usage(transfer: &Transfer, well: &Well) -> Option<u32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = transfer.transfer_region.calculate_map();
|
let map = transfer.transfer_region.calculate_map();
|
||||||
map(*well).and_then(|list| Some(list.len() as u32))
|
map(*well).map(|list| list.len() as u32)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -26,6 +26,7 @@ impl ColorPalette {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)] // Preserve old implementation for reference
|
||||||
fn get_u8(&self, t: u8) -> [f64; 3] {
|
fn get_u8(&self, t: u8) -> [f64; 3] {
|
||||||
assert!(t > 0, "t must be greater than zero!");
|
assert!(t > 0, "t must be greater than zero!");
|
||||||
self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
|
self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
use plate_tool_lib::plate::PlateFormat;
|
use plate_tool_lib::plate::PlateFormat;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
use web_sys::{HtmlDialogElement, HtmlInputElement};
|
use web_sys::{HtmlDialogElement};
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
|
||||||
use crate::components::callbacks::{main_window_callbacks, tree_callbacks};
|
use crate::components::callbacks::{tree_callbacks};
|
||||||
use crate::components::new_plate_dialog::NewPlateDialogType;
|
use crate::components::new_plate_dialog::NewPlateDialogType;
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
use crate::components::states::{CurrentTransfer, MainState};
|
||||||
|
|
||||||
|
@ -164,16 +164,14 @@ fn PlateInfoModal(props: &PlateInfoModalProps) -> Html {
|
||||||
None => "Not Found".to_string(),
|
None => "Not Found".to_string(),
|
||||||
};
|
};
|
||||||
let plate_format = plate.map(|p| p.plate.plate_format);
|
let plate_format = plate.map(|p| p.plate.plate_format);
|
||||||
let plate_formats = vec![
|
let plate_formats = [PlateFormat::W6,
|
||||||
PlateFormat::W6,
|
|
||||||
PlateFormat::W12,
|
PlateFormat::W12,
|
||||||
PlateFormat::W24,
|
PlateFormat::W24,
|
||||||
PlateFormat::W48,
|
PlateFormat::W48,
|
||||||
PlateFormat::W96,
|
PlateFormat::W96,
|
||||||
PlateFormat::W384,
|
PlateFormat::W384,
|
||||||
PlateFormat::W1536,
|
PlateFormat::W1536,
|
||||||
PlateFormat::W3456,
|
PlateFormat::W3456];
|
||||||
];
|
|
||||||
let plate_format_options = plate_formats.iter().map(|v| {
|
let plate_format_options = plate_formats.iter().map(|v| {
|
||||||
let selected = Some(v) == plate_format.as_ref();
|
let selected = Some(v) == plate_format.as_ref();
|
||||||
html! {
|
html! {
|
||||||
|
|
Loading…
Reference in New Issue