示例#1
0
        private IList <DataRowDetails> SumMs1Transitions(IList <DataRowDetails> dataRows)
        {
            var dataRowsByReplicateIndexAndTransitionGroup =
                dataRows.ToLookup(row =>
                                  new Tuple <int, IdentityPath>(row.ReplicateIndex,
                                                                row.IdentityPath.GetPathTo((int)SrmDocument.Level.TransitionGroups)));
            var newDataRows = new List <DataRowDetails>();

            foreach (var grouping in dataRowsByReplicateIndexAndTransitionGroup)
            {
                DataRowDetails ms1DataRow      = null;
                var            transitionGroup = (TransitionGroupDocNode)SrmDocument.FindNode(grouping.Key.Item2);
                foreach (var dataRow in grouping)
                {
                    var transition = (TransitionDocNode)transitionGroup.FindNode(dataRow.IdentityPath.Child);
                    if (transition.IsMs1)
                    {
                        if (ms1DataRow == null)
                        {
                            ms1DataRow = new DataRowDetails()
                            {
                                IdentityPath   = grouping.Key.Item2,
                                BioReplicate   = dataRow.BioReplicate,
                                Control        = dataRow.Control,
                                ReplicateIndex = dataRow.ReplicateIndex
                            };
                        }
                        ms1DataRow.Intensity   += dataRow.Intensity;
                        ms1DataRow.Denominator += dataRow.Denominator;
                    }
                    else
                    {
                        newDataRows.Add(dataRow);
                    }
                }
                if (ms1DataRow != null)
                {
                    newDataRows.Add(ms1DataRow);
                }
            }
            return(newDataRows);
        }
示例#2
0
 private void GetDataRows(GroupComparisonSelector selector, IList <DataRowDetails> foldChangeDetails)
 {
     foreach (var replicateEntry in _replicateIndexes)
     {
         if (!replicateEntry.Value.IsControl &&
             !Equals(selector.GroupIdentifier, replicateEntry.Value.GroupIdentifier))
         {
             continue;
         }
         foreach (var peptide in selector.ListPeptides())
         {
             QuantificationSettings quantificationSettings = QuantificationSettings.DEFAULT
                                                             .ChangeNormalizationMethod(ComparisonDef.NormalizationMethod)
                                                             .ChangeMsLevel(selector.MsLevel);
             var peptideQuantifier = new PeptideQuantifier(GetNormalizationData, selector.Protein, peptide,
                                                           quantificationSettings)
             {
                 QValueCutoff = ComparisonDef.QValueCutoff
             };
             if (null != selector.LabelType)
             {
                 peptideQuantifier.MeasuredLabelTypes = ImmutableList.Singleton(selector.LabelType);
             }
             foreach (var quantityEntry in peptideQuantifier.GetTransitionIntensities(SrmDocument.Settings,
                                                                                      replicateEntry.Key, ComparisonDef.UseZeroForMissingPeaks))
             {
                 var dataRowDetails = new DataRowDetails
                 {
                     BioReplicate   = replicateEntry.Value.BioReplicate,
                     Control        = replicateEntry.Value.IsControl,
                     IdentityPath   = quantityEntry.Key,
                     Intensity      = Math.Max(1.0, quantityEntry.Value.Intensity),
                     Denominator    = Math.Max(1.0, quantityEntry.Value.Denominator),
                     ReplicateIndex = replicateEntry.Key,
                 };
                 foldChangeDetails.Add(dataRowDetails);
             }
         }
     }
 }