Beispiel #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 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")
	}
}