Example #1
0
        public void LoadSettings(ref PipettingSettings pipettingSettings, ref LabwareSettings labwareSettings)
        {
            XmlSerializer xs    = new XmlSerializer(typeof(PipettingSettings));
            string        sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName;

            if (!File.Exists(sFile))
            {
                SaveSettings(pipettingSettings);
                return;
            }
            Stream stream = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read);

            pipettingSettings = xs.Deserialize(stream) as PipettingSettings;
            stream.Close();

            xs    = new XmlSerializer(typeof(LabwareSettings));
            sFile = GetExeFolder() + "\\" + stringRes.labwareSettingFileName;
            if (!File.Exists(sFile))
            {
                SaveSettings(labwareSettings);
                return;
            }
            stream          = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read);
            labwareSettings = xs.Deserialize(stream) as LabwareSettings;
            stream.Close();
        }
Example #2
0
        public void SaveSettings(PipettingSettings settings)
        {
            XmlSerializer xs    = new XmlSerializer(typeof(PipettingSettings));
            string        sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName;

            Stream stream = new FileStream(sFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);

            xs.Serialize(stream, settings);
            stream.Close();
        }
Example #3
0
        internal static int GetSamplesPerRow(LabwareSettings labwareSettings, PipettingSettings pipettingSettings)
        {
            int totalRow            = labwareSettings.dstLabwareRows;
            int totalSlicePerSample = pipettingSettings.dstbuffySlice + pipettingSettings.dstPlasmaSlice + pipettingSettings.dstRedCellSlice;

            if (labwareSettings.dstLabwareColumns == 1)
            {
                return(1);
            }
            return(labwareSettings.dstLabwareRows / totalSlicePerSample);
        }
Example #4
0
        public bool IsValidSetting(LabwareSettings labwareSettings, PipettingSettings pipettingSettings, ref string errMsg)
        {
            if (labwareSettings.sourceLabwareGrids > labwareSettings.dstLabwareStartGrid)
            {
                errMsg = "plasma start grid must > source sample start grid";
                return(false);
            }

            //if (labwareSettings.dstBuffyStartGrid < labwareSettings.dstLabwareStartGrid)
            //{
            //    errMsg = "buffy start grid must > plasma start grid";
            //    return false;
            //}

            //if (labwareSettings.dstRedCellStartGrid < labwareSettings.dstBuffyStartGrid)
            //{
            //    errMsg = "red cell start grid must > buffy start grid";
            //    return false;
            //}

            //if (pipettingSettings.dstPlasmaSlice == 0)
            //{
            //    errMsg = "destination plasma slice must > 0";
            //    return false;
            //}

            int possibleGrids = labwareSettings.dstLabwareStartGrid - labwareSettings.sourceLabwareStartGrid;

            if (labwareSettings.dstLabwareStartGrid < labwareSettings.sourceLabwareStartGrid + labwareSettings.sourceLabwareGrids)
            {
                errMsg = string.Format("there is only {0} grids between source sample start grid & plasma start grid, but there is {1} racks of source racks!", possibleGrids, labwareSettings.sourceLabwareGrids);
                return(false);
            }


            //如果冻存管载架只有一列位置,那么Region的列数plasma+ buffy数量决定,
            //如果冻存管载架有多列位置N,那么Region的列数由N决定
            int columnsPerRegion = labwareSettings.dstLabwareColumns;
            int totalSlice       = pipettingSettings.dstbuffySlice + pipettingSettings.dstPlasmaSlice + pipettingSettings.dstRedCellSlice;

            if (columnsPerRegion == 1)
            {
                columnsPerRegion = totalSlice;
            }

            if (totalSlice > columnsPerRegion)
            {
                errMsg = string.Format("there is only {0} columns in the region, but there is {1} slice of plasma,buffy & red cell to dispense!", columnsPerRegion, totalSlice);
                return(false);
            }
            return(true);
        }
Example #5
0
        //const string plasmaName = "Plasma";
        //const string redCellName = "RedCell";
        public BarcodeTracker(PipettingSettings pipettingSettings, LabwareSettings labwareSettings, List <PatientInfo> patientInfos)
        {
            this.patientInfos      = patientInfos;
            this.pipettingSettings = pipettingSettings;
            ExcelReader excelReader = new ExcelReader();

            correspondingbarcodes = excelReader.ReadBarcodes(labwareSettings,
                                                             pipettingSettings,
                                                             barcode_plateBarcodes,
                                                             barcode_Position);
            if (patientInfos.Count > correspondingbarcodes.Count)
            {
                throw new Exception(string.Format("source barcodes' count:{0} > dest barcodes' count :{1}", patientInfos.Count, correspondingbarcodes.Count));
            }
        }
Example #6
0
        public List <List <Tuple <string, string> > > ReadBarcodes(LabwareSettings labwareSettings,
                                                                   PipettingSettings pipettingSettings,
                                                                   Dictionary <string, string> barcode_plateBarcode,
                                                                   Dictionary <string, string> barcode_Position)
        {
            startIndex             = 0;
            this.labwareSettings   = labwareSettings;
            this.pipettingSettings = pipettingSettings;
            string sFolder = GlobalVars.Instance.DstBarcodeFolder;
            var    di      = new DirectoryInfo(sFolder);
            var    files   = di.EnumerateFiles("*.csv").ToList();

            files = files.OrderBy(x => x.CreationTime).ToList();
            List <List <Tuple <string, string> > > correspondingbarcodes = new List <List <Tuple <string, string> > >();
            List <string> fileFullNames  = files.Select(x => x.FullName).ToList();
            string        buffyPlateName = "";

            bool buffy2Standalone = pipettingSettings.buffyStandalone && pipettingSettings.dstbuffySlice != 0;

            if (buffy2Standalone)
            {
                int cnt = files.Count(x => x.FullName.ToLower().Contains("buffy"));
                if (cnt == 0)
                {
                    throw new Exception("No barcode file for buffy plate found!");
                }
                if (cnt != 1)
                {
                    throw new Exception("Only one buffy plate supported!");
                }
                buffyPlateName = files.Where(x => x.FullName.ToLower().Contains("buffy")).First().FullName;
                fileFullNames  = fileFullNames.Except(new List <string>()
                {
                    buffyPlateName
                }).ToList();
            }

            fileFullNames.ForEach(x => ReadBarcode(correspondingbarcodes, barcode_plateBarcode, barcode_Position, x));
            if (buffy2Standalone)
            {
                ReadBarcode(correspondingbarcodes, barcode_plateBarcode, barcode_Position, buffyPlateName);
            }
            return(correspondingbarcodes);
        }
Example #7
0
 public PositionGenerator(PipettingSettings pSettings, LabwareSettings lSettings, int nSample)
 {
     pipettingSettings = pSettings;
     labwareSettings   = lSettings;
     totalSample       = nSample;
 }
        public void LoadSettings(ref PipettingSettings pipettingSettings, ref LabwareSettings labwareSettings)
        {
            XmlSerializer xs = new XmlSerializer(typeof(PipettingSettings));
            string sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName;
            if (!File.Exists(sFile))
            {
                SaveSettings(pipettingSettings);
                return;
            }
            Stream stream = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read);
            pipettingSettings = xs.Deserialize(stream) as PipettingSettings;
            stream.Close();

            xs = new XmlSerializer(typeof(LabwareSettings));
            sFile = GetExeFolder() + "\\" + stringRes.labwareSettingFileName;
            if (!File.Exists(sFile))
            {
                SaveSettings(labwareSettings);
                return;
            }
            stream = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read);
            labwareSettings = xs.Deserialize(stream) as LabwareSettings;
            stream.Close();


        }
        public void SaveSettings(PipettingSettings settings)
        {

            XmlSerializer xs = new XmlSerializer(typeof(PipettingSettings));
            string sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName;

            Stream stream = new FileStream(sFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
            xs.Serialize(stream, settings);
            stream.Close();
        }
        public bool IsValidSetting(LabwareSettings labwareSettings,PipettingSettings pipettingSettings,ref string errMsg)
        {
            if (labwareSettings.sourceLabwareGrids > labwareSettings.dstLabwareStartGrid)
            {
                errMsg = "plasma start grid must > source sample start grid";
                return false;
            }

            //if (labwareSettings.dstBuffyStartGrid < labwareSettings.dstLabwareStartGrid)
            //{
            //    errMsg = "buffy start grid must > plasma start grid";
            //    return false;
            //}

            //if (labwareSettings.dstRedCellStartGrid < labwareSettings.dstBuffyStartGrid)
            //{
            //    errMsg = "red cell start grid must > buffy start grid";
            //    return false;
            //}

            //if (pipettingSettings.dstPlasmaSlice == 0)
            //{
            //    errMsg = "destination plasma slice must > 0";
            //    return false;
            //}

            int possibleGrids = labwareSettings.dstLabwareStartGrid - labwareSettings.sourceLabwareStartGrid ;
            if (labwareSettings.dstLabwareStartGrid < labwareSettings.sourceLabwareStartGrid + labwareSettings.sourceLabwareGrids)
            {
                errMsg = string.Format("there is only {0} grids between source sample start grid & plasma start grid, but there is {1} racks of source racks!", possibleGrids, labwareSettings.sourceLabwareGrids);
                return false;
            }

            
            //如果冻存管载架只有一列位置,那么Region的列数plasma+ buffy数量决定,
            //如果冻存管载架有多列位置N,那么Region的列数由N决定
            int columnsPerRegion = labwareSettings.dstLabwareColumns;
            int totalSlice = pipettingSettings.dstbuffySlice + pipettingSettings.dstPlasmaSlice + pipettingSettings.dstRedCellSlice;
            if (columnsPerRegion == 1)
                columnsPerRegion = totalSlice;

            if (totalSlice > columnsPerRegion)
            {
                errMsg = string.Format("there is only {0} columns in the region, but there is {1} slice of plasma,buffy & red cell to dispense!", columnsPerRegion, totalSlice);
                return false;
            }
            return true;
        }
 public PositionGenerator(PipettingSettings pSettings, LabwareSettings lSettings, int nSample)
 {
     pipettingSettings = pSettings;
     labwareSettings = lSettings;
     totalSample = nSample;
 }