public IFileReader2 <List <SrmTransition> > GetReader()
        {
            var result = SrmFormatFactory.FindReader(this.DefinitionFileFormat);

            if (result == null)
            {
                result = SrmFormatFactory.GetDefaultReader();
            }
            return(result);
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < items.Count; i++)
            {
                if (!string.IsNullOrEmpty(items[i].PropertyName))
                {
                    if (!propertyNames.Contains(items[i].PropertyName))
                    {
                        MessageBox.Show("Property " + items[i].PropertyName + " is illegal!");
                        return;
                    }

                    for (int j = i + 1; j < items.Count; j++)
                    {
                        if (items[i].PropertyName.Equals(items[j].PropertyName))
                        {
                            MessageBox.Show("Property " + items[i].PropertyName + " are multi-defined!");
                            return;
                        }
                    }
                }
            }

            dlgSaveFormatFile.InitialDirectory = FileUtils.GetTemplateDir().FullName;

            if (File.Exists(lastFile) && !File.Exists(dlgSaveFormatFile.FileName))
            {
                dlgSaveFormatFile.FileName = lastFile;
            }

            if (dlgSaveFormatFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var map = headers.ToDictionary(m => m.PropertyName);
                items.ForEach(m =>
                {
                    if (!string.IsNullOrEmpty(m.PropertyName))
                    {
                        var item    = map[m.PropertyName];
                        m.ValueType = item.ValueType;
                        m.Required  = item.Required;
                        m.Format    = item.Format;
                    }
                });

                items.DelimiterString = txtDelimiter.Text;
                items.Description     = txtDescription.Text;

                items.WriteToFile(dlgSaveFormatFile.FileName);

                SrmFormatFactory.Refresh();
            }
        }
Exemple #3
0
        public SrmDistillerUI()
        {
            InitializeComponent();

            base.SetDirectoryArgument("TargetDirectory", "Target");

            this.dataDirs = new RcpaListViewMultipleFileDirectoryField(
                this.btnAddFiles,
                this.btnAddDirectory,
                this.btnAddSubdirectory,
                this.btnRemove,
                this.btnLoad,
                this.btnSave,
                this.lvDirectories,
                "Files",
                new OpenFileArgument("mzXml / mzData / Thermo Raw", new string[] { "mzXml", "mzData", "raw" }),
                "Agilent .d directory",
                true,
                true);
            AddComponent(this.dataDirs);

            this.rtToleranceInSecond = new RcpaDoubleField(txtRetentionTimeTolerance, "RTToleranceSecond", "Retention Time Tolerance in Second", 1.0, true);
            AddComponent(this.rtToleranceInSecond);

            this.signalToNoise = new RcpaDoubleField(txtSignalToNoise, "SignalToNoise", "Signal to Noise", 3.0, true);
            AddComponent(this.signalToNoise);

            this.precursorMassDistance = new RcpaTextField(txtPrecursorTolerance, "PrecursorMassDistance", "Distance between light and heavy precursor mass", "7,8,10", true);
            AddComponent(this.precursorMassDistance);

            this.smooth = new RcpaCheckBox(cbSmooth, "Smooth", true);
            AddComponent(this.smooth);

            this.refinePeakPicking = new RcpaCheckBox(cbRefinePeakPicking, "RefinePeakPicking", true);
            AddComponent(this.refinePeakPicking);

            this.deductBaseLine = new RcpaCheckBox(cbBaseLineExtraction, "DeductBaseLine", false);
            AddComponent(this.deductBaseLine);

            this.mzTolerance = new RcpaDoubleField(txtMzTolerance, "MzTolerance", "Product ion m/z tolerance", 0.1, true);
            AddComponent(this.mzTolerance);

            this.validateSignalToNoise = new RcpaDoubleField(txtValidateSignalToNoise, "ValidateSignalToNoise", "Validation signal to noise", 2, true);
            AddComponent(this.validateSignalToNoise);

            this.validateCorrel = new RcpaDoubleField(txtValidateCorrel, "ValidateCorrel", "Validation regression correlation", 0.5, true);
            AddComponent(this.validateCorrel);

            this.minValidTransactionPair = new RcpaIntegerField(txtMinValidTransactionPair, "minValidTransactionPair", "Minimum valid transaction pair count", 2, true);
            AddComponent(this.minValidTransactionPair);

            this.clusterByPredefine = new RcpaRadioButton(rbClusterByPredefine, "ClusterByPredefined", true);
            AddComponent(this.clusterByPredefine);

            this.clusterByRealData = new RcpaRadioButton(rbClusterByRealData, "ClusterByRealData", false);
            AddComponent(this.clusterByRealData);

            this.predefinedFile = new RcpaFileField(btnPredefined, txtPredefinedFile, "PredefinedFile", new OpenFileArgument("Predefined SRM Transaction File", ".txt"), false);
            AddComponent(this.predefinedFile);

            this.peakPickingByBaseline = new RcpaRadioButton(rbBaseline, "PeakPickingByBaseline", true);
            AddComponent(this.peakPickingByBaseline);

            this.peakPickingByHighestPeak = new RcpaRadioButton(rbHighestPeak, "PeakPickingByHighestPeak", false);
            AddComponent(this.peakPickingByHighestPeak);

            this.baseLinePercentage = new RcpaDoubleField(txtBaselinePercentage, "BaselinePercentage", "Baseline percentage", 5, true);
            AddComponent(this.baseLinePercentage);

            this.highestPeakPercentage = new RcpaDoubleField(txtHighestPeakPercentage, "HighestPeakPercentage", "Highest peak percentage", 5, false);
            AddComponent(this.highestPeakPercentage);

            this.precursorDistance = new RcpaDoubleField(txtMaxPrecursorDistance, "precursorDistance", "Maximum Precursor Distance", 20, true);
            AddComponent(this.precursorDistance);

            this.formats = new RcpaComboBox <IFileReader2 <List <SrmTransition> > >(cbFormat, "FileFormat", SrmFormatFactory.GetReaders().ToArray(), 0);
            AddComponent(this.formats);

            this.minEnabledScan = new RcpaIntegerField(txtMinEnabledScan, "MinValidScan", "Minimum valid scan count", 5, true);
            AddComponent(this.minEnabledScan);

            this.hasDecoy = new RcpaCheckBox(cbDecoyPattern, "HasDecoy", false);
            AddComponent(this.hasDecoy);

            this.ratioByArea = new RcpaCheckBox(cbRatioByArea, "ratioByArea", true);
            AddComponent(this.ratioByArea);

            this.decoyPattern = new RcpaTextField(txtDecoyPattern, "DecoyPattern", "Decoy pattern", "DECOY", false);
            this.decoyPattern.ValidateFunc = m =>
            {
                try
                {
                    new Regex(m);
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            };
            AddComponent(this.decoyPattern);

            this.Text = Constants.GetSQHTitle(title, version);
        }