Exemple #1
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            var cloValue = (double)ChromatogramMzLowerOffsetValueBox.Value;
            var cloUnits = (MZTolerance.Units)ChromatogramMzLowerOffsetUnitsBox.SelectedIndex;
            var cuoValue = (double)ChromatogramMzUpperOffsetValueBox.Value;
            var cuoUnits = (MZTolerance.Units)ChromatogramMzUpperOffsetUnitsBox.SelectedIndex;
            var rtMax    = (int)Math.Round(RTTolUpperBox.Value);
            var rtMin    = (int)Math.Round(RTTolLowerBox.Value);
            var maMax    = (int)Math.Round(MonoisotopicAdjustmentMaxBox.Value);
            var maMin    = (int)Math.Round(MonoisotopicAdjustmentMinBox.Value);

            XicConfig = new Embedder.XICConfiguration {
                ChromatogramMzLowerOffset   = new MZTolerance(cloValue, cloUnits),
                ChromatogramMzUpperOffset   = new MZTolerance(cuoValue, cuoUnits),
                RetentionTimeLowerTolerance = rtMin,
                RetentionTimeUpperTolerance = rtMax,
                MonoisotopicAdjustmentMax   = maMax,
                MonoisotopicAdjustmentMin   = maMin,
                MaxQValue          = _maxQValue,
                AlignRetentionTime = RTAlignBox.Checked
            };

            IsobaricConfig = new Embedder.QuantitationConfiguration
            {
                QuantitationMethod     = IsobaricConfig.QuantitationMethod,
                ReporterIonMzTolerance = new MZTolerance((double)reporterIonToleranceUpDown.Value, (MZTolerance.Units)reporterIonToleranceUnits.SelectedIndex),
                NormalizeIntensities   = normalizeReporterIonsCheckBox.Checked
            };

            DialogResult = DialogResult.OK;
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            searchPathTextBox.Text = String.Join(";", Util.StringCollectionToStringArray(Properties.Settings.Default.SourcePaths));
            extensionsTextBox.Text = Properties.Settings.Default.SourceExtensions;
            embeddedChanges        = false;

            // TODO: set these from global defaults?
            _defaultIsobaricConfig = new Embedder.QuantitationConfiguration()
            {
                QuantitationMethod = QuantitationMethod.ITRAQ4plex
            };
            _defaultXicConfig = new Embedder.XICConfiguration();

            _isobaricConfigBySource = new Dictionary <int, Embedder.QuantitationConfiguration>();
            _xicConfigBySource      = new Dictionary <int, Embedder.XICConfiguration>();

            CancelRequested = false;
            EmbedInProgress = false;

            if (Owner != null && StartPosition == FormStartPosition.CenterParent)
            {
                Location = new Point(Owner.Location.X + Owner.Width / 2 - Width / 2,
                                     Owner.Location.Y + Owner.Height / 2 - Height / 2);
            }

            base.OnLoad(e);

            Refresh();
        }
Exemple #3
0
        private void defaultXICSettingsButton_Click(object sender, EventArgs e)
        {
            var maxQValue        = 0.05;
            var mostRecentFilter = session.Query <PersistentDataFilter>().OrderByDescending(o => o.Id).FirstOrDefault();

            if (mostRecentFilter != null)
            {
                maxQValue = mostRecentFilter.MaximumQValue;
            }

            var quantitationSettingsForm = new QuantitationSettingsForm(_defaultXicConfig, _defaultIsobaricConfig, maxQValue);

            if (quantitationSettingsForm.ShowDialog() == DialogResult.OK)
            {
                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    var method = QuantitationMethodForRow(row.Index);
                    if (IsLabelFree(method))
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.XicConfig;
                    }
                    else if (IsIsobaric(method))
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.IsobaricConfig;
                    }
                    else
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = "n/a";
                    }
                }
                _defaultIsobaricConfig = quantitationSettingsForm.IsobaricConfig;
                _defaultXicConfig      = quantitationSettingsForm.XicConfig;
            }
        }
Exemple #4
0
 public QuantitationSettingsForm(Embedder.XICConfiguration oldXicConfig, Embedder.QuantitationConfiguration oldIsobaricConfig, double maxQValue)
 {
     XicConfig      = oldXicConfig;
     IsobaricConfig = oldIsobaricConfig;
     _maxQValue     = maxQValue;
     InitializeComponent();
 }
Exemple #5
0
        private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var maxQValue        = 0.05;
            var mostRecentFilter = session.Query <PersistentDataFilter>().OrderByDescending(o => o.Id).FirstOrDefault();

            if (mostRecentFilter != null)
            {
                maxQValue = mostRecentFilter.MaximumQValue;
            }

            if (e.ColumnIndex == quantitationSettingsColumn.Index)
            {
                var row    = dataGridView.Rows[e.RowIndex];
                var method = QuantitationMethodForRow(e.RowIndex);
                if (method == QuantitationMethod.None)
                {
                    return;
                }

                var currentXicConfig          = new Embedder.XICConfiguration();
                var currentQuantitationConfig = new Embedder.QuantitationConfiguration();
                if (IsLabelFree(method))
                {
                    currentXicConfig = (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.XICConfiguration) ?? currentXicConfig;

                    var quantSettingsForm = new QuantitationSettingsForm((row.Cells[quantitationSettingsColumn.Index].Value as Embedder.XICConfiguration), _defaultIsobaricConfig, maxQValue);
                    if (quantSettingsForm.ShowDialog() == DialogResult.OK)
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantSettingsForm.XicConfig;
                        _xicConfigBySource[e.RowIndex] = quantSettingsForm.XicConfig;
                    }
                }
                else if (IsIsobaric(method))
                {
                    currentQuantitationConfig = (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.QuantitationConfiguration) ?? currentQuantitationConfig;

                    var quantSettingsForm = new QuantitationSettingsForm(_defaultXicConfig, (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.QuantitationConfiguration), maxQValue);
                    if (quantSettingsForm.ShowDialog() == DialogResult.OK)
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantSettingsForm.IsobaricConfig;
                        _isobaricConfigBySource[e.RowIndex] = quantSettingsForm.IsobaricConfig;
                    }
                }
            }
        }
Exemple #6
0
        public override void Refresh()
        {
            Text = "Embed Subset Spectra";
            Application.UseWaitCursor = false;

            dataGridView.SuspendLayout();
            dataGridView.Rows.Clear();

            var rows = session.CreateSQLQuery(
                "SELECT ss.Id, Name, COUNT(s.Id), IFNULL((SELECT LENGTH(MsDataBytes) FROM SpectrumSourceMetadata WHERE Id=ss.Id), 0), MIN(IFNULL(s.ScanTimeInSeconds, 0)), QuantitationMethod, IFNULL(QuantitationSettings, '') " +
                "FROM SpectrumSource ss " +
                "JOIN UnfilteredSpectrum s ON ss.Id=Source " +
                "GROUP BY ss.Id")
                       .List <object[]>()
                       .Select(o => new
            {
                Id                      = Convert.ToInt32(o[0]),
                Name                    = (string)o[1],
                Spectra                 = Convert.ToInt32(o[2]),
                EmbeddedSize            = Convert.ToInt32(o[3]),
                MinScanTime             = Convert.ToDouble(o[4]),
                QuantitationMethodIndex = Convert.ToInt32(o[5]),
                QuantitationSettings    = (string)o[6]
            });

            hasEmbeddedSources = hasNonEmbeddedSources = false;

            _isobaricConfigBySource.Clear();
            _xicConfigBySource.Clear();

            foreach (var row in rows)
            {
                string status;
                if (row.EmbeddedSize > 0)
                {
                    status             = String.Format("{0} spectra embedded ({1} bytes)", row.Spectra, row.EmbeddedSize);
                    hasEmbeddedSources = true;
                }
                else if (row.QuantitationMethodIndex != 0)
                {
                    status                = String.Format("{0} spectra with quantitation", row.Spectra);
                    hasEmbeddedSources    = true;
                    hasNonEmbeddedSources = true;
                }
                else if (row.MinScanTime > 0)
                {
                    status                = String.Format("{0} spectra with scan times", row.Spectra);
                    hasEmbeddedSources    = true;
                    hasNonEmbeddedSources = true;
                }
                else
                {
                    status = "not embedded";
                    hasNonEmbeddedSources = true;
                }

                var quantitationMethod = (QuantitationMethod)row.QuantitationMethodIndex;

                if (IsLabelFree(quantitationMethod))
                {
                    var savedSettings = new Embedder.XICConfiguration(row.QuantitationSettings);
                    _xicConfigBySource[row.Id] = savedSettings;
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], savedSettings);
                }
                else if (IsIsobaric(quantitationMethod))
                {
                    var savedSettings = new Embedder.QuantitationConfiguration(quantitationMethod, row.QuantitationSettings);
                    _isobaricConfigBySource[row.Id] = savedSettings;
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], savedSettings);
                }
                else
                {
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], "n/a");
                }
            }

            dataGridView.ResumeLayout();

            if (dataGridView.Rows.Cast <DataGridViewRow>().Any(x => x.Cells[quantitationMethodColumn.Index].Value.ToString() != "None"))
            {
                embedScanTimeOnlyBox.Text = "Embed scan times and quantitation only";
            }
            else
            {
                embedScanTimeOnlyBox.Text = "Embed scan times only";
            }

            deleteAllButton.Enabled = hasEmbeddedSources;
            embedAllButton.Enabled  = hasNonEmbeddedSources;
            okButton.Text           = "Close";
            okButton.Enabled        = true;

            CancelRequested = false;
            EmbedInProgress = false;

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
            }

            base.Refresh();
        }
Exemple #7
0
        protected override void OnLoad (EventArgs e)
        {
            searchPathTextBox.Text = String.Join(";", Util.StringCollectionToStringArray(Properties.Settings.Default.SourcePaths));
            extensionsTextBox.Text = Properties.Settings.Default.SourceExtensions;
            embeddedChanges = false;

            // TODO: set these from global defaults?
            _defaultIsobaricConfig = new Embedder.QuantitationConfiguration() { QuantitationMethod = QuantitationMethod.ITRAQ4plex };
            _defaultXicConfig = new Embedder.XICConfiguration();

            _isobaricConfigBySource = new Dictionary<int, Embedder.QuantitationConfiguration>();
            _xicConfigBySource = new Dictionary<int, Embedder.XICConfiguration>();

            CancelRequested = false;
            EmbedInProgress = false;

            if (Owner != null && StartPosition == FormStartPosition.CenterParent)
                Location = new Point(Owner.Location.X + Owner.Width / 2 - Width / 2,
                                     Owner.Location.Y + Owner.Height / 2 - Height / 2);

            base.OnLoad(e);

            Refresh();
        }
Exemple #8
0
        private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var maxQValue = 0.05;
            var mostRecentFilter = session.Query<PersistentDataFilter>().OrderByDescending(o => o.Id).FirstOrDefault();
            if (mostRecentFilter != null)
                maxQValue = mostRecentFilter.MaximumQValue;

            if (e.ColumnIndex == quantitationSettingsColumn.Index)
            {
                var row = dataGridView.Rows[e.RowIndex];
                var method = QuantitationMethodForRow(e.RowIndex);
                if (method == QuantitationMethod.None)
                    return;

                var currentXicConfig = new Embedder.XICConfiguration();
                var currentQuantitationConfig = new Embedder.QuantitationConfiguration();
                if (IsLabelFree(method))
                {
                    currentXicConfig = (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.XICConfiguration) ?? currentXicConfig;

                    var quantSettingsForm = new QuantitationSettingsForm((row.Cells[quantitationSettingsColumn.Index].Value as Embedder.XICConfiguration), _defaultIsobaricConfig, maxQValue);
                    if (quantSettingsForm.ShowDialog() == DialogResult.OK)
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantSettingsForm.XicConfig;
                        _xicConfigBySource[e.RowIndex] = quantSettingsForm.XicConfig;
                    }
                }
                else if (IsIsobaric(method))
                {
                    currentQuantitationConfig = (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.QuantitationConfiguration) ?? currentQuantitationConfig;

                    var quantSettingsForm = new QuantitationSettingsForm(_defaultXicConfig, (row.Cells[quantitationSettingsColumn.Index].Value as Embedder.QuantitationConfiguration), maxQValue);
                    if (quantSettingsForm.ShowDialog() == DialogResult.OK)
                    {
                        row.Cells[quantitationSettingsColumn.Index].Value = quantSettingsForm.IsobaricConfig;
                        _isobaricConfigBySource[e.RowIndex] = quantSettingsForm.IsobaricConfig;
                    }
                }
            }
        }
Exemple #9
0
        private void defaultXICSettingsButton_Click(object sender, EventArgs e)
        {
            var maxQValue = 0.05;
            var mostRecentFilter = session.Query<PersistentDataFilter>().OrderByDescending(o => o.Id).FirstOrDefault();
            if (mostRecentFilter != null)
                maxQValue = mostRecentFilter.MaximumQValue;

            var quantitationSettingsForm = new QuantitationSettingsForm(_defaultXicConfig, _defaultIsobaricConfig, maxQValue);
            if (quantitationSettingsForm.ShowDialog() == DialogResult.OK)
            {
                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    var method = QuantitationMethodForRow(row.Index);
                    if (IsLabelFree(method))
                        row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.XicConfig;
                    else if (IsIsobaric(method))
                        row.Cells[quantitationSettingsColumn.Index].Value = quantitationSettingsForm.IsobaricConfig;
                    else
                        row.Cells[quantitationSettingsColumn.Index].Value = "n/a";
                }
                _defaultIsobaricConfig = quantitationSettingsForm.IsobaricConfig;
                _defaultXicConfig = quantitationSettingsForm.XicConfig;
            }
        }
Exemple #10
0
        public override void Refresh ()
        {
            Text = "Embed Subset Spectra";
            Application.UseWaitCursor = false;

            dataGridView.SuspendLayout();
            dataGridView.Rows.Clear();

            var rows = session.CreateSQLQuery(
                "SELECT ss.Id, Name, COUNT(s.Id), IFNULL((SELECT LENGTH(MsDataBytes) FROM SpectrumSourceMetadata WHERE Id=ss.Id), 0), MIN(IFNULL(s.ScanTimeInSeconds, 0)), QuantitationMethod, IFNULL(QuantitationSettings, '') " +
                "FROM SpectrumSource ss " +
                "JOIN UnfilteredSpectrum s ON ss.Id=Source " +
                "GROUP BY ss.Id")
                              .List<object[]>()
                              .Select(o => new
                                  {
                                      Id = Convert.ToInt32(o[0]),
                                      Name = (string) o[1],
                                      Spectra = Convert.ToInt32(o[2]),
                                      EmbeddedSize = Convert.ToInt32(o[3]),
                                      MinScanTime = Convert.ToDouble(o[4]),
                                      QuantitationMethodIndex = Convert.ToInt32(o[5]),
                                      QuantitationSettings = (string) o[6]
                                  });

            hasEmbeddedSources = hasNonEmbeddedSources = false;

            _isobaricConfigBySource.Clear();
            _xicConfigBySource.Clear();

            foreach (var row in rows)
            {
                string status;
                if (row.EmbeddedSize > 0)
                {
                    status = String.Format("{0} spectra embedded ({1} bytes)", row.Spectra, row.EmbeddedSize);
                    hasEmbeddedSources = true;
                }
                else if (row.QuantitationMethodIndex != 0)
                {
                    status = String.Format("{0} spectra with quantitation", row.Spectra);
                    hasEmbeddedSources = true;
                    hasNonEmbeddedSources = true;
                }
                else if (row.MinScanTime > 0)
                {
                    status = String.Format("{0} spectra with scan times", row.Spectra);
                    hasEmbeddedSources = true;
                    hasNonEmbeddedSources = true;
                }
                else
                {
                    status = "not embedded";
                    hasNonEmbeddedSources = true;
                }

                var quantitationMethod = (QuantitationMethod) row.QuantitationMethodIndex;

                if (IsLabelFree(quantitationMethod))
                {
                    var savedSettings = new Embedder.XICConfiguration(row.QuantitationSettings);
                    _xicConfigBySource[row.Id] = savedSettings;
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], savedSettings);
                }
                else if (IsIsobaric(quantitationMethod))
                {
                    var savedSettings = new Embedder.QuantitationConfiguration(quantitationMethod, row.QuantitationSettings);
                    _isobaricConfigBySource[row.Id] = savedSettings;
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], savedSettings);
                }
                else
                    dataGridView.Rows.Add(row.Id, row.Name, status, quantitationMethodColumn.Items[row.QuantitationMethodIndex], "n/a");
            }

            dataGridView.ResumeLayout();

            if (dataGridView.Rows.Cast<DataGridViewRow>().Any(x => x.Cells[quantitationMethodColumn.Index].Value.ToString() != "None"))
                embedScanTimeOnlyBox.Text = "Embed scan times and quantitation only";
            else
                embedScanTimeOnlyBox.Text = "Embed scan times only";

            deleteAllButton.Enabled = hasEmbeddedSources;
            embedAllButton.Enabled = hasNonEmbeddedSources;
            okButton.Text = "Close";
            okButton.Enabled = true;

            CancelRequested = false;
            EmbedInProgress = false;

            if (TaskbarManager.IsPlatformSupported)
                TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);

            base.Refresh();
        }
        private void StartButton_Click(object sender, EventArgs e)
        {
            var cloValue = (double)ChromatogramMzLowerOffsetValueBox.Value;
            var cloUnits = (MZTolerance.Units)ChromatogramMzLowerOffsetUnitsBox.SelectedIndex;
            var cuoValue = (double)ChromatogramMzUpperOffsetValueBox.Value;
            var cuoUnits = (MZTolerance.Units)ChromatogramMzUpperOffsetUnitsBox.SelectedIndex;
            var rtMax = (int)Math.Round(RTTolUpperBox.Value);
            var rtMin = (int)Math.Round(RTTolLowerBox.Value);
            var maMax = (int)Math.Round(MonoisotopicAdjustmentMaxBox.Value);
            var maMin = (int)Math.Round(MonoisotopicAdjustmentMinBox.Value);
            XicConfig = new Embedder.XICConfiguration{
                ChromatogramMzLowerOffset = new MZTolerance(cloValue, cloUnits),
                ChromatogramMzUpperOffset = new MZTolerance(cuoValue, cuoUnits),
                RetentionTimeLowerTolerance = rtMin,
                RetentionTimeUpperTolerance = rtMax,
                MonoisotopicAdjustmentMax = maMax,
                MonoisotopicAdjustmentMin = maMin,
                MaxQValue = _maxQValue,
                AlignRetentionTime = RTAlignBox.Checked};

            IsobaricConfig = new Embedder.QuantitationConfiguration
            {
                QuantitationMethod = IsobaricConfig.QuantitationMethod,
                ReporterIonMzTolerance = new MZTolerance((double) reporterIonToleranceUpDown.Value, (MZTolerance.Units) reporterIonToleranceUnits.SelectedIndex),
                NormalizeIntensities = normalizeReporterIonsCheckBox.Checked
            };

            DialogResult = DialogResult.OK;
        }