private IEnumerable <int> GetReplicateIndices(Func <int, ChromFileInfoId> getFileId) { var chromatograms = _document.Settings.MeasuredResults.Chromatograms; if (ReplicateOrder == SummaryReplicateOrder.document && null == OrderByReplicateAnnotation) { for (int iResult = 0; iResult < chromatograms.Count; iResult++) { yield return(iResult); } } else { // Create a list of tuple's that will sort according to user's options. // The sort is optionally by an annotation value, and then optionally acquired time, // and finally document order. var listIndexFile = new List <Tuple <object, DateTime, int> >(); AnnotationDef orderByReplicateAnnotationDef = null; if (null != OrderByReplicateAnnotation) { orderByReplicateAnnotationDef = _document.Settings.DataSettings.AnnotationDefs.FirstOrDefault( annotationDef => annotationDef.Name == OrderByReplicateAnnotation); } for (int iResult = 0; iResult < chromatograms.Count; iResult++) { var chromSet = _document.Settings.MeasuredResults.Chromatograms[iResult]; ChromFileInfoId fileId = getFileId(iResult); ChromFileInfo fileInfo = (fileId != null ? chromSet.GetFileInfo(fileId) : null); object annotationValue = null; DateTime replicateTime = DateTime.MaxValue; if (null != orderByReplicateAnnotationDef) { annotationValue = chromSet.Annotations.GetAnnotation(orderByReplicateAnnotationDef); } if (null != fileInfo && ReplicateOrder == SummaryReplicateOrder.time) { replicateTime = fileInfo.RunStartTime ?? DateTime.MaxValue; } listIndexFile.Add(new Tuple <object, DateTime, int>(annotationValue, replicateTime, iResult)); } listIndexFile.Sort(); foreach (var tuple in listIndexFile) { yield return(tuple.Item3); } } }
private bool IsCachedFile(SrmDocument doc, ChromFileInfo info) { return(doc.Settings.MeasuredResults.IsCachedFile(info.FilePath)); }