private void tvMRM_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (displaying)
            {
                return;
            }

            DoUpdatePeptide();

            var node = tvMRM.SelectedNode;

            if (null == node || node.Level != 2)
            {
                return;
            }

            //设置当前product ion
            SrmPairedProductIon  item = node.Tag as SrmPairedProductIon;
            SrmPairedPeptideItem pep  = node.Parent.Tag as SrmPairedPeptideItem;

            int             rowIndex = pep.ProductIonPairs.IndexOf(item);
            CurrencyManager cm       = (CurrencyManager)this.BindingContext[pep.ProductIonPairs];

            if (cm.Position != rowIndex)
            {
                cm.Position = rowIndex;
            }
        }
        private void tvMRM_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (displaying)
            {
                return;
            }

            var node = e.Node;

            if (node.Level == 0)
            {
                return;
            }

            if (node.Level == 1)
            {
                SrmPairedPeptideItem pepItem = node.Tag as SrmPairedPeptideItem;
                pepItem.Enabled = node.Checked;
                return;
            }

            if (node.Level == 2)
            {
                SrmPairedProductIon item = node.Tag as SrmPairedProductIon;
                item.Enabled = node.Checked;

                SrmPairedPeptideItem pepItem = node.Parent.Tag as SrmPairedPeptideItem;
                pepItem.CalculatePeptideRatio();
            }

            tvMRM_AfterSelect(null, null);

            SetCurrentResultModified();
        }
        public bool ProductIonEquals(SrmPairedProductIon another, double mzTolerance)
        {
            if (this.Light != null && another.Light != null)
            {
                if (Math.Abs(this.Light.ProductIon - another.Light.ProductIon) > mzTolerance)
                {
                    return(false);
                }
            }
            else if (this.Light != null || another.Light != null)
            {
                return(false);
            }

            if (this.Heavy != null && another.Heavy != null)
            {
                if (Math.Abs(this.Heavy.ProductIon - another.Heavy.ProductIon) > mzTolerance)
                {
                    return(false);
                }
            }
            else if (this.Heavy != null || another.Heavy != null)
            {
                return(false);
            }

            return(true);
        }
        private void mnuSetScanEnabledOnly_Click(object sender, EventArgs e)
        {
            GraphPane graphScans = mnuSetScanEnabledOnly.Tag as GraphPane;
            double    min        = graphScans.XAxis.Scale.Min;
            double    max        = graphScans.XAxis.Scale.Max;

            SrmPairedProductIon  ion  = graphScans.Tag as SrmPairedProductIon;
            SrmPairedPeptideItem item = FindItemByProductIon(ion);

            if (null == item)
            {
                return;
            }

            item.SetEnabledRetentionTimeRange(min, max);

            CurrentResult.Update(item);

            gvProductPair.Refresh();

            DoUpdateProductIon();

            tvMRM_AfterSelect(null, null);

            SetCurrentResultModified();
        }
 public SrmFileItem(SrmPairedResult result, SrmPairedPeptideItem peptide, SrmPairedProductIon production)
 {
     this.PairedResult     = result;
     this.PairedPeptide    = peptide;
     this.PairedProductIon = production;
     _precursorMz          = new Pair <double, double>(peptide.LightPrecursorMZ, peptide.HeavyPrecursorMZ);
     _productIonMz         = new Pair <double, double>(production.LightProductIon, production.HeavyProductIon);
 }
        private SrmFileItem GetFileModeItem()
        {
            CurrencyManager cm = (CurrencyManager)this.BindingContext[filePeptide.ProductIonPairs];

            SrmPairedProductIon item = cm.Current as SrmPairedProductIon;

            var fileItem = files.FindFileItem(item);

            return(fileItem);
        }
Exemplo n.º 7
0
        public bool Accept(SrmPairedProductIon t)
        {
            foreach (var filter in filters)
            {
                if (!filter.Accept(t))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 8
0
        private void mnuSetScanEnabledOnly_Click(object sender, EventArgs e)
        {
            GraphPane graphScans = mnuSetScanEnabledOnly.Tag as GraphPane;
            double    min        = graphScans.XAxis.Scale.Min;
            double    max        = graphScans.XAxis.Scale.Max;

            SrmPairedProductIon ion = graphScans.Tag as SrmPairedProductIon;

            var item = allFiles.Items.Find(m => m.PairedProductIon == ion);

            item.PairedPeptide.SetEnabledRetentionTimeRange(min, max);

            item.PairedResult.Update(item.PairedPeptide);

            item.PairedResult.Modified = true;

            gvFiles.Refresh();
            UpdateGraph();
        }
        private SrmPairedProductIon DoUpdateProductIon()
        {
            var pep = GetPeptide();

            if (pep == null)
            {
                return(null);
            }

            CurrencyManager     cm   = (CurrencyManager)this.BindingContext[pep.ProductIonPairs];
            SrmPairedProductIon item = cm.Current as SrmPairedProductIon;
            UpdateMRMPairedProductIonEventArgs args = new UpdateMRMPairedProductIonEventArgs(item, new SrmViewOption()
            {
                ViewGreenLine = true, ViewType = lastType
            });

            OnUpdateProductIon(args);

            return(item);
        }
        private void tvMRM_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var node = tvMRM.SelectedNode;

            if (null == node)
            {
                gvProductPair.DataSource = null;
                return;
            }

            SrmPairedPeptideItem pep;

            if (0 == node.Level)
            {
                pep = DoUpdatePeptide();

                if (gvProductPair.DataSource != pep.ProductIonPairs)
                {
                    gvProductPair.DataSource = pep.ProductIonPairs;
                }
            }
            else
            {
                SrmPairedProductIon item = node.Tag as SrmPairedProductIon;
                pep = node.Parent.Tag as SrmPairedPeptideItem;

                if (gvProductPair.DataSource != pep.ProductIonPairs)
                {
                    DoUpdatePeptide();

                    gvProductPair.DataSource = pep.ProductIonPairs;
                }

                int             rowIndex = pep.ProductIonPairs.IndexOf(item);
                CurrencyManager cm       = (CurrencyManager)this.BindingContext[pep.ProductIonPairs];
                if (cm.Position != rowIndex)
                {
                    cm.Position = rowIndex;
                }
            }
        }
        private void SetTreeSelected(SrmPairedProductIon item)
        {
            if (tvMRM.SelectedNode.Level < 2)
            {
                return;
            }

            if (tvMRM.SelectedNode.Tag == item)
            {
                return;
            }

            TreeNode root = tvMRM.SelectedNode.Parent;

            for (int i = 0; i < root.Nodes.Count; i++)
            {
                if (root.Nodes[i].Tag == item)
                {
                    tvMRM.SelectedNode = root.Nodes[i];
                    return;
                }
            }
        }
        private void mnuSetScanEnabledOnlyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GraphPane graphScans = mnuSetScanEnabledOnlyToolStripMenuItem.Tag as GraphPane;
            double    min        = graphScans.XAxis.Scale.Min;
            double    max        = graphScans.XAxis.Scale.Max;

            SrmPairedProductIon  ion  = graphScans.Tag as SrmPairedProductIon;
            SrmPairedPeptideItem item = FindItemByProductIon(ion);

            if (null == item)
            {
                return;
            }

            item.SetEnabledRetentionTimeRange(min, max);

            mrmPairs.Update(item);

            UpdateProductPairs();

            DoUpdateProductIon();

            tvMRM_AfterSelect(null, null);
        }
        private void mnuSetScanEnabledOnly_Click(object sender, EventArgs e)
        {
            GraphPane graphScans = mnuSetScanEnabledOnly.Tag as GraphPane;
            double    min        = graphScans.XAxis.Scale.Min;
            double    max        = graphScans.XAxis.Scale.Max;

            SrmPairedPeptideItem item;
            SrmFileItem          fileitem;

            if (graphScans.Tag is SrmPairedProductIon)
            {
                SrmPairedProductIon ion = graphScans.Tag as SrmPairedProductIon;

                fileitem = files.FindFileItem(ion);
                item     = fileitem.PairedPeptide;
            }
            else
            {
                item     = graphScans.Tag as SrmPairedPeptideItem;
                fileitem = files.FindFileItem(item.ProductIonPairs.First(m => m != null));
            }

            item.SetEnabledRetentionTimeRange(min, max);

            fileitem.PairedResult.Update(item);
            fileitem.PairedResult.Modified = true;

            DoDataChanged(true);

            gvProductPair.Refresh();
            DoUpdateFileModeProductIon();
            DoUpdateFileModePeptide();

            gvFiles.Refresh();
            DoUpdateCompoundGraph();
        }
Exemplo n.º 14
0
 public bool Accept(SrmPairedProductIon t)
 {
     return((t.Light == null || t.LightSignalToNoise >= minSignalToNoise) &&
            (t.Heavy == null || t.HeavySignalToNoise >= minSignalToNoise));
 }
Exemplo n.º 15
0
        private SrmPairedPeptideItem ItemToPeptide(XElement item)
        {
            if (item == null)
            {
                return(null);
            }

            SrmPairedPeptideItem result = new SrmPairedPeptideItem();

            result.Enabled = Convert.ToBoolean(item.Element("Enabled").Value);

            result.ProductIonPairs = new List <SrmPairedProductIon>();
            foreach (var p in item.Descendants("ProductIonPair"))
            {
                SrmPairedProductIon ion = new SrmPairedProductIon();

                ion.Enabled  = Convert.ToBoolean(p.Element("Enabled").Value);
                ion.Ratio    = MyConvert.ToDouble(p.Element("Ratio").Value);
                ion.Distance = MyConvert.ToDouble(p.Element("Distance").Value);
                ion.RegressionCorrelation = MyConvert.ToDouble(p.Element("RegressionCorrelation").Value);

                var scanEle = p.Elements("Scan");
                if (scanEle.Count() > 0)
                {
                    var scans = (from a in scanEle
                                 select new SrmPairedScan()
                    {
                        Light = SrmScanFileFormat.ElementToScan(a.Element("Light")),
                        Heavy = SrmScanFileFormat.ElementToScan(a.Element("Heavy"))
                    }).ToList();

                    if (scans.Count > 0)
                    {
                        if (scans[0].Light != null)
                        {
                            var light = new SrmTransition(scans[0].Light.PrecursorMz, scans[0].Light.ProductMz);
                            light.Intensities = (from s in scans
                                                 select s.Light).ToList();
                            ion.Light = light;
                        }

                        if (scans[0].Heavy != null)
                        {
                            var heavy = new SrmTransition(scans[0].Heavy.PrecursorMz, scans[0].Heavy.ProductMz);
                            heavy.Intensities = (from s in scans
                                                 select s.Heavy).ToList();
                            ion.Heavy = heavy;
                        }
                    }
                }
                else
                {
                    ion.Light = ElementToTransaction(p.Element("LightTransaction"));
                    ion.Heavy = ElementToTransaction(p.Element("HeavyTransaction"));
                }

                if (p.Element("LightArea") != null)
                {
                    ion.LightArea = MyConvert.ToDouble(p.Element("LightArea").Value);
                    ion.HeavyArea = MyConvert.ToDouble(p.Element("HeavyArea").Value);
                }

                result.ProductIonPairs.Add(ion);
            }

            if (item.Element("Ratio") != null)
            {
                result.Ratio = MyConvert.ToDouble(item.Element("Ratio").Value);
                if (item.Element("SD").Value.Equals("-"))
                {
                    result.SD = double.NaN;
                }
                else
                {
                    result.SD = MyConvert.ToDouble(item.Element("SD").Value);
                }
            }
            else
            {
                result.CalculatePeptideRatio();
            }

            var objname   = string.Empty;
            var pepname   = string.Empty;
            var pepcharge = 0;

            if (item.Element("ObjectName") != null)
            {
                objname = item.Element("ObjectName").Value;
            }

            if (item.Element("PrecursorFormula") != null)
            {
                pepname = item.Element("PrecursorFormula").Value;
            }

            if (item.Element("PrecursorCharge") != null)
            {
                pepcharge = int.Parse(item.Element("PrecursorCharge").Value);
            }

            result.ProductIonPairs.ForEach(m =>
            {
                if (m.Light != null)
                {
                    m.Light.ObjectName       = objname;
                    m.Light.PrecursorFormula = pepname;
                    m.Light.PrecursorCharge  = pepcharge;
                }

                if (m.Heavy != null)
                {
                    m.Heavy.ObjectName       = objname;
                    m.Heavy.PrecursorFormula = pepname;
                    m.Heavy.PrecursorCharge  = pepcharge;
                }
            });

            return(result);
        }
Exemplo n.º 16
0
 public bool Accept(SrmPairedProductIon t)
 {
     return(!t.IsPaired || t.Ratio > 0);
 }
Exemplo n.º 17
0
 public bool Accept(SrmPairedProductIon t)
 {
     return(t.EnabledScanCount >= minEnabledScan);
 }
 private SrmPairedPeptideItem FindItemByProductIon(SrmPairedProductIon ion)
 {
     return(CurrentResult.Find(m => m.ProductIonPairs.Contains(ion)));
 }
Exemplo n.º 19
0
 public bool Accept(SrmPairedProductIon t)
 {
     return(!t.IsPaired || t.RegressionCorrelation >= minCorrel);
 }
 public SrmFileItem FindFileItem(SrmPairedProductIon ion)
 {
     return((from s in Items
             where s.PairedProductIon == ion
             select s).FirstOrDefault());
 }
 public void SetHeavyIon(SrmPairedProductIon heavy)
 {
     this.Heavy = heavy.Light;
 }
Exemplo n.º 22
0
 public bool Accept(SrmPairedProductIon t)
 {
     return(t.EnabledRetentionWindow >= minRetentionWindow);
 }
 public UpdateMRMPairedProductIonEventArgs(SrmPairedProductIon item, SrmViewOption viewOption)
     : base()
 {
     this.Item       = item;
     this.ViewOption = viewOption;
 }