private void btnOK_Click(object sender, EventArgs e) { // TODO: Should check the validity of the paths here. AppConfigHelper.OutputPath(analysis, txtOutputPath.Text.Trim()); AppConfigHelper.SampleChecked(analysis, radSample.Checked); AppConfigHelper.TaskMemo = txtMemo.Text.Trim(); if (analysis == "Kraken2") { AppConfigHelper.Kraken2UseFastq = radUseFastq.Checked; if (radUseFastq.Checked) { AppConfigHelper.Kraken2FastqPath = txtInputPath.Text.Trim(); } } if (analysis == "BBMap") { AppConfigHelper.BBMapFastqPath(analysis, txtFastqPath.Text.Trim()); string fastqPath = txtFastqPath.Text.Trim(); if (IsServiceClass.IsService) { if (fastqPath.StartsWith("[L]")) // Not extract sample ID { ServiceCallHelper.ResetFastqFolder(AppConfigHelper.LoggedOnUser); string[] files = Directory.GetFiles(DirectoryHelper.CleanPath(fastqPath), "*.fastq", SearchOption.TopDirectoryOnly); foreach (string file in files) { DirectoryHelper.FileCopy("[L]" + file, "[S]" + AppConfigHelper.UserFolder() + "FastqFiles", true); } } } } if (analysis == "VFabricate") { AppConfigHelper.VFabricateGeneXref = txtFastqPath.Text.Trim(); } if (analysis == "Search") { if (!float.TryParse(txtCutoff.Text, out float cutoff)) { MessageBox.Show("A cutoff number between 0 and 1 is required.", "Missing cutoff", MessageBoxButtons.OK); txtCutoff.Focus(); DialogResult = DialogResult.None; return; } if (cutoff < 0.0 || cutoff > 1.0) { MessageBox.Show("A cutoff number between 0 and 1 is required.", "Invalid cutoff", MessageBoxButtons.OK); txtCutoff.Focus(); DialogResult = DialogResult.None; return; } if (radContig.Checked && !DirectoryHelper.FileExists(AppConfigHelper.NormalizePathToWindows(txtInputPath.Text))) { MessageBox.Show(txtInputPath.Text + " does not exist. Choose a valid input file.", "Invalid input file", MessageBoxButtons.OK); txtInputPath.Focus(); DialogResult = DialogResult.None; return; } if (!DirectoryHelper.DirectoryExists(AppConfigHelper.NormalizePathToWindows(txtOutputPath.Text))) { MessageBox.Show(txtOutputPath.Text + " does not exist. Choose a valid output path.", "Invalid output path", MessageBoxButtons.OK); txtOutputPath.Focus(); DialogResult = DialogResult.None; return; } // Update config to reflect selection. AppConfigHelper.SearchSample(txtOutputSampleName.Text, txtOutputPath.Text, txtInputPath.Text.Trim(), txtCutoff.Text, txtThreads.Text); } if (radSample.Checked) { if (lstSampleIDs.SelectedIndex == -1) { MessageBox.Show("Select a sample from the sample list", "ERROR", MessageBoxButtons.OK); return; } AppConfigHelper.SampleID(analysis, lstSampleIDs.SelectedItem.ToString().Trim()); } else // If the txtInputPath is local, send it to the UserFolder() on the server. { string inputPath = txtInputPath.Text.Trim(); if (!radSample.Checked && IsServiceClass.IsService) { if (inputPath.StartsWith("[L]")) // Not extract sample ID { DirectoryHelper.FileCopy(inputPath, AppConfigHelper.UserFolder(), true); } } AppConfigHelper.InputPath(analysis, inputPath); } }