public GroupComparisonRow(PeptideGroupDocNode protein, PeptideDocNode peptide, int?msLevel, FoldChangeResult result) { Protein = protein; Peptide = peptide; MsLevel = msLevel; FoldChangeResult = result; }
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; }
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; }
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); }
public GroupComparisonRefinementData(SrmDocument document, double adjustedPValCutoff, double foldChangeCutoff, int?msLevel, List <GroupComparisonDef> groupComparisonDefs, SrmSettingsChangeMonitor progressMonitor) { _progressMonitor = progressMonitor; _foldChangeCutoff = foldChangeCutoff; _adjustedPValCutoff = adjustedPValCutoff; if (msLevel.HasValue) { _msLevel = msLevel.Value; } else { _msLevel = document.PeptideTransitions.Any(t => !t.IsMs1) ? 2 : 1; } Data = new List <List <GroupComparisonRow> >(); foreach (var groupComparisonDef in groupComparisonDefs) { var groupComparer = new GroupComparer(groupComparisonDef, document, _qrFactorizationCache); var results = GroupComparisonModel.ComputeResults(groupComparer, document, null, null, progressMonitor); var adjustedPValues = PValues.AdjustPValues(results.Select( row => row.LinearFitResult.PValue)).ToArray(); var foldChangeList = new List <GroupComparisonRow>(); for (int iRow = 0; iRow < results.Count; iRow++) { var resultRow = results[iRow]; FoldChangeResult foldChangeResult = new FoldChangeResult(groupComparisonDef.ConfidenceLevel, adjustedPValues[iRow], resultRow.LinearFitResult, double.NaN); foldChangeList.Add(new GroupComparisonRow(resultRow.Selector.Protein, resultRow.Selector.Peptide, resultRow.Selector.MsLevel, foldChangeResult)); } Data.Add(foldChangeList); } }
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); }