Ejemplo n.º 1
0
        // Read Configuration file
        private void InitTest(ConfigFileReader reader)
        {
            // Read program variables
            var config = reader.GetNodes("vars").First();
            var actStr = config.Contents["activationmethod"].ToLower();

            _noiseFiltration = Convert.ToDouble(config.Contents["noisefiltration"]);
            _precursorCharge = Convert.ToInt32(config.Contents["precursorcharge"]);
            _searchWidth     = Convert.ToDouble(config.Contents["searchwidth"]);
            _binWidth        = Convert.ToDouble(config.Contents["binwidth"]);

            // Read input and output file names
            var fileInfo = reader.GetNodes("fileinfo").First();

            _names  = fileInfo.Contents["name"].Split(',');
            _preTsv = fileInfo.Contents["tsvpath"];
            _preRaw = fileInfo.Contents["rawpath"];
            var outPathtemp = fileInfo.Contents["outpath"];

            _outPre = outPathtemp;
            var outFiletemp = fileInfo.Contents["outfile"];

            _outFileName = _outPre + outFiletemp;
        }
Ejemplo n.º 2
0
        // Read Configuration file
        private void InitTest(ConfigFileReader reader)
        {
            // Read program variables
            var config = reader.GetNodes("vars").First();

            _precursorCharge = Convert.ToInt32(config.Contents["precursorcharge"]);
            var actStr = config.Contents["activationmethod"].ToLower();

            _combineCharges = (config.Contents.ContainsKey("combinecharges") &&
                               config.Contents["combinecharges"].ToLower() == "true");

            _useDecoy = (config.Contents.ContainsKey("usedecoy") &&
                         config.Contents["usedecoy"].ToLower() == "true");

            _relativeIntensityThreshold = Convert.ToDouble(config.Contents["relativeintensitythreshold"]);

            // Read ion data
            var ionInfo      = reader.GetNodes("ion").First();
            int totalCharges = Convert.ToInt32(ionInfo.Contents["totalcharges"]);
            var ionTypeStr   = ionInfo.Contents["iontype"].Split(',');
            var ions         = new BaseIonType[ionTypeStr.Length];

            for (int i = 0; i < ionTypeStr.Length; i++)
            {
                switch (ionTypeStr[i].ToLower())
                {
                case "a":
                    ions[i] = BaseIonType.A;
                    break;

                case "b":
                    ions[i] = BaseIonType.B;
                    break;

                case "c":
                    ions[i] = BaseIonType.C;
                    break;

                case "x":
                    ions[i] = BaseIonType.X;
                    break;

                case "y":
                    ions[i] = BaseIonType.Y;
                    break;

                case "z":
                    ions[i] = BaseIonType.Z;
                    break;
                }
            }
            var ionLossStr = ionInfo.Contents["losses"].Split(',');
            var ionLosses  = new NeutralLoss[ionLossStr.Length];

            for (int i = 0; i < ionLossStr.Length; i++)
            {
                switch (ionLossStr[i].ToLower())
                {
                case "noloss":
                    ionLosses[i] = NeutralLoss.NoLoss;
                    break;

                case "nh3":
                    ionLosses[i] = NeutralLoss.NH3;
                    break;

                case "h2o":
                    ionLosses[i] = NeutralLoss.H2O;
                    break;
                }
            }
            _ionTypeFactory = new IonTypeFactory(ions, ionLosses, totalCharges);
            _ionTypes       = _ionTypeFactory.GetAllKnownIonTypes().ToList();
            var tempIonList = new List <IonType>();

            if (ionInfo.Contents.ContainsKey("exclusions"))
            {
                var ionExclusions = ionInfo.Contents["exclusions"].Split(',');
                tempIonList.AddRange(_ionTypes.Where(ionType => !ionExclusions.Contains(ionType.Name)));
                _ionTypes = tempIonList;
            }

            // Read input and output file names
            var fileInfo = reader.GetNodes("fileinfo").First();

            _names  = fileInfo.Contents["name"].Split(',');
            _preTsv = fileInfo.Contents["tsvpath"];
            _preRaw = fileInfo.Contents["rawpath"];
            var outPathtemp = fileInfo.Contents["outpath"];

            _outPre = outPathtemp;
            var outFiletemp = fileInfo.Contents["outfile"];

            _outFileName = _outPre + outFiletemp;
        }