private void mbtnPlot_Click(object sender, EventArgs e)
        {
            var protein = Protein2Plot;

            var proteinRollupDisplay = new frmPlotDisplay();

            if (protein != null)
            {
                var rcmd = plotCommand + "(" + RDataset + ", IPI=\"" + protein + "\",";
                rcmd = rcmd + "Data=" + Dataset + "," + ShowDataLabels + @",file=""" + tempFile + @""")";

                try
                {
                    rConnector.EvaluateNoReturn(rcmd);
                    proteinRollupDisplay.Image = LoadImage(tempFile);
                    proteinRollupDisplay.EnableParameterMenu = false;
                    proteinRollupDisplay.MdiParent           = m_frmDAnTEmdi;
                    proteinRollupDisplay.Title = protein;
                    proteinRollupDisplay.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error in R command: " + rcmd + "\nError: " + ex.Message,
                                    "Exception while talking to R");
                }
            }
            else
            {
                MessageBox.Show("Select a protein first!", "Nothing selected", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        private bool CheckRVersion(string mstrMajor, string mstrMinor)
        {
            bool mblresult;

            try
            {
                var rcmd = @"verOK <- RVersionOK(major=" + mstrMajor + ",minor=" + mstrMinor + ")";
                mRConnector.EvaluateNoReturn(rcmd);
                ////object rout = rConnector.GetSymbol("verOK");
                ////mblresult = (bool)rout;
                mblresult = mRConnector.GetSymbolAsBool("verOK");
            }
            catch (Exception ex)
            {
                mblresult = false;
                Console.WriteLine("Exception thrown: " + ex.Message, "Error!");
            }
            return(mblresult);
        }
Esempio n. 4
0
        private void CreatSpectralCountTablesSEQSYN(ICollection <string> datasetNames, DoWorkEventArgs e)
        {
            var dir = new DirectoryInfo(mstrAnalysisFolder);

            foreach (var f in dir.GetFiles())
            {
                if (!f.Name.EndsWith("_syn.txt", StringComparison.CurrentCultureIgnoreCase))
                {
                    continue;
                }

                var dName = f.Name.Substring(0, f.Name.IndexOf("_syn.txt", StringComparison.CurrentCultureIgnoreCase));
                if (datasetNames.Contains(dName))
                {
                    successfulDataSets.Add(dName);
                }
            }

            if (successfulDataSets.Count > 1)
            {
                var fileList   = @"c(""" + successfulDataSets[0];
                var rcmd       = "X <- createMSMSdt.SpectralCount(";
                var dataFolder = mstrAnalysisFolder.Replace("\\", "/");
                for (var i = 1; i < successfulDataSets.Count; i++)
                {
                    fileList = fileList + @""",""" + successfulDataSets[i];
                }
                fileList += @""")";

                rcmd += fileList + @",""" + dataFolder + @""",XcRank=" + XcRank +
                        "," + XCorrTh + "," + DelCn2Th + "," + TrypState + ")";

                try
                {
                    backgroundWorker1.ReportProgress(70,
                                                     "Creating peptide count table ... may take a while for large datasets ...");
                    rConnector.EvaluateNoReturn(rcmd);
                    rConnector.EvaluateNoReturn("Eset <- X$eset");
                    rConnector.EvaluateNoReturn("EsetRows <- X$rows");
                    var rows = rConnector.GetSymbolAsNumbers("EsetRows");
                    if ((int)rows[0] > 0)
                    {
                        if (rConnector.GetTableFromRmatrix("Eset"))
                        {
                            mDTEset           = rConnector.DataTable.Copy();
                            mDTEset.TableName = "Eset";
                            rConnector.EvaluateNoReturn("cat(\"Spectral count data obtained.\n\")");
                            e.Result = enmDataType.ESET;
                        }
                        else
                        {
                            e.Result = null;
                        }
                    }
                    else
                    {
                        e.Result = null;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("R.Net failed: " + ex.Message, "Error!");
                    e.Result = null;
                    e.Cancel = true;
                }
                backgroundWorker1.ReportProgress(100, "Done.");
            }
            else
            {
                backgroundWorker1.ReportProgress(100, "You need at leaset two unique datasets... Giving up.");
            }
        }