public PeptideGroupDocNode UpdateMoleculeGroup(PeptideGroupDocNode peptideGroupDocNode) { CheckCancelled(); AnnotationUpdater updater; var identityPath = new IdentityPath(peptideGroupDocNode.PeptideGroup); if (_annotationUpdaters.TryGetValue(AnnotationDef.AnnotationTarget.protein, out updater)) { var protein = new Protein(SkylineDataSchema, identityPath); var annotations = updater.UpdateAnnotations(peptideGroupDocNode.Annotations, protein); if (!Equals(annotations, peptideGroupDocNode.Annotations)) { peptideGroupDocNode = (PeptideGroupDocNode)peptideGroupDocNode.ChangeAnnotations(annotations); } } if (!RecurseMolecules) { return(peptideGroupDocNode); } var newChildren = peptideGroupDocNode.Molecules .Select(peptideDocNode => UpdateMolecule(identityPath, peptideDocNode)).ToArray(); if (!ArrayUtil.ReferencesEqual(peptideGroupDocNode.Children, newChildren)) { peptideGroupDocNode = (PeptideGroupDocNode)peptideGroupDocNode.ChangeChildren(newChildren); } return(peptideGroupDocNode); }
private PeptideGroupDocNode DeletePeptides( PeptideGroupDocNode peptideGroupDocNode, HashSet <IdentityPath> identityPathsToDelete) { var newPeptides = new List <PeptideDocNode>(); foreach (var peptide in peptideGroupDocNode.Molecules) { var identityPath = new IdentityPath(peptideGroupDocNode.Id, peptide.Id); if (!identityPathsToDelete.Contains(identityPath)) { newPeptides.Add(peptide); } } if (newPeptides.Count == peptideGroupDocNode.MoleculeCount) { return(peptideGroupDocNode); } return((PeptideGroupDocNode)peptideGroupDocNode.ChangeChildren(newPeptides.Cast <DocNode>().ToArray())); }