# Set environmental variable for BLAST analysis via Julia

**URL:** <https://discourse.julialang.org/t/set-environmental-variable-for-blast-analysis-via-julia/31498>\
**Category:** General Usage\
**Created:** [November 25, 2019, 3:13pm UTC](https://discourse.julialang.org/t/set-environmental-variable-for-blast-analysis-via-julia/31498 "2019-11-25T15:13:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [November 25, 2019, 3:13pm UTC](https://discourse.julialang.org/t/set-environmental-variable-for-blast-analysis-via-julia/31498/1 "2019-11-25T15:13:11Z")

</div>

Hello  
I am using a shell command called `blastx` to find some organism’s names from a sequencing experiment. This program requires the definition of an environmental variable BLASTDB pointing to a specific directory inside my machine (~/blast/bin).

I tried with `run(`export BLASTDB=“~/blast/bin”`)` but I get:

```julia
julia> run(`export BLASTDB="/home/gigiux/src/blast/bin"`)
ERROR: IOError: could not spawn `export BLASTDB=/home/gigiux/src/blast/bin`: no such file or directory (ENOENT)
Stacktrace:
 [1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:367
 [2] (::getfield(Base, Symbol("##493#494")){Cmd})(::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:509
 [3] setup_stdio(::getfield(Base, Symbol("##493#494")){Cmd}, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:490
 [4] #_spawn#492(::Nothing, ::Function, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:508
 [5] _spawn at ./process.jl:504 [inlined]
 [6] #run#503(::Bool, ::Function, ::Cmd) at ./process.jl:662
 [7] run(::Cmd) at ./process.jl:661
 [8] top-level scope at none:0

```

I then created a shell script `fetcher.sh` that runs blast and directly sets BLASTDB; when I run it on the terminal it works:

```julia
$ ./fetcher.sh 
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria
Bacteria

```

but if I launch it from julia I get stuck; stopping the process I get:  
julia\> x\_blast = read(pipeline(`.../fetcher.sh`), String)  
Critical: [blastx] External MBEDTLS version mismatch: 2.16.0 headers vs. 2.16.2 runtime  
ERROR: InterruptException:  
Stacktrace:  
[1] try\_yieldto(::typeof(Base.ensure\_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196  
[2] wait() at ./event.jl:255  
[3] wait(::Condition) at ./event.jl:46  
[4] wait\_readnb(::Base.PipeEndpoint, ::Int64) at ./stream.jl:297  
[5] read at ./stream.jl:715 [inlined]  
[6] read(::Pipe) at ./io.jl:231  
[7] read(::Cmd) at ./process.jl:635  
[8] read(::Cmd, ::Type{String}) at ./process.jl:645  
[9] top-level scope at none:0

Is there a way to properly run an external script?
