Example #1
0
func makeTipLibrary() map[string]*wtype.LHTipbox {
	tips := make(map[string]*wtype.LHTipbox)

	// create a well representation of the tip holder... sometimes needed
	// heh, should have kept LHTipholder!
	w := wtype.NewLHWell("Cybio250Tipbox", "", "A1", "ul", 250.0, 10.0, 1, 0, 7.3, 7.3, 51.2, 0.0, "mm")
	w.Extra["InnerL"] = 5.6
	w.Extra["InnerW"] = 5.6
	tip := wtype.NewLHTip("cybio", "CyBio250", 10.0, 250.0, "ul")
	tb := wtype.NewLHTipbox(8, 12, 60.13, "CyBio", "Tipbox", tip, w, 9.0, 9.0, 0.0, 0.0, 0.0)
	tips[tip.Type] = tb
	tips[tb.Type] = tb

	w = wtype.NewLHWell("Cybio50Tipbox", "", "A1", "ul", 50.0, 0.5, 1, 0, 7.3, 7.3, 51.2, 0.0, "mm")
	w.Extra["InnerL"] = 5.6
	w.Extra["InnerW"] = 5.6

	tip = wtype.NewLHTip("cybio", "CyBio50", 0.5, 50.0, "ul")
	tb = wtype.NewLHTipbox(8, 12, 60.13, "CyBio", "Tipbox", tip, w, 9.0, 9.0, 0.0, 0.0, 0.0)
	tips[tip.Type] = tb
	tips[tb.Type] = tb

	// these details are incorrect and need fixing
	w = wtype.NewLHWell("Cybio1000Tipbox", "", "A1", "ul", 1000.0, 50.0, 1, 0, 7.3, 7.3, 51.2, 0.0, "mm")
	w.Extra["InnerL"] = 5.6
	w.Extra["InnerW"] = 5.6
	tip = wtype.NewLHTip("cybio", "CyBio1000", 100.0, 1000.0, "ul")
	tb = wtype.NewLHTipbox(8, 12, 60.13, "CyBio", "Tipbox", tip, w, 9.0, 9.0, 0.0, 0.0, 0.0)
	tips[tip.Type] = tb
	tips[tb.Type] = tb

	w = wtype.NewLHWell("Gilson200Tipbox", "", "A1", "ul", 200.0, 10.0, 1, 0, 7.3, 7.3, 51.2, 0.0, "mm")
	w.Extra["InnerL"] = 5.6
	w.Extra["InnerW"] = 5.6
	w.Extra["Tipeffectiveheight"] = 44.7
	tip = wtype.NewLHTip("gilson", "Gilson200", 10.0, 200.0, "ul")
	tb = wtype.NewLHTipbox(8, 12, 60.13, "Gilson", "DF200 Tip Rack (PIPETMAX 8x200)", tip, w, 9.0, 9.0, 0.0, 0.0, 24.78)
	tips[tip.Type] = tb
	tips[tb.Type] = tb

	w = wtype.NewLHWell("Gilson50Tipbox", "", "A1", "ul", 50.0, 1.0, 1, 0, 7.3, 7.3, 46.0, 0.0, "mm")
	w.Extra["InnerL"] = 5.5
	w.Extra["InnerW"] = 5.5
	w.Extra["Tipeffectiveheight"] = 34.6
	tip = wtype.NewLHTip("gilson", "Gilson50", 1.0, 50.0, "ul")
	tb = wtype.NewLHTipbox(8, 12, 60.13, "Gilson", "DF50 Tip Rack (PIPETMAX 8x50)", tip, w, 9.0, 9.0, 0.0, 0.0, 28.93)
	tips[tip.Type] = tb
	tips[tb.Type] = tb

	return tips
}
func TestDecodeGenericPlateLHPlate(t *testing.T) { //TODO jmanart, this really should have better set of tests
	swshp := wtype.NewShape("box", "mm", 8.2, 8.2, 41.3)
	welltype := wtype.NewLHWell("DSW96", "", "", "ul", 2000, 25, swshp, 3, 8.2, 8.2, 41.3, 4.7, "mm")
	plate := *wtype.NewLHPlate("DSW96", "Unknown", 8, 12, 44.1, "mm", welltype, 9, 9, 0.0, 0.0, 0.0)

	enc, err := json.Marshal(plate)
	if err != nil {
		t.Fatal(err)
	}
	out, err := DecodeGenericPlate(string(enc))
	if err != nil {
		t.Fatal(err)
	}

	if reflect.TypeOf(out) != reflect.TypeOf(plate) {
		t.Fatal("expecting output type ", reflect.TypeOf(plate), " got ", reflect.TypeOf(out))
	} else if !reflect.DeepEqual(out, plate) {
		//let's compare the json output
		wanted, _ := json.Marshal(plate)
		got, _ := json.Marshal(out)
		if strings.TrimSpace(string(wanted)) != strings.TrimSpace(string(got)) {
			//		wanted, _ := json.MarshalIndent(plate, "", "\t")
			//		got, _ := json.MarshalIndent(out, "", "\t")
			//		fmt.Println(pretty.Compare(out, plate))
			//cannot use this because it generates a closed loop inside the library
			//		fmt.Println(diff.Diff(string(got), string(wanted)))
			t.Fatalf(
				//			"The input and output contents are not the same.",
				"The input and output contents are not the same; Wanted \n%s\n got \n%s\n",
				string(got),
				string(wanted),
			)
		}
	}
}
func TestDecodeGenericPlateLHTipBox(t *testing.T) {
	shp := wtype.NewShape("cylinder", "mm", 7.3, 7.3, 51.2)
	w := wtype.NewLHWell("Gilson20Tipbox", "", "A1", "ul", 20.0, 1.0, shp, 0, 7.3, 7.3, 46.0, 0.0, "mm")
	w.Extra["InnerL"] = 5.5
	w.Extra["InnerW"] = 5.5
	w.Extra["Tipeffectiveheight"] = 34.6
	tip := wtype.NewLHTip("gilson", "Gilson20", 0.5, 20.0, "ul")
	lhTipBox := *wtype.NewLHTipbox(8, 12, 60.13, "Gilson", "DL10 Tip Rack (PIPETMAX 8x20)", tip, w, 9.0, 9.0, 0.0, 0.0, 28.93)

	enc, err := json.Marshal(lhTipBox)
	if err != nil {
		t.Fatal(err)
	}

	out, err := DecodeGenericPlate(string(enc))
	if err != nil {
		t.Fatal(err)
	}

	if reflect.TypeOf(out) != reflect.TypeOf(lhTipBox) {
		t.Fatal("expecting output type ", reflect.TypeOf(lhTipBox), " got ", reflect.TypeOf(out))
	} else if !reflect.DeepEqual(out, lhTipBox) {
		t.Fatal("The input and output contents are not the same")
	}
}
Example #4
0
func makeTipwastes() map[string]*wtype.LHTipwaste {
	ret := make(map[string]*wtype.LHTipwaste, 1)

	w := wtype.NewLHWell("Gilsontipwaste", "", "A1", "ul", 800000.0, 800000.0, 0, 0, 123.0, 80.0, 92.0, 0.0, "mm")
	lht := wtype.NewLHTipwaste(100, "gilsontipwaste", "gilson", 92.0, w, 49.5, 31.5, 0.0)

	ret["Gilsontipwaste"] = lht

	return ret
}
Example #5
0
// TODO plate dimensions are not correct
func makePlateLibrary() map[string]*wtype.LHPlate {
	plates := make(map[string]*wtype.LHPlate)

	welltype := wtype.NewLHWell("DSW96", "", "", "ul", 2000, 25, 0, 3, 8.2, 8.2, 41.3, 4.7, "mm")
	plate := wtype.NewLHPlate("DSW96", "Unknown", 8, 12, 44.1, "mm", welltype, 9, 9, 0.0, 0.0, 0.0)
	plates[plate.Type] = plate

	welltype = wtype.NewLHWell("SRWFB96", "", "", "ul", 500, 10, 1, 0, 8.2, 8.2, 11, 1.0, "mm")
	plate = wtype.NewLHPlate("SRWFB96", "Unknown", 8, 12, 15, "mm", welltype, 9, 9, 0.0, 0.0, 0.0)
	plates[plate.Type] = plate

	welltype = wtype.NewLHWell("DWST12", "", "", "ul", 15000, 1000, 0, 3, 8.2, 72, 41.3, 4.7, "mm")
	plate = wtype.NewLHPlate("DWST12", "Unknown", 1, 12, 44.1, "mm", welltype, 9, 9, 0.0, 31.5, 0.0)
	plates[plate.Type] = plate

	welltype = wtype.NewLHWell("DWST8", "", "", "ul", 24000, 1000, 0, 3, 115, 8.2, 41.3, 4.7, "mm")
	plate = wtype.NewLHPlate("DWST8", "Unknown", 8, 1, 44.1, "mm", welltype, 9, 9, 49.5, 0.0, 0.0)
	plates[plate.Type] = plate

	welltype = wtype.NewLHWell("DWR1", "", "", "ul", 300000, 20000, 0, 3, 115, 72, 41.3, 4.7, "mm")
	plate = wtype.NewLHPlate("DWR1", "Unknown", 1, 1, 44.1, "mm", welltype, 9, 9, 49.5, 31.5, 0.0)
	plates[plate.Type] = plate

	welltype = wtype.NewLHWell("pcrplate", "", "", "ul", 300, 10, 1, 0, 8.2, 8.2, 11, 1.0, "mm")
	plate = wtype.NewLHPlate("pcrplate", "Unknown", 8, 12, 15, "mm", welltype, 9, 9, 0.0, 0.0, 6.0)
	plates[plate.Type] = plate
	return plates
}
func TestDecodeGenericPlateLHTipWaste(t *testing.T) {
	shp := wtype.NewShape("box", "mm", 123.0, 80.0, 92.0)

	w := wtype.NewLHWell("Gilsontipwaste", "", "A1", "ul", 800000.0, 800000.0, shp, 0, 123.0, 80.0, 92.0, 0.0, "mm")
	lht := *wtype.NewLHTipwaste(200, "gilsontipwaste", "gilson", 92.0, w, 49.5, 31.5, 0.0)

	enc, err := json.Marshal(lht)
	if err != nil {
		t.Fatal(err)
	}

	out, err := DecodeGenericPlate(string(enc))
	if err != nil {
		t.Fatal(err)
	}

	if reflect.TypeOf(out) != reflect.TypeOf(lht) {
		t.Fatal("expecting output type ", reflect.TypeOf(lht), " got ", reflect.TypeOf(out))
	} else if !reflect.DeepEqual(out, lht) {
		t.Fatal("The input and output contents are not the same")
	}
}