本文整理汇总了C#中SrmDocument.ChangePeak方法的典型用法代码示例。如果您正苦于以下问题:C# SrmDocument.ChangePeak方法的具体用法?C# SrmDocument.ChangePeak怎么用?C# SrmDocument.ChangePeak使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SrmDocument
的用法示例。
在下文中一共展示了SrmDocument.ChangePeak方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemovePeakInternal
private SrmDocument RemovePeakInternal(SrmDocument document, int resultsIndex, IdentityPath groupPath,
TransitionGroupDocNode nodeGroup, TransitionDocNode nodeTran)
{
ChromInfo chromInfo;
Transition transition;
if (nodeTran == null)
{
chromInfo = GetTransitionGroupChromInfo(nodeGroup, resultsIndex);
transition = null;
}
else
{
chromInfo = GetTransitionChromInfo(nodeTran, resultsIndex);
transition = nodeTran.Transition;
}
if (chromInfo == null)
return document;
MsDataFileUri filePath;
string name = GetGraphChromStrings(resultsIndex, chromInfo.FileId, out filePath);
return name == null
? document
: document.ChangePeak(groupPath, name, filePath, transition, 0, 0, UserSet.TRUE, PeakIdentification.FALSE, false);
}
示例2: PickPeak
/// <summary>
/// Modifies a document in response to the user clicking on a peak in the GraphChromatogram.
/// </summary>
private static SrmDocument PickPeak(SrmDocument document, PickedPeakEventArgs e)
{
document = document.ChangePeak(e.GroupPath, e.NameSet, e.FilePath, e.TransitionId, e.RetentionTime.MeasuredTime, UserSet.TRUE);
var activeTransitionGroup = (TransitionGroupDocNode) document.FindNode(e.GroupPath);
if (activeTransitionGroup.RelativeRT != RelativeRT.Matching)
{
return document;
}
var activeChromInfo = FindChromInfo(document, activeTransitionGroup, e.NameSet, e.FilePath);
var peptide = (PeptideDocNode) document.FindNode(e.GroupPath.Parent);
// See if there are any other transition groups that should have their peak bounds set to the same value
foreach (var transitionGroup in peptide.TransitionGroups)
{
if (transitionGroup.RelativeRT != RelativeRT.Matching)
{
continue;
}
var groupPath = new IdentityPath(e.GroupPath.Parent, transitionGroup.TransitionGroup);
if (Equals(groupPath, e.GroupPath))
{
continue;
}
var chromInfo = FindChromInfo(document, transitionGroup, e.NameSet, e.FilePath);
if (null == chromInfo)
{
continue;
}
document = document.ChangePeak(groupPath, e.NameSet, e.FilePath, null,
activeChromInfo.StartRetentionTime, activeChromInfo.EndRetentionTime, UserSet.TRUE, activeChromInfo.Identified, true);
}
return document;
}
示例3: RemoveMissing
/// <summary>
/// Removes peaks and annotations that were in the document but not in the file, so that all peptide results that were not explicitly imported as part of this file are now blank
/// </summary>
/// <param name="docNew">SrmDocument for which missing peaks should be removed</param>
/// <param name="trackAdjustedResults">List of peaks that were in the imported file</param>
/// <param name="changePeaks">If true, remove both peaks and annotations. If false, only remove annotations</param>
/// <returns></returns>
private SrmDocument RemoveMissing(SrmDocument docNew, ICollection<ResultsKey> trackAdjustedResults, bool changePeaks)
{
var measuredResults = docNew.Settings.MeasuredResults;
var chromatogramSets = measuredResults.Chromatograms;
for (int i = 0; i < chromatogramSets.Count; ++i)
{
var set = chromatogramSets[i];
var nameSet = set.Name;
for (int k = 0; k < docNew.MoleculeCount; ++k)
{
IdentityPath pepPath = docNew.GetPathTo((int)SrmDocument.Level.Molecules, k);
var pepNode = (PeptideDocNode)Document.FindNode(pepPath);
if (pepNode.IsDecoy)
continue;
if (pepNode.GlobalStandardType != null)
continue;
foreach (var groupNode in pepNode.TransitionGroups)
{
var groupPath = new IdentityPath(pepPath, groupNode.Id);
var chromInfos = groupNode.Results[i];
if (chromInfos == null)
continue;
foreach (var groupChromInfo in chromInfos)
{
if (groupChromInfo == null)
continue;
var key = new ResultsKey(groupChromInfo.FileId.GlobalIndex, groupNode.Id);
if (!trackAdjustedResults.Contains(key))
{
CountMissing++;
var fileId = groupChromInfo.FileId;
var fileInfo = set.GetFileInfo(fileId);
var filePath = fileInfo.FilePath;
// Remove annotations for defs that were imported into the document and were on this peptide prior to import
var newAnnotationValues = groupChromInfo.Annotations.ListAnnotations().ToList();
newAnnotationValues = newAnnotationValues.Where(a => !AnnotationsAdded.Contains(a.Key)).ToList();
var newAnnotations = new Annotations(groupChromInfo.Annotations.Note, newAnnotationValues, groupChromInfo.Annotations.ColorIndex);
var newGroupNode = groupNode.ChangePrecursorAnnotations(fileId, newAnnotations);
if (!ReferenceEquals(groupNode, newGroupNode))
docNew = (SrmDocument) docNew.ReplaceChild(groupPath.Parent, newGroupNode);
// Adjust peaks to null if they weren't in the file
if (changePeaks)
{
docNew = docNew.ChangePeak(groupPath, nameSet, filePath,
null, null, null, UserSet.IMPORTED, null, false);
}
}
}
}
}
}
return docNew;
}
示例4: ChangePeakBounds
/// <summary>
/// Modifies a document in response to a user's mouse dragging on a GraphChromatogram.
/// </summary>
private static SrmDocument ChangePeakBounds(SrmDocument document, IEnumerable<ChangedPeakBoundsEventArgs> changes)
{
var changedGroupIds = new HashSet<IdentityPath>();
var peptideChanges = new Dictionary<IdentityPath, ChangedPeakBoundsEventArgs>();
foreach (var change in changes)
{
document = document.ChangePeak(change.GroupPath, change.NameSet, change.FilePath, change.Transition,
change.StartTime.MeasuredTime, change.EndTime.MeasuredTime, UserSet.TRUE, change.Identified, false);
changedGroupIds.Add(change.GroupPath);
if (!peptideChanges.ContainsKey(change.GroupPath.Parent)) {
var transitionGroup = (TransitionGroupDocNode) document.FindNode(change.GroupPath);
if (transitionGroup.RelativeRT == RelativeRT.Matching)
{
peptideChanges.Add(change.GroupPath.Parent, change);
}
}
}
// See if there are any other TransitionGroups that also have RelativeRT matching,
// and set their peak boundaries to the same.
foreach (var entry in peptideChanges)
{
var peptide = (PeptideDocNode) document.FindNode(entry.Key);
var change = entry.Value;
foreach (var transitionGroup in peptide.TransitionGroups)
{
if (transitionGroup.RelativeRT != RelativeRT.Matching)
{
continue;
}
var groupId = new IdentityPath(entry.Key, transitionGroup.TransitionGroup);
if (changedGroupIds.Contains(groupId))
{
continue;
}
if (null == FindChromInfo(document, transitionGroup, change.NameSet, change.FilePath))
{
continue;
}
document = document.ChangePeak(groupId, change.NameSet, change.FilePath, null,
change.StartTime.MeasuredTime, change.EndTime.MeasuredTime, UserSet.TRUE, change.Identified, true);
}
}
return document;
}
示例5: ChangePeak
public SrmDocument ChangePeak(SrmDocument doc, SrmTreeNode nodePepTree, TransitionGroupDocNode nodeTranGroup, string nameSet, MsDataFileUri filePath)
{
if ((_retentionTime ?? StartTime) == null)
return doc;
var groupPath = new IdentityPath(nodePepTree.Path, nodeTranGroup.Id);
doc = _retentionTime.HasValue
? doc.ChangePeak(groupPath, nameSet, filePath, null, _retentionTime.Value, UserSet.TRUE)
: doc.ChangePeak(groupPath, nameSet, filePath, null, StartTime, EndTime, UserSet.TRUE, null, false);
var activeTransitionGroup = (TransitionGroupDocNode) doc.FindNode(groupPath);
if (activeTransitionGroup.RelativeRT != RelativeRT.Matching)
return doc;
var activeChromInfo = SkylineWindow.FindChromInfo(doc, activeTransitionGroup, nameSet, filePath);
var peptide = (PeptideDocNode) doc.FindNode(groupPath.Parent);
// See if there are any other transition groups that should have their peak bounds set to the same value
foreach (var tranGroup in peptide.TransitionGroups.Where(tranGroup => tranGroup.RelativeRT == RelativeRT.Matching))
{
var otherGroupPath = new IdentityPath(groupPath.Parent, tranGroup.TransitionGroup);
if (Equals(groupPath, otherGroupPath) || SkylineWindow.FindChromInfo(doc, tranGroup, nameSet, filePath) == null)
continue;
doc = doc.ChangePeak(otherGroupPath, nameSet, filePath, null,
activeChromInfo.StartRetentionTime, activeChromInfo.EndRetentionTime, UserSet.TRUE, activeChromInfo.Identified, false);
}
return doc;
}