コード例 #1
0
 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;
 }
コード例 #2
0
        public override ElementRef GetElementRef()
        {
            var sibling   = ResultFileRef.PROTOTYPE.ChangeParent(Replicate.GetElementRef());
            int fileIndex = Replicate.ChromatogramSet.IndexOfId(ChromFileInfoId);

            return(sibling.ListChildrenOfParent(SrmDocument).Skip(fileIndex).FirstOrDefault());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: Replicate.cs プロジェクト: joey10086/pwiz
 protected bool Equals(Replicate other)
 {
     return(Equals(DataSchema, other.DataSchema) &&
            ReplicateIndex == other.ReplicateIndex);
 }
コード例 #7
0
ファイル: SkylineDocNode.cs プロジェクト: zrolfs/pwiz
        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());
        }
コード例 #8
0
ファイル: ResultKey.cs プロジェクト: lgatto/proteowizard
 public ResultKey(Replicate replicate, int fileIndex)
     : this(replicate.Name, replicate.ReplicateIndex, fileIndex)
 {
 }
コード例 #9
0
 public override string ToString()
 {
     return(TextUtil.SpaceSeparate(Protein.ToString(), Replicate.ToString()));
 }
コード例 #10
0
 public ProteinResult(Protein protein, Replicate replicate) : base(protein.DataSchema)
 {
     Replicate = replicate;
     Protein   = protein;
 }