public ResultFile(Replicate replicate, ChromFileInfoId chromFileInfoId, int optStep) : base(replicate.DataSchema) { Replicate = replicate; ChromFileInfoId = chromFileInfoId; _chromFileInfo = CachedValue.Create(DataSchema, () => Replicate.ChromatogramSet.GetFileInfo(ChromFileInfoId)); OptimizationStep = optStep; }
public override ElementRef GetElementRef() { var sibling = ResultFileRef.PROTOTYPE.ChangeParent(Replicate.GetElementRef()); int fileIndex = Replicate.ChromatogramSet.IndexOfId(ChromFileInfoId); return(sibling.ListChildrenOfParent(SrmDocument).Skip(fileIndex).FirstOrDefault()); }
protected IDictionary <ResultKey, TResult> MakeChromInfoResultsMap <TChromInfo, TResult>( Results <TChromInfo> results, Func <ResultFile, TResult> newResultFunc) where TChromInfo : ChromInfo { var resultMap = new Dictionary <ResultKey, TResult>(); if (results == null) { return(resultMap); } for (int replicateIndex = 0; replicateIndex < results.Count; replicateIndex++) { var replicate = new Replicate(DataSchema, replicateIndex); var files = results[replicateIndex]; if (null == files) { continue; } for (int fileIndex = 0; fileIndex < files.Count; fileIndex++) { var chromInfo = files[fileIndex]; if (null == chromInfo) { continue; } var key = new ResultKey(replicate, fileIndex); var resultFile = new ResultFile(replicate, chromInfo.FileId, ResultFile.GetOptStep(chromInfo)); resultMap.Add(key, newResultFunc(resultFile)); } } return(resultMap); }
public int CompareTo(object obj) { if (null == obj) { return(1); } var resultFile = (ResultFile)obj; int replicateCompare = Replicate.CompareTo(resultFile.Replicate); if (0 != replicateCompare) { return(replicateCompare); } return(string.Compare(FileName, resultFile.FileName, StringComparison.CurrentCultureIgnoreCase)); }
private IDictionary <ResultKey, ResultFile> MakeResults() { var dict = new Dictionary <ResultKey, ResultFile>(); var document = SrmDocument; if (document.Settings.HasResults) { for (int iResult = 0; iResult < document.Settings.MeasuredResults.Chromatograms.Count; iResult++) { var replicate = new Replicate(DataSchema, iResult); var chromatogramSet = document.Settings.MeasuredResults.Chromatograms[iResult]; for (int iFile = 0; iFile < chromatogramSet.MSDataFileInfos.Count; iFile++) { var resultFile = new ResultFile(replicate, chromatogramSet.MSDataFileInfos[iFile].FileId, 0); dict.Add(new ResultKey(replicate, iFile), resultFile); } } } return(dict); }
protected bool Equals(Replicate other) { return(Equals(DataSchema, other.DataSchema) && ReplicateIndex == other.ReplicateIndex); }
protected IDictionary <ResultKey, TResult> MakeChromInfoResultsMap <TChromInfo, TResult>( Results <TChromInfo> results, Func <ResultFile, TResult> newResultFunc) where TChromInfo : ChromInfo { if (results == null) { return(ImmutableSortedList <ResultKey, TResult> .EMPTY.AsDictionary()); } var replicates = DataSchema.ReplicateList; var resultFiles = DataSchema.ResultFileList; if (replicates.Count == results.Count && results.All(r => r.Count == 1 && r[0] != null)) { // If every replicate has exactly one result, then we can reuse the keys in "DataSchema.ReplicateList". var newValues = new List <TResult>(replicates.Count); for (int replicateIndex = 0; replicateIndex < replicates.Count; replicateIndex++) { var chromInfo = results[replicateIndex][0]; var optStep = ResultFile.GetOptStep(chromInfo); ResultFile resultFile = null; if (optStep == 0) { resultFiles.TryGetValue(new ResultFileKey(replicateIndex, chromInfo.FileId, optStep), out resultFile); } if (resultFile == null) { resultFile = new ResultFile(replicates.Values[replicateIndex], chromInfo.FileId, optStep); } newValues.Add(newResultFunc(resultFile)); } return(replicates.ReplaceValues(newValues).AsDictionary()); } var newEntries = new List <KeyValuePair <ResultKey, TResult> >(); for (int replicateIndex = 0; replicateIndex < results.Count; replicateIndex++) { var replicate = new Replicate(DataSchema, replicateIndex); var files = results[replicateIndex]; for (int fileIndex = 0; fileIndex < files.Count; fileIndex++) { var chromInfo = files[fileIndex]; if (null == chromInfo) { continue; } var key = fileIndex == 0 ? replicates.Keys[replicateIndex] : new ResultKey(replicate, fileIndex); int optStep = ResultFile.GetOptStep(chromInfo); ResultFile resultFile = null; if (optStep == 0) { resultFiles.TryGetValue(new ResultFileKey(replicateIndex, chromInfo.FileId, optStep), out resultFile); } if (resultFile == null) { resultFile = new ResultFile(replicates.Values[replicateIndex], chromInfo.FileId, optStep); } newEntries.Add(new KeyValuePair <ResultKey, TResult>(key, newResultFunc(resultFile))); } } return(ImmutableSortedList <ResultKey, TResult> .FromValues(newEntries, Comparer <ResultKey> .Default) .AsDictionary()); }
public ResultKey(Replicate replicate, int fileIndex) : this(replicate.Name, replicate.ReplicateIndex, fileIndex) { }
public override string ToString() { return(TextUtil.SpaceSeparate(Protein.ToString(), Replicate.ToString())); }
public ProteinResult(Protein protein, Replicate replicate) : base(protein.DataSchema) { Replicate = replicate; Protein = protein; }