Skip to content

Commit

Permalink
fixed IgBLAST startup error handling. No longer hangs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchernys committed Oct 24, 2024
1 parent 5244726 commit feba306
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
```

Expand Down
21 changes: 11 additions & 10 deletions src/run.jl
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand Down

0 comments on commit feba306

Please sign in to comment.