示例#1
0
        public static ContentsRequest FindAssociations(object target, ContentsRequest request)
        {
            switch (request.Type)
            {
            case EVisualClass.SpecialAdvanced:
            case EVisualClass.SpecialMeta:
            case EVisualClass.SpecialAll:
            case EVisualClass.SpecialStatistic:
                IEnumerable <Column> cols = ColumnManager.GetColumns(request.Core, target).OrderBy(z => z.Special.Has(EColumn.Visible));
                bool shortName;

                switch (request.Type)
                {
                case EVisualClass.SpecialAll:
                    request.Text = "All data fields for {0}";
                    cols         = cols.Where(z => !z.Special.Has(EColumn.Advanced));
                    shortName    = false;
                    break;

                case EVisualClass.SpecialStatistic:
                    request.Text = "Statistics fields for {0}";
                    cols         = cols.Where(z => !z.Special.Has(EColumn.Advanced) && z.Special.Has(EColumn.IsStatistic));
                    shortName    = true;
                    break;

                case EVisualClass.SpecialMeta:
                    request.Text = "Meta-data fields for {0}";
                    cols         = cols.Where(z => !z.Special.Has(EColumn.Advanced) && z.Special.Has(EColumn.IsMeta));
                    shortName    = true;
                    break;

                default:
                case EVisualClass.SpecialAdvanced:
                    request.Text = "Internal data for {0}";
                    shortName    = false;
                    break;
                }

                foreach (var c in cols)
                {
                    request.Add(new ColumnValuePair(c, target, ColumnManager.GetColumnColour(c), Resources.ListIconInformation, shortName));
                }
                break;

            default:
                if (target is Associational)
                {
                    ((Associational)target).OnFindAssociations(request);
                }
                break;
            }

            return(request);
        }
示例#2
0
        private void SelectResults(string fileName, ClusterEvaluationResults config)
        {
            this._selectedResults = config;

            this._lvhClusters.Clear();
            this._chartParameters.Clear();
            this._tvStatistics.Nodes.Clear();
            this._lvhConfigs.Clear();
            this._chcClusters.ClearPlot();
            this._labelCluster.Text = "Cluster";
            this._lblPlot.Text      = "Plot";

            if (config == null)
            {
                this.Text = "Evaluate Clustering";
                this.ctlTitleBar1.SubText = string.Empty;
                return;
            }

            this.ctlTitleBar1.SubText = config.ToString();
            this.Text = "Evaluate Clustering - " + fileName;
            this._lvhConfigs.DivertList <ClusterEvaluationParameterResult>(config.Results);

            List <ColumnWrapper> cols2 = new List <ColumnWrapper>();

            ClusterEvaluationParameterResult def = config.Results.FirstOrDefault();

            if (def != null)
            {
                var cols = ColumnManager.GetColumns(this._core, def);

                foreach (Column <ClusterEvaluationParameterResult> col in cols)
                {
                    if (col.Provider != null)
                    {
                        cols2.Add(new ColumnWrapper(config, col));
                    }
                }
            }

            this._lstSel.Items.Clear();
            this._lstSel.Items.Add("(All test repetitions)");

            for (int n = 0; n < config.Configuration.NumberOfRepeats; n++)
            {
                this._lstSel.Items.Add("Test " + (n + 1));
            }

            this._lvhStatistics.DivertList <ColumnWrapper>(cols2);
            this.PopulateTreeView(config, cols2);

            this._infoLabel.Text = "Loaded results";
        }
示例#3
0
        private void InsertMacro(object sender, CtlTextBox textBox)
        {
            ColumnCollection available = ColumnManager.GetColumns(_dataType, _core);

            IEnumerable <Column> columns = FrmEditColumns.Show(this.FindForm(), available, (IEnumerable <Column>)null, "Insert field(s)");

            if (columns == null)
            {
                return;
            }

            string text = string.Join(", ", columns.Select(z => z.DisplayName + " = {" + z.Id + "}"));

            textBox.TypeText(text);
        }
示例#4
0
        private void _btnColour_DropDownOpening(object sender, EventArgs e)
        {
            ToolStripDropDownButton tsddb = (ToolStripDropDownButton)sender;

            IEnumerable <Column> columns;
            Column selected;

            bool isColour = tsddb == this._btnColour;

            SourceSet ss = isColour ? this._colourBy : this._regressAgainst;

            switch (this.WhatPlotting)
            {
            case EPlotting.Peaks:
                columns  = ColumnManager.GetColumns <Peak>(this._core);
                selected = ss._colourByPeak;
                break;

            case EPlotting.Observations:
                columns  = ColumnManager.GetColumns <ObservationInfo>(this._core);
                selected = ss._colourByObervation;
                break;

            default:
                throw new SwitchException(this.WhatPlotting);
            }

            selected = FrmEditColumns.Show(this, columns, selected, isColour ? "Colour by" : "Regress against");

            if (selected == null)
            {
                return;
            }

            if (isColour)
            {
                this.ColourBy(this._colourBy, selected);
                this.UpdatePlot();
            }
            else
            {
                this.ColourBy(this._regressAgainst, selected);
                this.ColourBy(this._colourBy, selected);
                this.UpdateScores();
            }
        }
示例#5
0
        public ISpreadsheet ExportData()
        {
            T[] src = this.ListSource.ToArray();
            var c   = ColumnManager.GetColumns(this.DataType, this.Core).ToArray();

            Spreadsheet <object> ss = new Spreadsheet <object>(src.Length, c.Length);

            ss.Title = this.ListTitle;
            ss.RowNames.Set(this.ListSource.Select(z => z.ToString()));
            ss.ColNames.Set(c.Select(z => z.Id));

            for (int row = 0; row < src.Length; ++row)
            {
                object rowValue = src[row];

                for (int col = 0; col < c.Length; ++col)
                {
                    ss[row, col] = c[col].GetRowAsString(rowValue);
                }
            }

            return(ss);
        }
示例#6
0
        private void Export(string fileName, IDataSet x)
        {
            IEnumerable utlist = x.UntypedGetList(false);

            Visualisable[] list;

            if (utlist.FirstOrDefault2() is Visualisable)
            {
                list = utlist.Cast <Visualisable>().ToArray();
            }
            else
            {
                list = utlist.Cast <object>().Select(z => new VisualisableWrapper(x, z)).ToArray();
            }

            Column[] columns = ColumnManager.GetColumns(this._core, list[0]).Where(z => z.Special != EColumn.Advanced).ToArray();

            Spreadsheet <string> ss = new Spreadsheet <string>(list.Length, columns.Length);

            for (int nObs = 0; nObs < columns.Length; ++nObs)
            {
                ss.ColNames[nObs] = columns[nObs].Id;
            }

            for (int nPeak = 0; nPeak < list.Length; ++nPeak)
            {
                Visualisable peak = list[nPeak];
                ss.RowNames[nPeak] = this._uniqueTable.Name(peak);

                for (int nObs = 0; nObs < columns.Length; ++nObs)
                {
                    ss[nPeak, nObs] = Column.AsString(columns[nObs].GetRow(peak), EListDisplayMode.Content);
                }
            }

            ss.SaveCsv(fileName);
        }
示例#7
0
        private FrmPca(Core core, FrmMain frmMain)
        {
            this.InitializeComponent();
            UiControls.SetIcon(this);
            UiControls.ColourMenuButtons(this.toolStrip1);

            this._frmMain = frmMain;
            this._core    = core;

            this._peakFilter = PeakFilter.Empty;
            this._obsFilter  = ObsFilter.Empty;

            this._selectedCorrection = core.Options.SelectedMatrixProvider;

            this._colourBy._colourByPeak             = ColumnManager.GetColumns <Peak>(this._core).First(z => z.Id == Peak.ID_COLUMN_CLUSTERCOMBINATION);
            this._colourBy._colourByObervation       = ColumnManager.GetColumns <ObservationInfo>(this._core).First(z => z.Id == nameof(ObservationInfo.Group));
            this._regressAgainst._colourByPeak       = this._colourBy._colourByPeak;
            this._regressAgainst._colourByObervation = this._colourBy._colourByObervation;

            this._chart.AddControls(this.toolStripDropDownButton1);
            this._chart.Style.LegendDisplay = ELegendDisplay.Visible;

            this.UpdateScores();
        }