Example #1
0
func _TestMarshal(*testing.T) {
	lhc := wtype.NewLHComponent()

	lhc.Vol = 34
	lhc.Vunit = "ul"

	b, _ := json.Marshal(lhc)
	lhc2 := wtype.NewLHComponent()

	json.Unmarshal(b, &lhc2)
}
Example #2
0
func get_aggregate_component(sol *wtype.LHSolution, name string) *wtype.LHComponent {
	components := sol.Components

	ret := wtype.NewLHComponent()

	ret.CName = name

	vol := 0.0

	for _, component := range components {
		nm := component.CName

		if nm == name {
			ret.Type = component.Type
			vol += component.Vol
			ret.Vunit = component.Vunit
			ret.Loc = component.Loc
			ret.Order = component.Order
		}
	}

	ret.Vol = vol

	return ret
}
Example #3
0
// take a sample of this liquid to be used to make the solution up to
// a particular total volume
func SampleForTotalVolume(l wtype.Liquid, v wunit.Volume) *wtype.LHComponent {
	ret := wtype.NewLHComponent()
	ret.CName = l.Name()
	ret.Tvol = v.RawValue()
	ret.Vunit = v.Unit().PrefixedSymbol()
	ret.LContainer = l.Container().(*wtype.LHWell)
	ret.CName = l.Name()
	ret.Extra = l.GetExtra()
	ret.Smax = l.GetSmax()
	ret.Visc = l.GetVisc()

	return ret
}
Example #4
0
// take a sample of this liquid and aim for a particular concentration
func SampleForConcentration(l wtype.Liquid, c wunit.Concentration) *wtype.LHComponent {
	ret := wtype.NewLHComponent()
	ret.CName = l.Name()
	// TODO fill in type here
	ret.Conc = c.RawValue()
	ret.Cunit = c.Unit().PrefixedSymbol()
	ret.CName = l.Name()
	ret.Extra = l.GetExtra()
	ret.Smax = l.GetSmax()
	ret.Visc = l.GetVisc()
	ret.LContainer = l.Container().(*wtype.LHWell)
	return ret
}
Example #5
0
func makeComponentLibrary() map[string]*wtype.LHComponent {
	matter := wtype.MakeMatterLib()

	cmap := make(map[string]*wtype.LHComponent)

	A := wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "water"
	A.Type = "water"
	A.Smax = 9999
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "tartrazine"
	A.Type = "water"
	A.Smax = 9999
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "DNAsolution"
	A.Type = "dna"
	A.Smax = 1.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["glycerol"]
	A.CName = "restrictionenzyme"
	A.Type = "glycerol"
	A.Smax = 100
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "dna_part"
	A.Type = "dna"
	A.Smax = 1.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["glycerol"]
	A.CName = "SapI"
	A.Type = "glycerol"
	A.Smax = 1.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["glycerol"]
	A.CName = "T4Ligase"
	A.Type = "glycerol"
	A.Smax = 1.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "CutsmartBuffer"
	A.Type = "water"
	A.Smax = 1.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "ATP"
	A.Type = "water"
	A.Smax = 5.0
	cmap[A.CName] = A

	A = wtype.NewLHComponent()
	A.GenericMatter = matter["water"]
	A.CName = "standard_cloning_vector_mark_1"
	A.Type = "water"
	A.Smax = 1.0
	cmap[A.CName] = A

	return cmap
}