Esempio n. 1
0
 public FoldChangeDetailRow(Protein protein, Model.Databinding.Entities.Peptide peptide,
                            IsotopeLabelType labelType,
                            int?msLevel, Dictionary <GroupIdentifier, FoldChangeResult> foldChangeResults,
                            IDictionary <Replicate, ReplicateRow> replicateResult) : base(protein, peptide, labelType, msLevel, replicateResult)
 {
     FoldChangeResults = foldChangeResults;
 }
Esempio n. 2
0
 public FoldChangeRow(Protein protein, Model.Databinding.Entities.Peptide peptide, IsotopeLabelType labelType,
                      int?msLevel, GroupIdentifier group, int replicateCount, FoldChangeResult foldChangeResult, IDictionary <Replicate, ReplicateRow> replicateResults)
     : base(protein, peptide, labelType, msLevel, replicateResults)
 {
     ReplicateCount   = replicateCount;
     FoldChangeResult = foldChangeResult;
     Group            = group;
 }
Esempio n. 3
0
 public AbstractFoldChangeRow(Protein protein, Model.Databinding.Entities.Peptide peptide,
                              IsotopeLabelType labelType,
                              int?msLevel, IDictionary <Replicate, ReplicateRow> replicateResults)
 {
     Protein             = protein;
     Peptide             = peptide;
     IsotopeLabelType    = labelType;
     MsLevel             = msLevel;
     ReplicateAbundances = replicateResults;
 }
Esempio n. 4
0
 public FoldChangeRow(Protein protein, Model.Databinding.Entities.Peptide peptide, IsotopeLabelType labelType,
                      int?msLevel, GroupIdentifier group, int replicateCount, FoldChangeResult foldChangeResult)
 {
     Protein          = protein;
     Peptide          = peptide;
     IsotopeLabelType = labelType;
     MsLevel          = msLevel;
     ReplicateCount   = replicateCount;
     FoldChangeResult = foldChangeResult;
     Group            = group;
 }
Esempio n. 5
0
        private void UpdateResults()
        {
            var results = GroupComparisonModel.Results;
            var rows    = new List <FoldChangeRow>();

            if (null != results)
            {
                Dictionary <int, double> criticalValuesByDegreesOfFreedom = new Dictionary <int, double>();
                var groupComparisonDef = results.GroupComparer.ComparisonDef;
                var adjustedPValues    = PValues.AdjustPValues(results.ResultRows.Select(
                                                                   row => row.LinearFitResult.PValue)).ToArray();
                for (int iRow = 0; iRow < results.ResultRows.Count; iRow++)
                {
                    var resultRow = results.ResultRows[iRow];
                    var protein   = new Protein(_skylineDataSchema, new IdentityPath(resultRow.Selector.Protein.Id));
                    Model.Databinding.Entities.Peptide peptide = null;
                    if (null != resultRow.Selector.Peptide)
                    {
                        peptide = new Model.Databinding.Entities.Peptide(_skylineDataSchema,
                                                                         new IdentityPath(protein.IdentityPath, resultRow.Selector.Peptide.Id));
                    }
                    double criticalValue;
                    if (!criticalValuesByDegreesOfFreedom.TryGetValue(resultRow.LinearFitResult.DegreesOfFreedom,
                                                                      out criticalValue))
                    {
                        criticalValue = FoldChangeResult.GetCriticalValue(groupComparisonDef.ConfidenceLevel,
                                                                          resultRow.LinearFitResult.DegreesOfFreedom);
                        criticalValuesByDegreesOfFreedom.Add(resultRow.LinearFitResult.DegreesOfFreedom, criticalValue);
                    }
                    FoldChangeResult foldChangeResult = new FoldChangeResult(groupComparisonDef.ConfidenceLevel,
                                                                             adjustedPValues[iRow], resultRow.LinearFitResult, criticalValue);
                    rows.Add(new FoldChangeRow(protein, peptide, resultRow.Selector.LabelType,
                                               resultRow.Selector.MsLevel, resultRow.Selector.GroupIdentifier, resultRow.ReplicateCount, foldChangeResult));
                }
            }
            var defaultViewSpec = GetDefaultViewSpec(rows);

            if (!Equals(defaultViewSpec, ViewContext.BuiltInViews.First()))
            {
                var viewInfo = new ViewInfo(_skylineDataSchema, typeof(FoldChangeRow), defaultViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN);
                ViewContext.SetRowSources(new[]
                {
                    new RowSourceInfo(new StaticRowSource(rows), viewInfo)
                });
                if (null != _bindingListSource.ViewSpec && _bindingListSource.ViewSpec.Name == defaultViewSpec.Name &&
                    !_bindingListSource.ViewSpec.Equals(defaultViewSpec))
                {
                    _bindingListSource.SetView(viewInfo, new StaticRowSource(rows));
                }
            }
            _bindingListSource.RowSource = new StaticRowSource(rows);
        }
Esempio n. 6
0
        private void UpdateResults()
        {
            var results = GroupComparisonModel.Results;
            var rows    = new List <FoldChangeRow>();

            if (null != results)
            {
                var controlGroupIdentifier =
                    GroupComparisonModel.GroupComparisonDef.GetControlGroupIdentifier(_skylineDataSchema.Document
                                                                                      .Settings);
                Dictionary <int, double> criticalValuesByDegreesOfFreedom = new Dictionary <int, double>();
                var groupComparisonDef = results.GroupComparer.ComparisonDef;
                var adjustedPValues    = PValues.AdjustPValues(results.ResultRows.Select(
                                                                   row => row.LinearFitResult.PValue)).ToArray();
                for (int iRow = 0; iRow < results.ResultRows.Count; iRow++)
                {
                    var resultRow = results.ResultRows[iRow];
                    var protein   = new Protein(_skylineDataSchema, new IdentityPath(resultRow.Selector.Protein.Id));
                    Model.Databinding.Entities.Peptide peptide = null;
                    if (null != resultRow.Selector.Peptide)
                    {
                        peptide = new Model.Databinding.Entities.Peptide(_skylineDataSchema,
                                                                         new IdentityPath(protein.IdentityPath, resultRow.Selector.Peptide.Id));
                    }
                    double criticalValue;
                    if (!criticalValuesByDegreesOfFreedom.TryGetValue(resultRow.LinearFitResult.DegreesOfFreedom,
                                                                      out criticalValue))
                    {
                        criticalValue = FoldChangeResult.GetCriticalValue(groupComparisonDef.ConfidenceLevel,
                                                                          resultRow.LinearFitResult.DegreesOfFreedom);
                        criticalValuesByDegreesOfFreedom.Add(resultRow.LinearFitResult.DegreesOfFreedom, criticalValue);
                    }
                    FoldChangeResult foldChangeResult = new FoldChangeResult(groupComparisonDef.ConfidenceLevel,
                                                                             adjustedPValues[iRow], resultRow.LinearFitResult, criticalValue);
                    var runAbundances = new Dictionary <Replicate, ReplicateRow>();

                    foreach (var runAbundance in resultRow.RunAbundances)
                    {
                        Replicate replicate = new Replicate(_skylineDataSchema, runAbundance.ReplicateIndex);
                        runAbundances.Add(replicate, new ReplicateRow(replicate, runAbundance.Control ?
                                                                      controlGroupIdentifier : resultRow.Selector.GroupIdentifier
                                                                      , runAbundance.BioReplicate, Math.Pow(2, runAbundance.Log2Abundance)));
                    }
                    rows.Add(new FoldChangeRow(protein, peptide, resultRow.Selector.LabelType,
                                               resultRow.Selector.MsLevel, resultRow.Selector.GroupIdentifier, resultRow.ReplicateCount, foldChangeResult, runAbundances));
                }
            }

            var detailRows = new List <FoldChangeDetailRow>();

            foreach (var grouping in rows.ToLookup(row =>
                                                   Tuple.Create(row.Protein, row.Peptide, row.IsotopeLabelType, row.MsLevel)))
            {
                var foldChangeResults = grouping.ToDictionary(row => row.Group, row => row.FoldChangeResult);
                var runAbundances     = new Dictionary <Replicate, ReplicateRow>();
                foreach (var abundance in grouping.SelectMany(row => row.ReplicateAbundances))
                {
                    runAbundances[abundance.Key] = abundance.Value;
                }
                detailRows.Add(new FoldChangeDetailRow(grouping.Key.Item1, grouping.Key.Item2, grouping.Key.Item3, grouping.Key.Item4, foldChangeResults, runAbundances));
            }
            var defaultViewSpec   = GetDefaultViewSpec(rows);
            var clusteredViewSpec = GetClusteredViewSpec(defaultViewSpec);

            var rowSourceInfos = new List <RowSourceInfo>()
            {
                new RowSourceInfo(new StaticRowSource(rows),
                                  new ViewInfo(_skylineDataSchema, typeof(FoldChangeRow), defaultViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN)),
                new RowSourceInfo(new StaticRowSource(detailRows),
                                  new ViewInfo(_skylineDataSchema, typeof(FoldChangeDetailRow), clusteredViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN))
            };

            SetRowSourceInfos(rowSourceInfos);
        }
 private void UpdateResults()
 {
     var results = GroupComparisonModel.Results;
     var rows = new List<FoldChangeRow>();
     if (null != results)
     {
         var groupComparisonDef = results.GroupComparer.ComparisonDef;
         var adjustedPValues = PValues.AdjustPValues(results.ResultRows.Select(
             row => row.LinearFitResult.PValue)).ToArray();
         for (int iRow = 0; iRow < results.ResultRows.Count; iRow++)
         {
             var resultRow = results.ResultRows[iRow];
             var protein = new Protein(_skylineDataSchema, new IdentityPath(resultRow.Selector.Protein.Id));
             Model.Databinding.Entities.Peptide peptide = null;
             if (null != resultRow.Selector.Peptide)
             {
                 peptide = new Model.Databinding.Entities.Peptide(_skylineDataSchema,
                     new IdentityPath(protein.IdentityPath, resultRow.Selector.Peptide.Id));
             }
             rows.Add(new FoldChangeRow(protein, peptide, resultRow.Selector.LabelType,
                 resultRow.Selector.MsLevel, resultRow.Selector.GroupIdentifier, resultRow.ReplicateCount,
                 new FoldChangeResult(groupComparisonDef.ConfidenceLevel,
                     adjustedPValues[iRow], resultRow.LinearFitResult)));
         }
     }
     var defaultViewSpec = GetDefaultViewSpec(rows);
     if (!Equals(defaultViewSpec, ViewContext.BuiltInViews.First()))
     {
         var viewInfo = new ViewInfo(_skylineDataSchema, typeof (FoldChangeRow), defaultViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN);
         ViewContext.SetRowSources(new[]
         {
             new RowSourceInfo(
                 rows, viewInfo)
         });
         if (null != _bindingListSource.ViewSpec && _bindingListSource.ViewSpec.Name == defaultViewSpec.Name &&
             !_bindingListSource.ViewSpec.Equals(defaultViewSpec))
         {
             _bindingListSource.SetView(viewInfo, rows);
         }
     }
     _bindingListSource.RowSource = rows;
 }