2
$\begingroup$

I am trying to analyze my RNAseq reads for defective genomes and I use this program (http://www.di-tector.cyame.eu/) that is suggested by Beauclair et al (https://pubmed.ncbi.nlm.nih.gov/30012569/) for that.

After downloading a .py script and running it with the following command:

sudo python3 DI-tector_06.py /mnt/e/nastya/SLX066-02/sequence.fasta /mnt/e/nastya/SLX066-02/B-dVMV-RIG-1/B-dVMV-RIG-1_ACAGTG_L008_R1_001.rc.fastq.gz 

It says at the beginning that

=================================
Program: DI-tector
Version: 0.6 - Last modified 25/05/2018
=================================
Requirement: (must be in your $PATH)
-bwa
-samtools

Optional: (must be in your $PATH)
-bedtools

I have tried to install bwa using:

sudo apt-get update -y
sudo apt-get install -y bwa

and samtools using

cd /usr/local/bin
sudo wget https://github.com/samtools/samtools/releases/download/1.9/samtools-1.9.tar.bz2
sudo tar -vxjf samtools-1.9.tar.bz2
cd samtools-1.9
sudo make

I did not get exactly what does that mean: (must be in your $PATH) but I have searched here and there and discovered that it might mean /usr/local/bin

The program starts and, after some calculations it gives me the following error:

Input file:               /mnt/e/nastya/SLX066-02/B-dVMV-RIG-1/B-dVMV-RIG-1_ACAGTG_L008_R1_001.rc.fastq.gz
Host reference:           None
Virus reference:          /mnt/e/nastya/SLX066-02/sequence.fasta
Remove segment:         < 15 nt
Remove reads with MAPQ: < 25
Allow InDel. length:    > 1 nt

=================================
Reading gziped input file...
=================================
Number of reads in input file: 18,035,544
=================================

=================================
Step 1/5 : Alignment against Viral reference...Filtering...
=================================
[E::bwa_idx_load_from_disk] fail to locate the index files
Traceback (most recent call last):
  File "DI-tector_06.py", line 183, in <module>
    Popen(["samtools", "view", "-Sb", "-F", "4"], stdin=out_file_onVirus, stdout=out_file_Virus).communicate()[0]
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'samtools'

I have no idea how samtools must be accessed, I tried sudo command with python3 but it did not work.

$\endgroup$
3
  • $\begingroup$ generally, if you type sudo make install, after you run sudo make, it will install the binary in your $PATH and you won't need to worry about adding it there afterwards $\endgroup$
    – user438383
    Jun 17 '20 at 10:24
  • $\begingroup$ A piece of advice: Dont "over-sudo": You shouldn't need sudo to run a data analysis program. When installing samtools, avoid downloading stuff in /usr/local/bin: Do it in a local directory (I would recommend having a $HOME/src for that), and use sudo only to install the program to /usr/local/bin. $\endgroup$
    – bli
    Jun 19 '20 at 9:28
  • $\begingroup$ "Permission denied: 'samtools'" may mean that the samtools "executable" is actually not executable. This can be because it is on a disk that doesn't allow execution of files, but more likely it just needs a fix of the file permission (chmod +x <path_to_samtools>). $\endgroup$
    – bli
    Jun 19 '20 at 9:41
3
$\begingroup$

echo $PATH will show the directories in your search path. Either copy the samtools executable there or add its location to the $PATH variable. You would be well served with a unix command line course or tutorial.

$\endgroup$
2
$\begingroup$

you can add a directory to $PATH by executing following command in the terminal:

export PATH="$HOME/Documents/Software/bbmap:$PATH"

In this example, all executable commands in the folder bbmap can be executed from any other directory in the terminal.

So you can install samtools in an appropriate directory and then execute export PATH="$HOME/your/directory:$PATH". Then check if it succeeded by running echo $PATH. This latter command will return a list of directories which are assigned to $PATH and your new directory (where samtools is located) should be included.

$\endgroup$
1
$\begingroup$

You can run a piece of software by specifying exactly where it is, like /home/usr/software/samtools_1.1.0/samtools

Or if that location is in your $PATH, you can run it with just samtools. The software you downloaded needs to run those programs, but there's no way for you to give it the specific path for them; it's going to try and run them with just samtools. So you need to make sure that will work, by putting their locations in your PATH.

It is not clear to me that running every command with sudo is wise. If you don't understand what $PATH is, I'm pretty sure you should not be running everything with sudo.

$\endgroup$
1
$\begingroup$

The clean way to do this is to make your own bin within your user directory

cd ~
mkdir bin
vi .profile # or vi .profile_bash or for OS X using `csh` or `tcsh` vi .cshrc

For bash (Linux, or OS X) within vi type "i" then type,

PATH=$PATH:~/bin

or

PATH=~/bin:$PATH

... followed by esc key and "wp" enter Then enter for csh or tcsh e.g. for OS X

set path = ($path /Users/username/bin /Users/username/anaconda3/bin)

Same instructions for using vi as for bash. Dump bedtools into any directory (not the desktop) and connect the programs into the bin using ln

cd ~/progs/bedtools
ln -si $PWD/prog ~/bin

If you are using csh or tcsh you need to type rehash but bash does this automatically.

The programs will then be cleaning connect to your $PATH via ln without massive memory usage and visible anywhere within your home space. Its good practice for any Linux / OS X (time gone by UNIX) program or script and whilst you don't need it for this operation as you add more stuff its better.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.