예제 #1
0
파일: frontend.go 프로젝트: cgravill/antha
func NewFrontend() (*Frontend, error) {
	fe := &Frontend{}

	eid, err := uuid.NewV4()
	if err != nil {
		return nil, err
	}
	// TODO need to shudown equipmentmanager here on error
	fe.equipmentManager = equipmentManager.NewAnthaEquipmentManager(eid.String())
	fee := equipmentManager.EquipmentManager(fe.equipmentManager)
	equipmentManager.SetEquipmentManager(&fee)

	mid, err := uuid.NewV4()
	if err != nil {
		return nil, err
	}
	md := manual.NewAnthaManual(mid.String())
	mdd := equipment.Equipment(md)
	fe.equipmentManager.RegisterEquipment(&mdd)

	//cui logger middleware
	fe.cui = md.Cui
	cmw := middleware.NewLogToCui(&md.Cui)
	logId, err := uuid.NewV4()
	if err != nil {
		return nil, err
	}

	fe.logger = logger.NewAnthaFileLogger(logId.String())
	fe.logger.RegisterMiddleware(cmw)
	var logRef logger.Logger
	logRef = fe.logger
	logger.SetLogger(&logRef)

	var writer io.Writer
	if len(logFile) > 0 {
		w, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE, 0600)
		if err != nil {
			return nil, err
		}
		writer = w
	} else {
		writer = ioutil.Discard
	}

	fe.debugLogger = log.New(writer, "", log.LstdFlags)

	return fe, nil
}
예제 #2
0
파일: Assembly.go 프로젝트: cgravill/antha
func main() {
	eid, _ := uuid.NewV4()
	em := equipmentManager.NewAnthaEquipmentManager(eid.String())
	defer em.Shutdown()
	eem := equipmentManager.EquipmentManager(em)
	equipmentManager.SetEquipmentManager(&eem)
	//manual driver equipment
	mid, _ := uuid.NewV4()
	var mde equipment.Equipment
	var amd manual.AnthaManual
	amd = *manual.NewAnthaManual(mid.String())
	mde = amd
	em.RegisterEquipment(&mde)

	//cui logger middleware
	cmw := middleware.NewLogToCui(&amd.Cui)
	log_id, _ := uuid.NewV4()
	l := logger.NewAnthaFileLogger(log_id.String())
	l.RegisterMiddleware(cmw)
	var params Parameters
	var inputs Inputs

	// give this thing an arbitrary ID for testing

	id := execute.ThreadID(fmt.Sprintf("EXPERIMENT_1_%s", string(eid.String()[1:5])))

	fmt.Println(id)

	// set up parameters and inputs

	params.Reactionvolume = wunit.NewVolume(20, "ul")
	params.Partconc = wunit.NewConcentration(0.0001, "g/l")
	params.Vectorconc = wunit.NewConcentration(0.001, "g/l")
	params.Atpvol = wunit.NewVolume(1, "ul")
	params.Revol = wunit.NewVolume(1, "ul")
	params.Ligvol = wunit.NewVolume(1, "ul")
	params.Reactiontemp = wunit.NewTemperature(25, "C")
	params.Reactiontime = wunit.NewTime(1800, "s")
	params.Inactivationtemp = wunit.NewTemperature(40, "C")
	params.Inactivationtime = wunit.NewTime(60, "s")
	params.BlockID = id

	inputs.Parts = make([]*wtype.LHComponent, 4)

	for i := 0; i < 4; i++ {
		inputs.Parts[i] = factory.GetComponentByType("dna_part")
		inputs.Parts[i].CName = inputs.Parts[i].CName + "_" + strconv.Itoa(i+1)
	}

	inputs.Vector = factory.GetComponentByType("standard_cloning_vector_mark_1")
	inputs.RestrictionEnzyme = factory.GetComponentByType("SapI")
	inputs.Ligase = factory.GetComponentByType("T4Ligase")
	inputs.Buffer = factory.GetComponentByType("CutsmartBuffer")
	inputs.ATP = factory.GetComponentByType("ATP")
	inputs.Outplate = factory.GetPlateByType("pcrplate")
	inputs.TipType = factory.GetTipboxByType("Gilson50")

	ctx := execution.GetContext()
	conf := make(map[string]interface{})
	conf["MAX_N_PLATES"] = 1.5
	conf["MAX_N_WELLS"] = 12.0
	conf["RESIDUAL_VOLUME_WEIGHT"] = 1.0
	conf["SQLITE_FILE_IN"] = "/Users/msadowski/synthace/protocol_language/checkout/synthace-antha/anthalib/driver/liquidhandling/pm_driver/default.sqlite"
	conf["SQLITE_FILE_OUT"] = "/tmp/output_file.sqlite"
	ctx.ConfigService.SetConfig(id, conf)
	outputs := Steps(params, inputs)
	fmt.Println(outputs.Reaction)
}