public override IEnumerable <string> Process(string fileName)
        {
            var result = new FileInfo(targetDir + "\\" + new FileInfo(fileName).Name + ".scancount").FullName;

            Dictionary <string, int> scanTypeCount = new Dictionary <string, int>();

            using (var reader = RawFileFactory.GetRawFileReader(fileName))
            {
                var firstScan = reader.GetFirstSpectrumNumber();
                var lastScan  = reader.GetLastSpectrumNumber();
                for (int scan = firstScan; scan <= lastScan; scan++)
                {
                    var msLevel  = reader.GetMsLevel(scan);
                    var scanMode = reader.GetScanMode(scan);
                    var key      = string.Format("MS{0}_{1}", msLevel, scanMode);
                    if (!scanTypeCount.ContainsKey(key))
                    {
                        scanTypeCount[key] = 1;
                    }
                    else
                    {
                        scanTypeCount[key] = scanTypeCount[key] + 1;
                    }
                }
            }

            ScanCountFormat.WriteToFile(result, scanTypeCount);

            return(new string[] { result });
        }
Exemplo n.º 2
0
        protected override void DoAfterProcessing(string aPath, ConcurrentBag <string> result)
        {
            if (bMerge)
            {
                var counts = new Dictionary <string, int>();
                foreach (var file in result)
                {
                    var curCounts = ScanCountFormat.ReadFromFile(file);

                    foreach (var entry in curCounts)
                    {
                        if (!counts.ContainsKey(entry.Key))
                        {
                            counts[entry.Key] = entry.Value;
                        }
                        else
                        {
                            counts[entry.Key] = counts[entry.Key] + entry.Value;
                        }
                    }
                }

                var combineFile = new FileInfo(aPath + "\\scancount.xls").FullName;
                ScanCountFormat.WriteToFile(combineFile, counts);

                result.Add(combineFile);
            }
        }