private IEnumerable <TextSequence> GetTextSequencesForSelfAndChildren( DisplayModificationOption displayModificationOption) { return(Enumerable.Range(0, UnmodifiedSequence.Length) .Select(i => GetTextSequenceAtAaIndex(displayModificationOption, i)) .Concat(GetTextSequencesForLinkedPeptides(displayModificationOption))); }
public IEnumerable <TextSequence> GetTextSequencesForLinkedPeptides(DisplayModificationOption displayModificationOption) { var result = new List <TextSequence>(); if (LinkedPeptides.Count == 0) { return(result); } result.Add(new TextSequence { Color = Color.Black, Font = ModFontHolder.Plain, Text = STR_WIDE_DASH }); if (LinkedPeptides.Count > 1) { result.Add(new TextSequence { Color = Color.Black, Font = ModFontHolder.Plain, Text = @"[" }); } bool first = true; foreach (var linkedPeptide in LinkedPeptides.Values) { if (!first) { result.Add(new TextSequence { Color = Color.Black, Font = ModFontHolder.Plain, Text = @"," }); } first = false; result.AddRange(linkedPeptide.GetTextSequencesForSelfAndChildren(displayModificationOption)); } if (LinkedPeptides.Count > 1) { result.Add(new TextSequence { Color = Color.Black, Font = ModFontHolder.Plain, Text = @"]" }); } return(result); }
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 }); }
GetModificationsAtResidue(DisplayModificationOption displayModificationOption, int residue) { var mods = ImmutableList.ValueOf(_lightSequenceInfo.ModificationsByResidue[residue]); if (displayModificationOption.IgnoreZeroMassMods) { mods = ImmutableList.ValueOf(mods.Where(mod => mod.MonoisotopicMass != 0 || mod.AverageMass != 0)); } if (mods.Any()) { yield return(Tuple.Create(IsotopeLabelType.light, mods)); } foreach (var entry in _heavySequenceInfos) { mods = ImmutableList.ValueOf(entry.Item2.ModificationsByResidue[residue]); if (mods.Any()) { yield return(Tuple.Create(entry.Item1, mods)); } } }
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 }); }