I'm new to bash. I have installed "seqtk" and "magicblast" in my shell calling "conda install" on terminal, and they work properly when I directly called them on terminal or write them in a bash script(test.sh) and then run that script on terminal.
This is test.sh
#!/bin/bash
var1=$(sed 's/\.fastq\.gz/\.fa/' <<< $1)
seqtk seq -a $1 > $(basename $var1)
and this would work
$./test.sh sample_folder/sample_R1.fastq.gz
But when I tried to run the script using python(test.ipynb)
import os
os.system("./test.sh sample_folder/sample_R1.fastq.gz")
it gives me "seqtk: command not found"
I searched on Google and thought it's because I installed the commands in my shell but 'os.system' would start a new shell and run the commands there, that's why test.ipynb shows "command not found" while the commands can work properly on terminal.
I'm wondering how could I solve this issue.
Thanks in advance!
I also tried using "source" to solve this by os.system("source HOME/.bash_aliases"), and this failed and shows "source: not found". I don't really know how to use this command.
A quick workaround is doing this in Python:
However, for long term maintainability, you should activate the virtual environment instead. Doing so will take care of modifying
PATHand other relevant environment variables. See the answer by @KurtisRader for details.