This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools-1.2 re-header command on ubuntu 14.04.3

Why does samtools need to be in /usr/bin when it is in a directory (samtools-1.2) downloaded from github, unzipped, and make was run?

samtools view \
  -H /media/cmccabe/C2F8EFBFF8EFAFB9/LCH pool I 090215/IonXpress_008_150902.bam | \
    sed '/^@PG/d' | \
    samtools reheader - \
      /media/cmccabe/C2F8EFBFF8EFAFB9/LCH pool I 090215/IonXpress_008_150902.bam > /home/cmccabe/Desktop/ngs_analysis/pool1/IonXpress_008_150902_newheader.bam

I added the below to path:

echo 'export PATH=$PATH:/home/cmccabe/Desktop/ngs_analysis/samtools-1.2' >> ~/.bashrc

Thank you :)

samtools

you set, the PATH, now bash can find samtools. So, what is the question ?

With that PATH bash can not find samtools but I am not sure why. I have also tried changing the path as listed below. Thank you :).

1 answer

Who says it needs to be in /usr/bin?

If you have a version in there, and you need the one in a different directory to be used as the default when you use samtools in the command line, ensure the correct binary is seen in the PATH variable first. Use PATH=/custom/directory:$PATH rather than PATH=$PATH:/custom/directory

Is the below correct:

PATH=/home/cmccabe/Desktop/ngs_analysis/samtools-1.2:$PATH >> ~/.bashrc

Thank you :).

I used the below to add to PATH:

echo 'export PATH=PATH=/home/cmccabe/Desktop/ngs_analysis/samtools-1.2:$PATH >> ~/.bashrc

and then used the command

cmccabe@HP-Z640-Workstation:~$ cd "/home/cmccabe/Desktop/ngs_analysis"
cmccabe@HP-Z640-Workstation:~/Desktop/ngs_analysis$ samtools view -H /media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215/IonXpress_008_150902.bam | sed '/^@PG/d' | samtools reheader - /media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215/IonXpress_008_150902.bam > /home/cmccabe/Desktop/ngs_analysis/IonXpress_008_150902_newheader.bam
The program 'samtools' is currently not installed. You can install it by typing:
The program 'samtools' is currently not installed. You can install it by typing:
sudo apt-get install samtools
sudo apt-get install samtools

What am I doing wrong? Thank you :).

What is the output of:

find /home/cmccabe/Desktop/ngs_analysis/samtools-1.2/ -f 'samtools' | xargs ls -l

I recently re-installed ubuntu and added to path:

cmccabe@HPZ640:~$ echo $PATH
/home/cmccabe/Desktop/ngs_analysis/samtools-1.2/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
cmccabe@HPZ640:~$ cd "/home/cmccabe/Desktop/NGS"
cmccabe@HPZ640:~/Desktop/NGS$ samtools view -H /media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215/IonXpress_008_150902.bam | sed '/^@PG/d' | samtools reheader - /media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215/IonXpress_008_150902.bam > /home/cmccabe/Desktop/NGS/pool_I_090215/IonXpress_008_150902_newheader.bam
The program 'samtools' is currently not installed. You can install it by typing:
The program 'samtools' is currently not installed. You can install it by typing:
sudo apt-get install samtools
sudo apt-get install samtools

What am I doing wrong? Thank you :).

cmccabe@HPZ640:~/Desktop/NGS$ find /home/cmccabe/Desktop/ngs_analysis/samtools-1.2/ -f 'samtools' | xargs ls -l
find: unknown predicate `-f'
total 40
drwx------  2 cmccabe cmccabe 4096 Sep 11 09:44 bed
drwx------  3 cmccabe cmccabe 4096 Sep  1 12:12 bedops-2.14.4
drwx------ 11 cmccabe cmccabe 4096 Sep  1 11:31 bedtools2-24.0
drwx------  7 cmccabe cmccabe 4096 Sep  2 16:38 bowtie2-26.0
drwx------  3 cmccabe cmccabe 4096 Dec 28  2014 bwa-0.7.12
drwx------  3 cmccabe cmccabe 4096 Sep  2 16:33 GenomeAnalysisTK-3.4-46
drwx------  2 cmccabe cmccabe 4096 Aug 11 16:27 picard-tools-1.138
drwxrwxr-x  2 cmccabe cmccabe 4096 Sep 15 12:39 pool_I_090215
drwx------  7 cmccabe cmccabe 4096 Sep  2 11:56 samtools-1.2
drwx------  5 cmccabe cmccabe 4096 Sep  4 12:28 vcftools-0.14

I'm sorry - I messed up the command. Can you try:

find /home/cmccabe/Desktop/ngs_analysis/samtools-1.2/ -name 'samtools' | xargs ls -l

I was able to get it working, thanks for your help :).

You're very welcome :)

Log in to answer this question.