本文整理汇总了C#中SrmDocument.StripAnnotationValues方法的典型用法代码示例。如果您正苦于以下问题:C# SrmDocument.StripAnnotationValues方法的具体用法?C# SrmDocument.StripAnnotationValues怎么用?C# SrmDocument.StripAnnotationValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SrmDocument
的用法示例。
在下文中一共展示了SrmDocument.StripAnnotationValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureAnnotation
private SrmDocument EnsureAnnotation(SrmDocument document, string annotationName, bool addAnnotation,
IEnumerable<string> annotationNames)
{
var containsQAnnotation = annotationNames.Contains(annotationName);
if (!containsQAnnotation && addAnnotation)
{
var annotationTargets =
AnnotationDef.AnnotationTargetSet.OfValues(AnnotationDef.AnnotationTarget.precursor_result);
var newAnnotationDef = new AnnotationDef(annotationName, annotationTargets, AnnotationDef.AnnotationType.number,
new string[0]);
AnnotationDef existingAnnotationDef;
// CONSIDER: Throw error instead of overwriting?
if (!Settings.Default.AnnotationDefList.TryGetValue(annotationName, out existingAnnotationDef) &&
!Equals(existingAnnotationDef, newAnnotationDef))
{
Settings.Default.AnnotationDefList.SetValue(newAnnotationDef);
}
else
{
// Use the existing annotation
newAnnotationDef = existingAnnotationDef;
}
document = document.ChangeSettings(Document.Settings.ChangeAnnotationDefs(defs =>
{
var defsNew = defs.ToList();
defsNew.Add(newAnnotationDef);
return defsNew;
}));
}
else if (containsQAnnotation && !AddAnnotation)
{
document = document.ChangeSettings(Document.Settings.ChangeAnnotationDefs(defs =>
{
var defsNew = defs.ToList();
defsNew.RemoveAll(def => Equals(def.Name, annotationName));
return defsNew;
}));
var annotationNamesToKeep = document.Settings.DataSettings.AnnotationDefs.Select(def => def.Name).ToList();
document = (SrmDocument) document.StripAnnotationValues(annotationNamesToKeep);
}
return document;
}
示例2: GenerateComparison
public void GenerateComparison(SrmDocument docOriginal, IProgressMonitor progressMonitor)
{
DocOriginal = docOriginal;
_docCompare = docOriginal;
if (IsModel)
{
var handler = new MProphetResultsHandler(DocOriginal, PeakScoringModel)
{
AddAnnotation = true,
AddMAnnotation = true
};
handler.ScoreFeatures(progressMonitor);
_docCompare = handler.ChangePeaks(progressMonitor);
}
else
{
// Add in the necessary annotation definitions so that ImportPeakBoundaries can read them
_docCompare = AddAnnotationIfMissing(_docCompare, MProphetResultsHandler.AnnotationName);
_docCompare = AddAnnotationIfMissing(_docCompare, MProphetResultsHandler.MAnnotationName);
_docCompare = AddAnnotationIfMissing(_docCompare, APEX_ANNOTATION);
// But strip the values of these annotations if there were any
var annotationNamesToStrip = new List<string>
{
MProphetResultsHandler.AnnotationName,
MProphetResultsHandler.MAnnotationName,
APEX_ANNOTATION
};
var annotationNamesToKeep = _docCompare.Settings.DataSettings.AnnotationDefs
.Where(def => !annotationNamesToStrip.Contains(def.Name))
.Select(def => def.Name).ToList();
_docCompare = (SrmDocument)_docCompare.StripAnnotationValues(annotationNamesToKeep);
Importer = new PeakBoundaryImporter(_docCompare);
long lineCount = Helpers.CountLinesInFile(FilePath);
// Peek at the file to see if it has a column called "Apex"
using (var reader = new StreamReader(FilePath))
{
var line = reader.ReadLine();
var fieldNames = PeakBoundaryImporter.FIELD_NAMES.ToList();
fieldNames.Add(new [] {APEX_ANNOTATION});
int fieldsTotal;
int[] fieldIndices;
var separator = PeakBoundaryImporter.DetermineCorrectSeparator(line, fieldNames,
PeakBoundaryImporter.REQUIRED_NO_CHROM, out fieldIndices, out fieldsTotal);
ApexPresent = separator != null && fieldIndices.Last() != -1;
}
_docCompare = Importer.Import(FilePath, progressMonitor, lineCount, true, !ApexPresent);
}
var matches = new List<PeakBoundsMatch>();
var truePeptides = DocOriginal.Molecules.ToList();
var pickedPeptides = _docCompare.Molecules.ToList();
int nTruePeptides = truePeptides.Count;
var chromatogramSets = DocOriginal.Settings.MeasuredResults.Chromatograms;
for (int i = 0; i < chromatogramSets.Count; i++)
{
var set = chromatogramSets[i];
for (int j = 0; j < nTruePeptides; j++)
{
var truePeptide = truePeptides[j];
var pickedPeptide = pickedPeptides[j];
// We don't care about peak picking performance for decoys
if (truePeptide.IsDecoy)
continue;
// We don't care about peak picking performance for standard peptides
if (truePeptide.GlobalStandardType != null)
continue;
var trueGroups = truePeptide.TransitionGroups.ToList();
var pickedGroups = pickedPeptide.TransitionGroups.ToList();
for (int k = 0; k < trueGroups.Count; k++)
{
var trueGroup = trueGroups[k];
var pickedGroup = pickedGroups[k];
var trueResults = trueGroup.Results[i];
var pickedResults = pickedGroup.Results[i];
if (trueResults == null)
continue;
int nChromInfos = trueResults.Count;
for (int m = 0; m < nChromInfos; m++)
{
var trueInfo = trueResults[m];
var pickedInfo = pickedResults[m];
var fileInfo = set.GetFileInfo(trueInfo.FileId);
var filePath = fileInfo.FilePath;
var key = new MatchKey(trueGroup.Id.GlobalIndex, trueInfo.FileId.GlobalIndex);
matches.Add(new PeakBoundsMatch(trueInfo, pickedInfo, key, filePath, trueGroup,
HasNoQValues, HasNoScores, ApexPresent));
}
}
}
}
Matches = matches;
// Detect if the apex time is in seconds, and if so adjust it to minutes
if (ApexPresent)
{
double maxTime = matches.Where(match => match.PickedApex.HasValue)
.Select(match => match.PickedApex.Value).Max();
if (maxTime > PeakBoundaryImporter.GetMaxRt(DocOriginal))
{
foreach (var match in matches.Where(match => match.PickedApex.HasValue))
{
match.PickedApex = match.PickedApex / 60;
//.........这里部分代码省略.........