コード例 #1
0
ファイル: PcaPlot.cs プロジェクト: laeubisoft/pwiz
        private Dictionary <ImmutableList <HeaderLevel>, PointPairList> GetRowPointPairLists(int xAxisIndex, int yAxisIndex)
        {
            var pointLists  = new Dictionary <ImmutableList <HeaderLevel>, PointPairList>();
            var results     = Clusterer.PerformPcaOnRows(Math.Max(xAxisIndex, yAxisIndex) + 1);
            var cellLocator = CellLocator.ForRow(Clusterer.Properties.RowHeaders);

            for (int iRow = 0; iRow < results.ItemLabels.Count; iRow++)
            {
                var rowItem = results.ItemLabels[iRow];
                var headers = new List <HeaderLevel>();
                foreach (var pdHeader in Clusterer.Properties.RowHeaders)
                {
                    var objectValue = pdHeader.GetValue(rowItem);
                    headers.Add(new HeaderLevel(pdHeader.ColumnCaption, objectValue,
                                                ColorScheme.GetColor(pdHeader, rowItem) ?? MISSING_COLOR));
                }

                var           key = ImmutableList.ValueOf(headers);
                PointPairList pointPairList;
                if (!pointLists.TryGetValue(key, out pointPairList))
                {
                    pointPairList = new PointPairList();
                    pointLists.Add(key, pointPairList);
                }
                var pointInfo = new PointInfo(key);
                pointInfo = pointInfo.ChangeIdentityPath(cellLocator.GetSkylineDocNode(rowItem)?.IdentityPath)
                            .ChangeReplicateName(cellLocator.GetReplicate(rowItem)?.Name);
                var point = new PointPair(results.ItemComponents[iRow][xAxisIndex], results.ItemComponents[iRow][yAxisIndex])
                {
                    Tag = pointInfo
                };
                pointPairList.Add(point);
            }

            return(pointLists);
        }