Ejemplo n.º 1
0
        public List<string> GeneratePooling(int sampleCount,ref List<string> barcodesTrace)
        {
            //first process batchs,48 per batch for 6 pooling into 1, 64 for 8 pooling into 1,etc.
            int sampleCntPerBatch = 8 * GlobalVars.Instance.PoolingCnt;
            int batchCnt = sampleCount / sampleCntPerBatch;
            List<PipettingInfo> batchPipettingInfos = new List<PipettingInfo>();
            int startGridID = GlobalVars.Instance.StartGridID;//
            List<string> strs = new List<string>();
            for (int i = 0; i < batchCnt; i++)
            {
                var thisGridPipettingInfos = GenerateBatch(startGridID);
                strs.AddRange(Format(thisGridPipettingInfos));
                strs.Add(string.Format("B;Comment(\"Pippeting Batch: {0}\");", i + 1));
                batchPipettingInfos.AddRange(thisGridPipettingInfos);
                curDstWellStartIndex += 8;
                startGridID += 3;
            }

            strs.Add("B;Comment(\"Pippeting Remaining\");");
            //process remaining without addtional neg
            #region noneedAdditional
            List<PipettingInfo> fragmentsPipettingInfo = new List<PipettingInfo>();
            int remainingCnt = sampleCount - batchCnt * sampleCntPerBatch;
            int dstWellCntNeeded = remainingCnt / GlobalVars.Instance.PoolingCnt;
            int noNeedAdditionalCnt = dstWellCntNeeded * GlobalVars.Instance.PoolingCnt;
            for (int wellIndex = 0; wellIndex < noNeedAdditionalCnt; wellIndex++)
            {
                int srcGridID = startGridID + wellIndex / 16;
                int wellIndexInGrid = wellIndex - (wellIndex / 16) * 16;
                int dstWellIndex = wellIndex - wellIndex / dstWellCntNeeded * dstWellCntNeeded;
                string sGrid = string.Format("grid{0}", srcGridID);
                Position pos = new Position(srcGridID - 1, wellIndexInGrid);
                if (!GlobalVars.Instance.pos_BarcodeDict.ContainsKey(pos))
                    throw new Exception(string.Format("Cannot find barcode for grid:{0}, pos:{1}", pos.x, pos.y));

                string barcode = GlobalVars.Instance.pos_BarcodeDict[pos];
                int dstWellID = curDstWellStartIndex + dstWellIndex + 1;
                double volume = Math.Round(GlobalVars.Instance.PipettingVolume / 2, 1);
                fragmentsPipettingInfo.Add(new PipettingInfo(
                    sGrid,
                    wellIndexInGrid + 1,
                    volume,
                    GlobalVars.Instance.DstLabware,
                    MapDstWellID(dstWellID),
                    barcode));
                fragmentsPipettingInfo.Add(new PipettingInfo(
                   sGrid,
                   wellIndexInGrid + 1,
                   volume,
                   GetSecondSliceDstLabware(),
                   MapDstWellID(dstWellID, false),
                   barcode));
            }
            curDstWellStartIndex += dstWellCntNeeded;
            #endregion
            //process remaining
            remainingCnt -= dstWellCntNeeded * GlobalVars.Instance.PoolingCnt;
            dstWellCntNeeded = CalculateNeededDstWell(remainingCnt);
            int additionalWellCnt = dstWellCntNeeded * GlobalVars.Instance.PoolingCnt - remainingCnt;
            for (int wellIndex = 0; wellIndex < remainingCnt + additionalWellCnt; wellIndex++ )
            {
                int wellIndexInBatch = wellIndex + noNeedAdditionalCnt;
                int srcGridID = startGridID + wellIndexInBatch / 16;
                int wellIndexInGrid = wellIndexInBatch - (wellIndexInBatch / 16) * 16;
                int dstWellIndex = wellIndex - wellIndex / dstWellCntNeeded * dstWellCntNeeded;
                string sGrid = string.Format("grid{0}", srcGridID);
                string barcode = "";

                if (wellIndex >= remainingCnt)
                    continue;
                var pos = new Position(srcGridID - 1, wellIndexInGrid);
                if (!GlobalVars.Instance.pos_BarcodeDict.ContainsKey(pos))
                    throw new Exception(string.Format("Cannot find barcode for grid:{0}, pos:{1}", pos.x, pos.y));

                barcode = GlobalVars.Instance.pos_BarcodeDict[pos];
                int dstWellID = curDstWellStartIndex + dstWellIndex + 1;
                double volume = Math.Round(GlobalVars.Instance.PipettingVolume/2,1);
                fragmentsPipettingInfo.Add(new PipettingInfo(
                    sGrid,
                    wellIndexInGrid + 1,
                    volume,
                    GlobalVars.Instance.DstLabware,
                    MapDstWellID(dstWellID),
                    barcode ));
                fragmentsPipettingInfo.Add(new PipettingInfo(
                   sGrid,
                   wellIndexInGrid + 1,
                   volume,
                   GetSecondSliceDstLabware(),
                   MapDstWellID(dstWellID,false),
                   barcode));
            }

            curDstWellStartIndex += dstWellCntNeeded;
            strs.AddRange(Format(fragmentsPipettingInfo));
            batchPipettingInfos.AddRange(fragmentsPipettingInfo);
            barcodesTrace = GetBarcodesSourceInfo(batchPipettingInfos);
            return strs;
        }
Ejemplo n.º 2
0
        private List<string> GenerateNormal(int poolingSampleCnt, int normalSampleCnt, ref List<string> normalBarcodeTrace)
        {
            int startGridID = GlobalVars.Instance.StartGridID;//
            List<PipettingInfo> normalPipettings = new List<PipettingInfo>();
            for (int i = 0; i < normalSampleCnt; i++)
            {
                int wellIndex = i + poolingSampleCnt;
                int srcGridID = startGridID + wellIndex / 16;
                int wellIndexInGrid = wellIndex - (wellIndex / 16) * 16;

                string sGrid = string.Format("grid{0}", srcGridID);
                int dstWellID = curDstWellStartIndex + i + 1;
                Position pos = new Position(srcGridID - 1, wellIndexInGrid);
                if (!GlobalVars.Instance.pos_BarcodeDict.ContainsKey(pos))
                    throw new Exception(string.Format("Cannot find barcode for grid:{0}, pos:{1}", pos.x, pos.y));

                string barcode = GlobalVars.Instance.pos_BarcodeDict[pos];
                double volume = 480;//Math.Round(GlobalVars.Instance.PipettingVolume / 2, 1);
                normalPipettings.Add(new PipettingInfo(
                    sGrid,
                    wellIndexInGrid + 1,
                    volume,
                    GlobalVars.Instance.DstLabware,
                    MapDstWellID(dstWellID),
                    barcode));
                normalPipettings.Add(new PipettingInfo(
                   sGrid,
                   wellIndexInGrid + 1,
                   volume,
                   GetSecondSliceDstLabware(),
                   MapDstWellID(dstWellID,false),
                   barcode));
            }
            curDstWellStartIndex += normalSampleCnt;
            List<string> strs = new List<string>();
            strs.AddRange(Format(normalPipettings));
            normalBarcodeTrace = GetBarcodesSourceInfo(normalPipettings);
            return strs;
        }
Ejemplo n.º 3
0
 internal void SetBarcodes(int gridID, List<string> barcodes)
 {
     int gridIndex = gridID - 1;
     for(int i = 0; i< barcodes.Count; i++)
     {
         //if (barcodes[i] == "$$$")
         //    continue;
         Position pos = new Position(gridIndex, i);
         if (pos_BarcodeDict.ContainsKey(pos))
             pos_BarcodeDict[pos] = barcodes[i];
         else
             pos_BarcodeDict.Add(pos, barcodes[i]);
     }
 }