public ViewSpec() { Columns = ImmutableList.Empty <ColumnSpec>(); Filters = ImmutableList.Empty <FilterSpec>(); }
private IList <RunAbundance> SummarizeDataRowsWithMedianPolish(IList <DataRowDetails> dataRows) { IList <IGrouping <IdentityPath, DataRowDetails> > dataRowsByFeature = SumMs1Transitions(dataRows).ToLookup(row => row.IdentityPath) .Where(IncludeFeatureForMedianPolish) .ToArray(); #pragma warning disable 162 // ReSharper disable HeuristicUnreachableCode if (false) { // For debugging purposes, we might want to order these features in the same order as MSstats R code Array.Sort((IGrouping <IdentityPath, DataRowDetails>[])dataRowsByFeature, (group1, group2) => { String s1 = GetFeatureKey(SrmDocument, group1.Key); String s2 = GetFeatureKey(SrmDocument, group2.Key); return(String.Compare(s1.ToLowerInvariant(), s2.ToLowerInvariant(), StringComparison.Ordinal)); }); } // ReSharper restore HeuristicUnreachableCode #pragma warning restore 162 var featureCount = dataRowsByFeature.Count; if (featureCount == 0) { return(ImmutableList.Empty <RunAbundance>()); } var rows = new List <double?[]>(); IDictionary <int, int> replicateRowIndexes = new Dictionary <int, int>(); for (int iFeature = 0; iFeature < dataRowsByFeature.Count; iFeature++) { foreach (DataRowDetails dataRowDetails in dataRowsByFeature[iFeature]) { int rowIndex; if (!replicateRowIndexes.TryGetValue(dataRowDetails.ReplicateIndex, out rowIndex)) { rowIndex = rows.Count; rows.Add(new double?[featureCount]); replicateRowIndexes.Add(dataRowDetails.ReplicateIndex, rowIndex); } var row = rows[rowIndex]; row[iFeature] = dataRowDetails.GetLog2Abundance(); } } var matrix = new double?[rows.Count, featureCount]; for (int iRow = 0; iRow < rows.Count; iRow++) { for (int iCol = 0; iCol < featureCount; iCol++) { matrix[iRow, iCol] = rows[iRow][iCol]; } } var medianPolish = MedianPolish.GetMedianPolish(matrix); List <RunAbundance> runAbundances = new List <RunAbundance>(); foreach (var replicateIndexDetails in _replicateIndexes) { int rowIndex; if (!replicateRowIndexes.TryGetValue(replicateIndexDetails.Key, out rowIndex)) { continue; } double value = medianPolish.OverallConstant + medianPolish.RowEffects[rowIndex]; runAbundances.Add(new RunAbundance() { ReplicateIndex = replicateIndexDetails.Key, BioReplicate = replicateIndexDetails.Value.BioReplicate, Control = replicateIndexDetails.Value.IsControl, Log2Abundance = value }); } return(runAbundances); }
public PivotedProperties(ItemProperties itemProperties) : this(itemProperties, ImmutableList.Empty <SeriesGroup>()) { }
private RowFilter() { Text = null; CaseSensitive = true; ColumnFilters = ImmutableList.Empty <ColumnFilter>(); }
/// <summary> /// Ensure that the document peptide settings contain all of the necessary heavy label types (i.e. "heavy1", "heavy2", ...) /// to accomodate the specified number of possible permutations. /// </summary> public SrmDocument EnsureLabelTypes(IProgressMonitor progressMonitor, SrmDocument document, int maxPermutationCount, List <IsotopeLabelType> partialLabelTypes) { if (partialLabelTypes.Count == 0) { partialLabelTypes.Add(IsotopeLabelType.light); } var labelTypesByName = document.Settings.PeptideSettings.Modifications.GetHeavyModificationTypes() .ToDictionary(label => label.Name); int maxSortValue = 0; if (labelTypesByName.Any()) { maxSortValue = labelTypesByName.Values.Max(label => label.SortOrder); } var labelTypesToAdd = new List <IsotopeLabelType>(); for (int i = partialLabelTypes.Count; i < maxPermutationCount - 1; i++) { if (progressMonitor.IsCanceled) { throw new OperationCanceledException(); } var name = FullyHeavyLabelType.Name + i; IsotopeLabelType labelType; if (!labelTypesByName.TryGetValue(name, out labelType)) { labelType = new IsotopeLabelType(name, ++maxSortValue); labelTypesToAdd.Add(labelType); } partialLabelTypes.Add(labelType); } if (!labelTypesByName.ContainsKey(FullyHeavyLabelType.Name)) { labelTypesToAdd.Add(FullyHeavyLabelType); } if (labelTypesToAdd.Any()) { var settings = document.Settings; var heavyModifications = settings.PeptideSettings.Modifications.HeavyModifications.ToList(); heavyModifications.AddRange(labelTypesToAdd.Select(labelType => new TypedModifications(labelType, ImmutableList.Empty <StaticMod>()))); var peptideModifications = settings.PeptideSettings.Modifications; peptideModifications = new PeptideModifications(peptideModifications.StaticModifications, peptideModifications.MaxVariableMods, peptideModifications.MaxNeutralLosses, heavyModifications, peptideModifications.InternalStandardTypes); settings = settings.ChangePeptideSettings(settings.PeptideSettings.ChangeModifications(peptideModifications)); document = document.ChangeSettings(settings); } return(document); }
private ProcessingQueue() : this(ImmutableList.Empty <IProcessingStep>()) { }
public static RowItemValues Empty(Type propertyType) { return(new RowItemValues(propertyType, ImmutableList.Empty <ColumnDescriptor>(), ImmutableList.Empty <PivotKey>(), ImmutableList.Empty <DataPropertyDescriptor>())); }
public ViewSpec() { Columns = ImmutableList.Empty <ColumnSpec>(); Filters = ImmutableList.Empty <FilterSpec>(); UiMode = string.Empty; }