Example #1
0
        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);
        }
Example #2
0
 public TransitionResult(Transition transition, ResultFile resultFile) : base(transition, resultFile)
 {
     _chromInfo    = CachedValue.Create(DataSchema, () => GetResultFile().FindChromInfo(transition.DocNode.Results));
     _chromatogram = CachedValue.Create(DataSchema,
                                        () => new Chromatogram(new ChromatogramGroup(PrecursorResult), Transition));
 }
Example #3
0
 public PeptideResult(Peptide peptide, ResultFile file) : base(peptide, file)
 {
     _chromInfo              = CachedValue.Create(DataSchema, () => ResultFile.FindChromInfo(peptide.DocNode.Results));
     _quantificationResult   = CachedValue.Create(DataSchema, GetQuantification);
     _calibrationCurveFitter = CachedValue.Create(DataSchema, GetCalibrationCurveFitter);
 }
Example #4
0
 public PrecursorResult(Precursor precursor, ResultFile file) : base(precursor, file)
 {
     _chromInfo = CachedValue.Create(DataSchema, () => GetResultFile().FindChromInfo(precursor.DocNode.Results));
 }
Example #5
0
        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());
        }
Example #6
0
 protected Result(SkylineDocNode docNode, ResultFile resultFile) : base(docNode.DataSchema)
 {
     SkylineDocNode = docNode;
     _resultFile    = resultFile;
 }
Example #7
0
 public ProteinResult(Protein protein, ResultFile resultFile) : base(protein, resultFile)
 {
 }
Example #8
0
 protected static bool MatchesWithoutOptStep(ResultFile resultFile1, ResultFile resultFile2)
 {
     return(Equals(resultFile1.Replicate.ReplicateIndex, resultFile2.Replicate.ReplicateIndex) &&
            ReferenceEquals(resultFile1.ChromFileInfoId, resultFile2.ChromFileInfoId));
 }
Example #9
0
 protected static IEnumerable <TResult> FindResults(IDictionary <ResultKey, TResult> results, ResultFile resultFile)
 {
     return(results.Values.Where(result => MatchesWithoutOptStep(result.GetResultFile(), resultFile)));
 }
 public TransitionResult(Transition transition, ResultFile resultFile) : base(transition, resultFile)
 {
     _chromInfo = CachedValue.Create(DataSchema, () => GetResultFile().FindChromInfo(transition.DocNode.Results));
 }