internal static WSLProxyResponse VFabricate() { // ./VFabricateBioSeqDB.sh ${samplepath} $contig $vfabricate $output path //# $1 Sample name (Use 'Abricate' when no sample picked). //# $2 Input contig path //# $3 Gene XRef path //# $4 Output folder string inputFile = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.InputPath("VFabricate")); string sampleName = "Abricate"; if (AppConfigHelper.SampleChecked("VFabricate")) { // First extract the fasta file from the database. sampleName = AppConfigHelper.SampleID("VFabricate"); WSLProxyResponse WSLResponse = ExtractSample(sampleName, AppConfigHelper.NormalizePathToLinux("C:\\Temp")); if (WSLResponse.ExitCode != 0) { return(WSLResponse); } inputFile = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/" + AppConfigHelper.SampleID("VFabricate") + ".fasta"; } AppConfigHelper.LastCommand = AppConfigHelper.CondaPrefixAbricate() + " ~/VFabricateBioSeqDB.sh " + sampleName + " " + inputFile + " " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.VFabricateGeneXref) + " " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("VFabricate") //+ " &> /mnt/c/Temp/stderr.txt" ); return(StandardCallToWSL()); }
internal static WSLProxyResponse Quast() { // /usr/local/quast-5.0.2/quast.py -o quastRA --glimmer $contig string inputFile = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.InputPath("Quast")); string sampleName = "Quast"; if (AppConfigHelper.SampleChecked("Quast")) { // First extract the fasta file from the database. sampleName = AppConfigHelper.SampleID("Quast"); WSLProxyResponse WSLResponse = ExtractSample(sampleName, AppConfigHelper.NormalizePathToLinux("C:\\Temp")); if (WSLResponse.ExitCode != 0) { return(WSLResponse); } inputFile = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/" + AppConfigHelper.SampleID("Quast") + ".fasta"; } AppConfigHelper.LastCommand = "/usr/local/quast-5.0.2/quast.py -o " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("Quast") + "/quast" + sampleName + " --glimmer " + inputFile //+ " &> /mnt/c/Temp/stderr.txt" ); return(StandardCallToWSL()); }
private void mnuRemove_Click(object sender, EventArgs e) { BioSeqRemove frm = new BioSeqRemove(); DialogResult rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; //int ret = SeqDBHelper.RemoveSample(); // Parameters are in appsettings. WSLProxyResponse WSLResponse = ServiceCallHelper.RemoveSample(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings. ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser); // To retrieve StandardOutput and LastError. Cursor.Current = Cursors.Default; if (WSLResponse.ExitCode == 0) { MessageBox.Show(AppConfigHelper.RemoveSampleID() + " successfully removed.", "Success", MessageBoxButtons.OK); AppConfigHelper.RemoveSample(string.Empty); // So we don't prompt for it again. ReloadSampleIDs(); // Reload list without sample ID. } else { MessageBox.Show("Remove completed with error code " + WSLResponse.ExitCode.ToString() + "." + Environment.NewLine + Environment.NewLine + AppConfigHelper.StandardOutput + Environment.NewLine + AppConfigHelper.LastError, "Error", MessageBoxButtons.OK); } } }
private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { BioSeqTask task = AppConfigHelper.TaskOfID(AppConfigHelper.LastTaskID); WSLProxyResponse WSLResponse = null; switch (task.TaskType) { case "Centrifuge": WSLResponse = ServiceCallHelper.Centrifuge(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Salmonella": WSLResponse = ServiceCallHelper.Salmonella(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "VFabricate": WSLResponse = ServiceCallHelper.VFabricate(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Search": WSLResponse = ServiceCallHelper.SearchSample(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Kraken2": WSLResponse = ServiceCallHelper.Kraken2(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Quast": WSLResponse = ServiceCallHelper.Quast(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "BBMap": WSLResponse = ServiceCallHelper.BBMap(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "BuildTree": WSLResponse = ServiceCallHelper.BuildTree(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Assemble": WSLResponse = ServiceCallHelper.Assemble(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig(), AppConfigHelper.QuerySampleConfig()); break; case "InfluenzaA": WSLResponse = ServiceCallHelper.InfluenzaA(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; case "Nextstrain": WSLResponse = ServiceCallHelper.Nextstrain(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); break; } task.LastError = WSLResponse.StandardError; task.StandardOutput = WSLResponse.StandardOutput; e.Result = new List <object>() { WSLResponse.ExitCode, task }; }
private void btnReset_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; WSLProxyResponse WSLResponse = BioSeqDBModel.Instance.NextstrainReset(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); Cursor.Current = Cursors.Default; if (WSLResponse.ExitCode == 0) { MessageBox.Show("Nextstrain reset complete.", "COMPLETE", MessageBoxButtons.OK); } else { MessageBox.Show("Nextstrain reset error " + WSLResponse.ExitCode.ToString() + Environment.NewLine + WSLResponse.StandardError + ".", "ERROR", MessageBoxButtons.OK); } }
public static WSLProxyResponse Kraken2() { WSLProxyResponse WSLResponse = null; string inputFile = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.InputPath("Kraken2")); if (AppConfigHelper.SampleChecked("Kraken2")) { // First extract the fasta file from the database. WSLResponse = ExtractSample(AppConfigHelper.SampleID("Kraken2"), AppConfigHelper.NormalizePathToLinux("C:\\Temp")); if (WSLResponse.ExitCode == 0) { inputFile = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/" + AppConfigHelper.SampleID("Kraken2") + ".fasta"; } else { return(WSLResponse); } } // eg. /usr/local/kraken2/kraken2 --db /data/referenceDB/minikraken2_v1_8GB/ --threads 64 --report kraken.aggregates.txt --use-names --output kraken.txt $contig // conda run -n refseq_masher-0.1.1 refseq_masher matches --output-type tab -o RefseqIdent.txt $contig AppConfigHelper.LastCommand = "/usr/local/kraken2/kraken2 --db /data/referenceDB/minikraken2_v1_8GB/ --threads 16 --report " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("Kraken2") + "/kraken.aggregates.txt") + " --use-names --output " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("Kraken2") + "/kraken.txt") + " " + inputFile; WSLResponse = StandardCallToWSL(); if (WSLResponse.ExitCode == 0) { AppConfigHelper.LastCommand = "conda run -n refseq_masher-0.1.1 refseq_masher matches --output-type tab -o " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("Kraken2") + "/RefseqIdent.txt ") + inputFile; if (AppConfigHelper.SampleChecked("Kraken2")) { File.Delete("C:\\Temp\\" + AppConfigHelper.SampleID("Kraken2") + ".fasta"); } return(StandardCallToWSL()); } return(WSLResponse); }
private void mnuRestore_Click(object sender, EventArgs e) { BioSeqRestore frm = new BioSeqRestore(txtVersions.Text.Trim()); DialogResult rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; WSLProxyResponse WSLResponse = ServiceCallHelper.RestoreDatabase(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings. ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser); // To retrieve StandardOutput and LastError. Cursor.Current = Cursors.Default; if (WSLResponse.ExitCode == 0) { ReloadSampleIDs(); // Reload list without sample ID. MessageBox.Show(AppConfigHelper.StandardOutput + Environment.NewLine + "Restore successfully completed.", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("Restore completed with error code " + WSLResponse.ExitCode.ToString() + "." + Environment.NewLine + Environment.NewLine + AppConfigHelper.StandardOutput + Environment.NewLine + AppConfigHelper.LastError, "Error", MessageBoxButtons.OK); } } }
private static WSLProxyResponse StandardCallToWSL() { //string prefix = "cd;export PATH=/home/arnie/.local/bin:/home/arnie/bin:/snap/bin:/home/arnie/.dotnet/tools:$PATH;"; // Prepend to each invocation of wsl. AppConfigHelper.StandardOutput = string.Empty; AppConfigHelper.LastError = string.Empty; AppConfigHelper.LastExitCode = 0; Logger.Log.Debug("StandardCallToWSL: " + AppConfigHelper.LastUser + " CMD: " + AppConfigHelper.LastCommand); var info = new ProcessStartInfo(AppConfigHelper.PathToWSL(), "bash -ic '" + AppConfigHelper.CondaPrefix() + " " + AppConfigHelper.LastCommand + "'") { WorkingDirectory = AppConfigHelper.NormalizePathToWindows(AppConfigHelper.LinuxHomeDirectory), UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true }; WSLProxyResponse WSLResponse = new WSLProxyResponse(); int rc = -1; using (var p = Process.Start(info)) { p.WaitForExit(); RecordStandardOutput(p); rc = p.ExitCode; WSLResponse.ExitCode = rc; WSLResponse.StandardOutput = p.StandardOutput.ReadToEnd(); WSLResponse.StandardError = p.StandardError.ReadToEnd(); p.Close(); } return(WSLResponse); }
private void mnuBackup_Click(object sender, EventArgs e) { BioSeqBackup frm = new BioSeqBackup(); DialogResult rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; WSLProxyResponse WSLResponse = ServiceCallHelper.BackupDatabase(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings. ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser); // To retrieve StandardOutput and LastError. Cursor.Current = Cursors.Default; if (WSLResponse.ExitCode == 0) { RefreshVersionInformation(AppConfigHelper.seqdbConfig.seqDBs[AppConfigHelper.seqdbConfig.LastDBSelected]); MessageBox.Show(AppConfigHelper.StandardOutput + Environment.NewLine + "Backup successfully completed.", "Success", MessageBoxButtons.OK); // Refresh backup version display. } else { MessageBox.Show("Backup completed with error code " + WSLResponse.ExitCode.ToString() + "." + Environment.NewLine + Environment.NewLine + AppConfigHelper.StandardOutput + Environment.NewLine + AppConfigHelper.LastError, "Error", MessageBoxButtons.OK); } } }
private void mnuExtract_Click(object sender, EventArgs e) { BioSeqExtract frm = new BioSeqExtract(); DialogResult rc = frm.ShowDialog(); if (rc == DialogResult.OK) // then the config has the specs { Cursor.Current = Cursors.WaitCursor; // Parameters are in appsettings. WSLProxyResponse WSLResponse = ServiceCallHelper.Extract(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings. ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser); // To retrieve StandardOutput and LastError. Cursor.Current = Cursors.Default; if (WSLResponse.ExitCode == 0) { MessageBox.Show(AppConfigHelper.StandardOutput + Environment.NewLine + "Extract completed successfully. Result is in " + AppConfigHelper.ExtractOutputPath() + "\\" + AppConfigHelper.ExtractSampleID() + ".fasta", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("Extract completed with error code " + WSLResponse.ExitCode.ToString() + "." + Environment.NewLine + Environment.NewLine + AppConfigHelper.StandardOutput + Environment.NewLine + AppConfigHelper.LastError, "Error", MessageBoxButtons.OK); } } }
internal static WSLProxyResponse BBMap() { WSLProxyResponse WSLResponse = null; string inputFile = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.InputPath("BBMap")); if (AppConfigHelper.SampleChecked("BBMap")) { // First extract the fasta file from the database. WSLResponse = ExtractSample(AppConfigHelper.SampleID("BBMap"), AppConfigHelper.NormalizePathToLinux("C:\\Temp")); if (WSLResponse.ExitCode != 0) { return(WSLResponse); } inputFile = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/" + AppConfigHelper.SampleID("BBMap") + ".fasta"; } // Might need to consolidate multiple fastq files into one. string fastqPath = AppConfigHelper.BBMapFastqPath(); string[] files = Directory.GetFiles(fastqPath, "*.fastq", SearchOption.TopDirectoryOnly); if (files.Length == 0) { WSLResponse = new WSLProxyResponse(); WSLResponse.ExitCode = -3; WSLResponse.StandardError = "No *.fastq files found in " + fastqPath + "."; return(WSLResponse); } // cat $samplePath/*.fastq > ${sampleName}.fastq string fastqOutput = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/sample.fastq"; ProcessStartInfo infoCat = new ProcessStartInfo(AppConfigHelper.PathToWSL(), "bash -ic 'cat " + AppConfigHelper.NormalizePathToLinux(fastqPath) + "/*.fastq > " + fastqOutput + "'") { UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, // We can catch the output here. RedirectStandardError = true }; Process P = Process.Start(infoCat); P.WaitForExit(); int result = P.ExitCode; if (result != 0) { WSLResponse = new WSLProxyResponse(); WSLResponse.ExitCode = -2; WSLResponse.StandardError = "Catenate to output " + fastqOutput + " failed for " + fastqPath + "."; return(WSLResponse); } // Convert fastq to fastq // seqtk seq -A BC87_reads.fastq > sample.fasta string fastaReads = AppConfigHelper.NormalizePathToLinux("C:\\Temp") + "/sample.fasta"; infoCat = new ProcessStartInfo(AppConfigHelper.PathToWSL(), "bash -ic 'seqtk seq -A " + fastqOutput + " > " + fastaReads + "'") { UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, // We can catch the output here. RedirectStandardError = true }; P = Process.Start(infoCat); P.WaitForExit(); result = P.ExitCode; if (result != 0) { WSLResponse = new WSLProxyResponse(); WSLResponse.ExitCode = -4; WSLResponse.StandardError = P.StandardError.ReadToEnd(); WSLResponse.StandardOutput = P.StandardOutput.ReadToEnd(); return(WSLResponse); } P.Close(); // /usr/local/bbmap/bbmap.sh nodisk=f ref=BC87_trinity_assembly_minimap2/Trinity.fasta in=sample.fasta covstats=covstats.txt covhist=covhist.txt basecov=basecov.txt bincov=bincov.txt // rm sample.fasta string outputPath = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.OutputPath("BBMap")); string bbmapInvocation = AppConfigHelper.CondaPrefix() + " bbmap.sh"; // On my machine, bbmap.sh is installed in conda. if (true) { bbmapInvocation = "/usr/local/bbmap/bbmap.sh"; // Where bbmap.sh is installed on WIMMER (set condition to true). } AppConfigHelper.LastCommand = bbmapInvocation + " nodisk=f ref=" + inputFile + " in=" + fastaReads + " covstats=" + outputPath + "/covstats.txt covhist=" + outputPath + "/covhist.txt basecov=" + outputPath + "/basecov.txt bincov=" + outputPath + "/bincov.txt"; WSLResponse = StandardCallToWSL(); if (WSLResponse.ExitCode == 0) { AppConfigHelper.LastCommand = "conda run -n refseq_masher-0.1.1 refseq_masher matches --output-type tab -o " + outputPath + "/RefseqIdent.txt " + inputFile; WSLResponse = StandardCallToWSL(); if (WSLResponse.ExitCode == 0) { if (AppConfigHelper.SampleChecked("BBMap")) { File.Delete("C:\\Temp\\" + AppConfigHelper.SampleID("BBMap") + ".fasta"); } // Get rid of sample.fasta and the fastq file. if (File.Exists(@"c:\Temp\sample.fastq")) { File.Delete(@"c:\Temp\sample.fastq"); } if (File.Exists(@"c:\Temp\sample.fasta")) { File.Delete(@"c:\Temp\sample.fasta"); } } } return(WSLResponse); }
public static WSLProxyResponse AssembleSamples(string config) { // eg. ./assembleRANF.sh --fast_polish --flye –-bbmap skip|normal –-quast skip|normal –-kraken skip|normal --complete_signal /mnt/c/Temp/assemble000003.txt /mnt/c/Temp/samples.txt File.WriteAllText("C:\\Temp\\samples.txt", config); AppConfigHelper.StandardOutput = string.Empty; AppConfigHelper.LastError = string.Empty; AppConfigHelper.LastExitCode = 0; //int taskid = AppConfigHelper.MaxTaskID() + 1; //BioSeqTask task = new BioSeqTask() //{ // //TaskData = @"C:\Temp\Assemble" + taskid.ToString("000000") + ".txt", // TaskDB = string.Empty, // No database involved in context of this call. // TaskID = taskid.ToString(), // TaskStatus = "Pending", // TaskTime = DateTime.Now, // TaskComplete = DateTime.MinValue, // TaskType = "Assemble", // TaskUser = AppConfigHelper.LastUser, // StandardOutput = string.Empty, // LastError = string.Empty, // LastExitCode = -999 //}; //AppConfigHelper.AddTask(task); // Return contents of the TaskData file: // Line 1: return code // Line 2-n: standard output plus error output. if (AppConfigHelper.AssembleTrinity()) { string hostref = AppConfigHelper.NormalizePathToLinux(AppConfigHelper.AssembleHostReference); AppConfigHelper.LastCommand = AppConfigHelper.PathToNextFlowScript() + " --Trinity --virusRef " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.AssembleVirusReference) + " " + (hostref.Length > 0 ? " --hostRef " + hostref : string.Empty) + " " + AppConfigHelper.LinuxCDrive() + "/Temp/samples.txt"; } else { string VFabricate = " --VFabricate "; if (AppConfigHelper.AssembleVFabricate()) { VFabricate += AppConfigHelper.NormalizePathToLinux(AppConfigHelper.AssembleVFGeneXRef); } else { VFabricate += "skip"; } AppConfigHelper.LastCommand = AppConfigHelper.PathToNextFlowScript() + " " + (AppConfigHelper.AssembleFastPolish() ? "--fast_polish" : string.Empty) + " " + (AppConfigHelper.AssembleFlye() ? "--flye" : string.Empty) + " --bbmap " + (AppConfigHelper.AssembleBBmap() ? "normal" : "skip") + " --quast " + (AppConfigHelper.AssembleQuast() ? "normal" : "skip") + VFabricate + " --kraken " + (AppConfigHelper.AssembleKraken2() ? "normal" : "skip") + " " + AppConfigHelper.LinuxCDrive() + "/Temp/samples.txt"; } // DEBUG HELPER: //AppConfigHelper.LastCommand = "~/makeassemble.sh " + AppConfigHelper.NormalizePathToLinux(task.TaskData); //AppConfigHelper.LastCommand = "~/assembleRA.sh PDS2021318subset /mnt/e/data/Crick/PDS_Diagnostics_2020/PDS2021318subset"; Logger.Log.Debug("AssembleSamples: " + AppConfigHelper.LastUser + " CMD: " + AppConfigHelper.LastCommand); RunInBackground(AppConfigHelper.LastCommand, AppConfigHelper.LastTaskID); WSLProxyResponse WSLResponse = new WSLProxyResponse(); WSLResponse.ExitCode = 0; return(WSLResponse); }
public static WSLProxyResponse BuildTree() { //string prefix = "cd;export PATH=/home/arnie/.local/bin:/home/arnie/bin:/snap/bin:/home/arnie/.dotnet/tools:$PATH;conda run -n phame "; // Prepend to each invocation of wsl. //prefix = "conda run -n phame "; // eg. seqdb build_tree -n 50 -t 1 –fast_tree -l query.list -r reference.fasta -o path/to/output_dir -d path/to/seqdb_database. // First we need to build a file containing the contents of the query list. List <string> checkedQueries = new List <string>(); string[] queryList = AppConfigHelper.BuildTreeQueryList().ToArray(); for (int i = 0; i < queryList.Length; i++) { string s1 = queryList[i]; if (s1.StartsWith("1")) { checkedQueries.Add(AppConfigHelper.NormalizePathToLinux(s1.Substring(1))); // Remove 'selected' indicator. } } queryList = checkedQueries.ToArray(); Array.Resize(ref queryList, queryList.Length + 1); // Add an empty line to give us a final LF. queryList[queryList.Length - 1] = string.Empty; File.WriteAllText(@"C:\Temp\queryList.txt", string.Join("\n", queryList)); if (File.Exists(AppConfigHelper.BuildTreeOutputPath() + "\\tree.nwk")) { File.Delete(AppConfigHelper.BuildTreeOutputPath() + "\\tree.nwk"); } //int taskid = AppConfigHelper.MaxTaskID() + 1; //BioSeqTask task = new BioSeqTask() //{ // //TaskData = AppConfigHelper.BuildTreeOutputPath() + "\\tree.nwk", // TaskDB = AppConfigHelper.CurrentDBName(), // TaskID = taskid.ToString(), // TaskStatus = "Pending", // TaskTime = DateTime.Now, // TaskComplete = DateTime.MinValue, // TaskType = "BuildTree", // TaskUser = AppConfigHelper.LastUser, // StandardOutput = string.Empty, // LastError = string.Empty, // LastExitCode = -999 //}; //AppConfigHelper.AddTask(task); //TaskID = task.TaskID; string referenceToUse = AppConfigHelper.BuildTreeChooseDomestic ? AppConfigHelper.BuildTreeDomesticReference : AppConfigHelper.BuildTreeWildReference(); string linkage = string.Empty; string cutoff = string.Empty; switch (AppConfigHelper.BuildTreeLinkage) { case 0: linkage = "threshold"; cutoff = " -c " + AppConfigHelper.BuildTreeThreshold; break; case 1: linkage = "tophits"; cutoff = " -c " + AppConfigHelper.BuildTreeHits; break; case 2: linkage = "cluster"; break; } WSLProxyResponse WSLResponse = new WSLProxyResponse(); WSLResponse.ExitCode = 0; AppConfigHelper.LastCommand = AppConfigHelper.CondaPrefix() + " " + AppConfigHelper.PathToSeqDB() + " build_tree " + (AppConfigHelper.BuildTreeFastTree() ? "--fast_tree " : string.Empty) + "--linkage " + linkage + cutoff + " -l " + AppConfigHelper.NormalizePathToLinux("C:\\Temp\\queryList.txt") + " -r " + AppConfigHelper.NormalizePathToLinux(referenceToUse) + " -t " + AppConfigHelper.BuildTreeThreads() + " -d " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.CurrentDBPath()) + " -o " + AppConfigHelper.NormalizePathToLinux(AppConfigHelper.BuildTreeOutputPath()); if (AppConfigHelper.BuildTreeFastTree()) // Submit and look for tree.nwk. { FileSystemWatcher _watcher = new FileSystemWatcher(AppConfigHelper.BuildTreeOutputPath()); _watcher.Created += _watcher_Created; _watcher.Filter = "tree.nwk"; _watcher.EnableRaisingEvents = true; AppConfigHelper.StandardOutput = string.Empty; AppConfigHelper.LastError = string.Empty; AppConfigHelper.LastExitCode = 0; Logger.Log.Debug("BuildTree: " + AppConfigHelper.LastUser + " CMD: " + AppConfigHelper.LastCommand); var info = new ProcessStartInfo(AppConfigHelper.PathToWSL(), "bash -ic '" + AppConfigHelper.CondaPrefix() + " " + AppConfigHelper.LastCommand + " &> " + AppConfigHelper.LinuxHomeDirectory + "/output" + AppConfigHelper.LastTaskID.ToString() + "'") { WorkingDirectory = AppConfigHelper.NormalizePathToWindows(AppConfigHelper.LinuxHomeDirectory), UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true }; Process P = Process.Start(info); WSLResponse.StandardError = P.StandardError.ReadToEnd(); WSLResponse.StandardOutput = P.StandardOutput.ReadToEnd(); } else { RunInBackground(AppConfigHelper.LastCommand, AppConfigHelper.LastTaskID); } return(WSLResponse); }