Пример #1
0
        public TextSequence GetTextSequenceAtAaIndex(int residue)
        {
            Font   font         = ModFontHolder.Plain;
            Color  color        = Color.Black;
            String strAminoAcid = UnmodifiedSequence.Substring(residue, 1);

            var modsAtResidue = GetModificationsAtResidue(residue).ToArray();

            if (modsAtResidue.Length == 0)
            {
                return(new TextSequence
                {
                    Color = color,
                    Font = font,
                    Text = strAminoAcid
                });
            }

            var firstEntry = modsAtResidue[0];

            color = ModFontHolder.GetModColor(firstEntry.Item1);
            if (modsAtResidue.Skip(1).All(entry => entry.Item2.Equals(firstEntry.Item2)))
            {
                font = ModFontHolder.GetModFont(firstEntry.Item1);
                return(new TextSequence
                {
                    Color = color,
                    Font = font,
                    Text = strAminoAcid + DisplayModificationOption.GetModificationText(SrmSettings, firstEntry.Item2)
                });
            }

            font = IsotopeLabelType.light.Equals(firstEntry.Item1)
                ? ModFontHolder.LightAndHeavy
                : ModFontHolder.GetModFont(firstEntry.Item1);
            string modText;

            if (DisplayModificationOption == DisplayModificationOption.NOT_SHOWN)
            {
                modText = strAminoAcid;
            }
            else
            {
                modText = strAminoAcid + @"[*]";
            }

            return(new TextSequence
            {
                Color = color,
                Font = font,
                Text = modText
            });
        }
Пример #2
0
        /// <summary>
        /// Creates a text sequence with the fully modified peptide sequence text
        /// and font information for a given label type.
        /// </summary>
        private static TextSequence CreateTypeTextSequence(PeptideDocNode nodePep, SrmSettings settings,
                                                           IsotopeLabelType labelType, ModFontHolder fonts)
        {
            var calc = settings.TryGetPrecursorCalc(labelType, nodePep.ExplicitMods);

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

            return(new TextSequence
            {
                Text = nodePep.IsProteomic
                               ? calc.GetModifiedSequence(nodePep.Peptide.Target, SequenceModFormatType.mass_diff_narrow, false).Sequence
                               : nodePep.CustomMolecule.DisplayName,
                Font = fonts.GetModFont(labelType),
                Color = ModFontHolder.GetModColor(labelType)
            });
        }
Пример #3
0
        /// <summary>
        /// Creates a text sequence with the fully modified peptide sequence text
        /// and font information for a given label type.
        /// </summary>
        private static TextSequence CreateTypeTextSequence(PeptideDocNode nodePep, SrmSettings settings,
                                                           IsotopeLabelType labelType, ModFontHolder fonts)
        {
            var calc = settings.TryGetPrecursorCalc(labelType, nodePep.ExplicitMods);

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

            return(new TextSequence
            {
                Text = nodePep.IsProteomic
                               ? calc.GetModifiedSequence(nodePep.Peptide.Sequence, true)
                               : nodePep.CustomIon.DisplayName,
                Font = fonts.GetModFont(labelType),
                Color = ModFontHolder.GetModColor(labelType)
            });
        }
Пример #4
0
        private void UpdateAminoAcidLabel(int indexAA)
        {
            if (indexAA >= _listLabelAA.Count)
            {
                return;
            }

            FontStyle fontStyle = FontStyle.Regular;
            Color     textColor = Color.Black;

            if (!string.IsNullOrEmpty((string)_listComboStatic[indexAA].SelectedItem))
            {
                fontStyle = FontStyle.Bold | FontStyle.Underline;
            }

            for (int i = 0; i < _listListComboHeavy.Count; i++)
            {
                if (!string.IsNullOrEmpty((string)_listListComboHeavy[i][indexAA].SelectedItem))
                {
                    fontStyle |= FontStyle.Bold;
                    textColor  = ModFontHolder.GetModColor(_listLabelTypeHeavy[i]);
                    break;
                }
            }

            var label = _listLabelAA[indexAA];

            if (label.Font.Style != fontStyle)
            {
                label.Font = new Font(label.Font.Name, label.Font.SizeInPoints,
                                      fontStyle, GraphicsUnit.Point, 0);
            }

// ReSharper disable RedundantCheckBeforeAssignment
            if (label.ForeColor != textColor)
            {
                label.ForeColor = textColor;
            }
// ReSharper restore RedundantCheckBeforeAssignment
        }
Пример #5
0
        public TextSequence GetTextSequenceAtAaIndex(DisplayModificationOption displayModificationOption, int residue)
        {
            Font   font         = ModFontHolder.Plain;
            Color  color        = Color.Black;
            string strAminoAcid = UnmodifiedSequence.Substring(residue, 1);

            var modsAtResidue = GetModificationsAtResidue(displayModificationOption, residue).ToArray();

            if (residue == CrosslinkedIndexAa ||
                modsAtResidue.Any(labeledMod => labeledMod.Item2.Any(mod => mod.ExplicitMod.LinkedPeptide != null)) ||
                _lightSequenceInfo.LooplinkSites.Contains(residue))
            {
                return(new TextSequence
                {
                    Color = COLOR_CROSSLINK,
                    Font = ModFontHolder.LightAndHeavy,
                    Text = strAminoAcid
                });
            }
            if (modsAtResidue.Length == 0)
            {
                return(new TextSequence
                {
                    Color = color,
                    Font = font,
                    Text = strAminoAcid
                });
            }

            var firstEntry = modsAtResidue[0];

            color = ModFontHolder.GetModColor(firstEntry.Item1);
            var firstMismatch = modsAtResidue.Skip(1).FirstOrDefault(entry => !entry.Item2.Equals(firstEntry.Item2));

            if (firstMismatch == null)
            {
                font = ModFontHolder.GetModFont(firstEntry.Item1);
                return(new TextSequence
                {
                    Color = color,
                    Font = font,
                    Text = strAminoAcid + displayModificationOption.GetModificationText(SrmSettings, firstEntry.Item2)
                });
            }

            if (IsotopeLabelType.light.Equals(firstEntry.Item1))
            {
                font  = ModFontHolder.LightAndHeavy;
                color = ModFontHolder.GetModColor(firstMismatch.Item1);
            }
            else
            {
                font = ModFontHolder.LightAndHeavy;
            }
            string modText;

            if (displayModificationOption == DisplayModificationOption.NOT_SHOWN)
            {
                modText = strAminoAcid;
            }
            else
            {
                modText = strAminoAcid + @"[*]";
            }

            return(new TextSequence
            {
                Color = color,
                Font = font,
                Text = modText
            });
        }