From feba306a22c9c2944c286d5cbd2a336ce8852a8d Mon Sep 17 00:00:00 2001 From: Mark Chernyshev Date: Thu, 24 Oct 2024 16:14:04 +0200 Subject: [PATCH] fixed IgBLAST startup error handling. No longer hangs. --- README.md | 2 +- src/run.jl | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2039f80..134b282 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ run_igblast( "data/Macaca_mulatta_J.fasta", "data/rhesus_monkey_gl.aux", "ERR4238106.tsv", - additional_params = Dict("organism" => "rhesus_monkey", "ig_seqtype" => "ig") + additional_params = Dict("organism" => "rhesus_monkey", "ig_seqtype" => "Ig") ) ``` diff --git a/src/run.jl b/src/run.jl index 2506259..b63cfa0 100644 --- a/src/run.jl +++ b/src/run.jl @@ -1,9 +1,9 @@ """ run_igblast( igblast_type::Type{T}, - query_file::String, - v_database::String, - d_database::String, + query_file::String, + v_database::String, + d_database::String, j_database::String, aux_file::String, output_file::String, @@ -39,9 +39,9 @@ run_igblast(IgBLASTn, "query.fasta", "V.fasta", "D.fasta", "J.fasta", "aux.txt", """ function run_igblast( igblast_type::Type{T}, - query_file::String, - v_database::String, - d_database::String, + query_file::String, + v_database::String, + d_database::String, j_database::String, aux_file::String, output_file::String, @@ -138,7 +138,9 @@ function run_igblast( end end - process = run(cmd, wait=false) + out = IOBuffer() + err = IOBuffer() + process = run(pipeline(cmd, stdout=out, stderr=err), wait=false) while process_running(process) if isready(done_channel) @@ -154,9 +156,8 @@ function run_igblast( end if !success(process) - error_output = read(stderr, String) - @error "IgBLAST failed to run successfully" error_output - error("IgBLAST execution failed. Check the error message above.") + error_output = String(take!(err)) + error("$(error_output)\nIgBLAST execution failed. Check the error message above.") end @info "IgBLAST analysis completed. Output saved to $output_file"