예제 #1
0
        private bool GetLabkeyProjectNames()
        {
            var success = true;
            var rcmd    = @"projectNames <- LabKeyProjects()";

            try
            {
                rConnector.EvaluateNoReturn(rcmd);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }

            if (rConnector.GetRstringVector("projectNames"))
            {
                mstrArrProjects = rConnector.Vector;
            }
            else
            {
                success = false;
            }
            return(success);
        }
        private void LoadProteinList()
        {
            var pListOK = false;

            switch (datasetname)
            {
            case ("QRollup"):
                RDataset = "qrollupP";
                if (rConnector.GetRowNamesFromRmatrix(RDataset))
                {
                    proteinList = rConnector.RowNames;
                    plotCommand = "plotScaleData.QRup";
                    pListOK     = true;
                }
                break;

            case ("ZRollup"):
                RDataset = "pData2";     // Use this to get the row names
                if (rConnector.GetRowNamesFromRmatrix(RDataset))
                {
                    proteinList = rConnector.RowNames;
                    plotCommand = "plotScaleData";
                    pListOK     = true;
                }
                RDataset = "pScaled2";     //Now set to what's used for plotting in R
                break;

            case ("RRollup"):
                RDataset = "pData1";     // Use this to get the row names
                if (rConnector.GetRowNamesFromRmatrix(RDataset))
                {
                    proteinList = rConnector.RowNames;
                    plotCommand = "plotRefRUpData";
                    pListOK     = true;
                }
                RDataset = "pScaled1";     //Now set to what's used for plotting in R
                break;

            case ("None<raw>"):
                RDataset = "NULL";     // Use this to get the row names
                try
                {
                    rConnector.EvaluateNoReturn("ProtNames<-unique(ProtInfo[,2])");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                if (rConnector.GetRstringVector("ProtNames"))
                {
                    proteinList = rConnector.Vector;
                    plotCommand = "plotProts.raw";
                    pListOK     = true;
                }
                break;
            }

            if (pListOK)
            {
                var maxColumns    = proteinList.Length;
                var lstBoxEntries = new object[maxColumns];
                proteinList.CopyTo(lstBoxEntries, 0);
                var lboxObjColData = new ListBox.ObjectCollection(mlstBoxProteins, lstBoxEntries);
                mlstBoxProteins.Items.Clear();
                mlstBoxProteins.Items.AddRange(lboxObjColData);
                mNiceLineProts.Caption = "Select a Protein to Plot (Total:" + mlstBoxProteins.Items.Count.ToString() +
                                         ")";
            }
            else
            {
                MessageBox.Show("No proteins found!", "Error");
            }
        }