Пример #1
0
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (settings setDialog = new settings())
     {
         setDialog.ShowDialog();
     }
 }
Пример #2
0
 private void viewerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if(File.Exists(Properties.Settings.Default.bamstats_gui))
     {
         cmdProcess = new Process();
         cmdProcess.StartInfo.FileName = "cmd.exe";
         cmdProcess.StartInfo.Arguments = @"/C java -Xmx8g -jar " + @" """ + Properties.Settings.Default.bamstats_gui + @"""";
         cmdProcess.StartInfo.UseShellExecute = true;
         cmdProcess.StartInfo.CreateNoWindow = false;
         cmdProcess.StartInfo.RedirectStandardOutput = false;
         cmdProcess.Start();
     }
     else
     {
         MessageBox.Show("The GUI Jar file does not exist: /r/n/n"+Properties.Settings.Default.bamstats_gui,"BAMster - File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         using (settings setDialog = new settings())
         {
             setDialog.ShowDialog();
         }
     }
 }
Пример #3
0
        private void executeBtn_Click(object sender, EventArgs e)
        {
            if (sampleList.Items.Count > 0)
            {
                if (executeBtn.Text.ToLower() == "analyze")
                {
                    if (File.Exists(featureBox.Text))
                    {
                        //analyze samples
                        doesnotexist = new StringBuilder();
                        args = new StringBuilder();
                        samps = new StringBuilder();
                        int i = 1;
                        foreach (string path in sampleList.Items)
                        {
                            string bamstatout = Path.GetDirectoryName(path) + @"\bamstats\";
                            string bamstatFN = bamstatout + Path.GetFileName(path) + "_bamster.csv";
                            if (!File.Exists(bamstatFN))
                            {

                                if (!Directory.Exists(bamstatout))
                                {
                                    Directory.CreateDirectory(bamstatout);
                                }
                                if (File.Exists(path))
                                {
                                    string fn = Path.GetFileNameWithoutExtension(path);
                                    args.Append("java -Xmx8g -jar " + @"""" + Properties.Settings.Default.bamstats_api + @"""" + " -v simple -f " + @"""" + featureBox.Text + @"""" + " -i " + @"""" + path + @"""" + " -o " + @"""" + bamstatFN + @"""" + " & ");
                                    samps.AppendLine(i + ".) " + fn);
                                    i++;
                                }
                                else
                                {
                                    doesnotexist.Append("-" + path + Environment.NewLine);
                                }
                            }
                        }

                        if (doesnotexist.Length <= 0)
                        {
                            if (File.Exists(Properties.Settings.Default.bamstats_api))
                            {
                                DialogResult dialogResult = MessageBox.Show("Ready to start analysis?" + Environment.NewLine + Environment.NewLine + "Samples:" + Environment.NewLine + samps.ToString(), "BAMster - Checkpoint", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                if (dialogResult == DialogResult.Yes)
                                {
                                    tabControl.SelectedTab = consoleTab;
                                    terminal.ClearOutput();
                                    resultList.Items.Clear();
                                    utilityBtn.Enabled = false;
                                    executeBtn.Text = "CANCEL";
                                    bamStatus.Text = "Analyzing...";

                                    terminal.StartProcess("cmd.exe", @"/C " + args.ToString(0, args.Length - 2));
                                }
                                else { dialogResult = DialogResult.Cancel; }
                            }
                            else
                            {
                                MessageBox.Show("The API Jar file does not exist: " + Environment.NewLine + Environment.NewLine + Properties.Settings.Default.bamstats_api, "BAMster - File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                using (settings setDialog = new settings())
                                {
                                    setDialog.ShowDialog();
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Input contains file(s) that do not exist, see below:" + Environment.NewLine + doesnotexist.ToString(0, doesnotexist.Length - 1), "BAMster - 404 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                    }
                    else
                    {
                        MessageBox.Show("Please select a valid bed file.", "BAMster - 404 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                }
                else if (executeBtn.Text.ToLower() == "cancel")
                {
                    bamStatus.Text = "Cancelled!";
                    terminal.StopProcess();
                    //cancel analysis
                    executeBtn.Text = "ANALYZE";

                }
            }
        }