Question: sambamba markdup command not working
0
gravatar for mirza
3.1 years ago by
mirza110
India
mirza110 wrote:

Hi, I downloaded the pre-compiled binary for sambamba (sambamba_v0.6.6_linux.tar.bz2) from https://github.com/lomereiter/sambamba/releases and untarred it. "view" command is working but when I try "markdup," it says "comand not found." can anyone help here?

markdup sambamba • 1.6k views
ADD COMMENTlink modified 3.1 years ago by Santosh Anand5.1k • written 3.1 years ago by mirza110

please post your commandlines and also the outputs / erros

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

Sorry for late reply, our server was down for a whole week. Here is the command and the error, (I used the example file provided in sambamba i.e. issue225.bam) When I use

$ markdup issue225.bam -o 225_markdup.bam

it gives the following error,

markdup: command not found

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by mirza110

looks like a PATH problem. Which directory did you install sambamba. Are you able to run view command from the same directory where the markdup failed?

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

I have sambamba in bin dir in Home from where I run all other tools. I am able to run sort but not markdup

~/bin/sambamba-0.6.6$ sort -n issue225.bam -o issue225.sorted.bam

ADD REPLYlink written 3.1 years ago by mirza110

The manual says that you have to run commands like

$ sambamba view

$ sambamba markdup

http://lomereiter.github.io/sambamba/docs/sambamba-markdup.html

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

yeah, if I run these commands from some other directory or home, but when I am running the command within my sambamba dir, I don't need $ sambamba view

$ view should work.

and the bin directory is already in path.

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by mirza110

Just for a check: did you try running sambamba markup instead of just markdup? It might run for some commands, but not for others (it all depends how the main binary sambamba is calling other sub progs)

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

yes, I did. I was first using sambamba with the commands but it didn't work. Then I removed it and run sort without it, it's running. I also tried building the tool from the source code according to the instructions given and again, I am facing the same issue. "sort" is working but with "markdp" same error. I must admit I am new to this tool. I am learning to use the view command.

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by mirza110

I think there was some problem in your build and it was somehow incomplete. However, I am able to run the precompiled binary from https://github.com/lomereiter/sambamba/releases (linux version). it gives only one command (sambamba_v0.6.6), as I was expecting, and you can run it like what I said in earlier comment.

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

I too downloaded the precompiled binaries sambamba_v0.6.6_linux.tar.bz2 from the above link and untarred it in my bin directory. Now I have a sambamba-0.6.6 directory in my bin. Do, I need to add the directory to the PATH? and what command should I use to do that? (I have been using vim to add to the .bashrc in my Ubuntu16.04).

ADD REPLYlink written 3.1 years ago by mirza110

yes, you need to add that directory to PATH (using VIM or any other editor) in .bashrc and also in .bash_profile

Open a new terminal and check that the PATH is properly set echo $PATH

Here you should see the path just added. And also then you should be able to run the command from anywhere.

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

Hi, I added it to the PATH, My path

/home/gjjha/bin:/home/gjjha/bin:/home/gjjha/bin:/home/gjjha/bin:/home/gjjha/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/gjjha/bin:/home/gjjha/ncbi-blast-2.6.0+/bin:/home/gjjha/bin/blastdb:/home/gjjha/bin/sambamba-0.6.6/sambamba

Now, when I try to run any command, it say

sambamba: command not found

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by mirza110
1

Here is the correct way to add path:

Suppose your binary program is called sambamba_v0.6.6 and it resides in /tmp/bin directory, then set the PATH like this:

PATH=$PATH:/tmp/bin

Note that you give the complete path to the directory, not to the executable or binary.

Note 2: You may also like to add the Current Working Directory (CWD) in PATH. It will allow you to run any command which is in the current directory by just typing the name of the command (else you'll need to give full path)

PATH=$PATH:/tmp/bin:.

the . in the PATH above is CWD.

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

Santosh, I am a novice in linux and NGS analysis so, thanks for explaining, however, I didn't completely understand Note 2. Can you give an example.

More importantly, my sambamba binaries are here,

/home/gjjha/bin/sambamba-0.6.6

and as I told you earlier, this bin directory is already in the PATH. So, what do I need to do now? should I remove

/home/gjjha/bin/sambamba-0.6.6/sambamba

from the path? But, then that was the situation earlier and I used to get the same error that sambamba: command not found.

ADD REPLYlink written 3.1 years ago by mirza110

should I remove

/home/gjjha/bin/sambamba-0.6.6/sambamba

in path, there should be only /home/gjjha/bin/sambamba-0.6.6

Only the name of the directory where your binaries are. After setting the PATH, you should start a new terminal to make it effective.

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by Santosh Anand5.1k

ok, thanks. Will do and let you know.

ADD REPLYlink written 3.1 years ago by mirza110

Still the same errors, I don't understand wats the problem :( I edited the PATH. Now, the path contains

:/home/gjjha/bin/sambamba-0.6.6

but, again

sambamba:command not found.

And when I try to execute the commands from the sambamba-0.6.6 directory, sort is working

~/bin/sambamba-0.6.6$ sort -n issue225.bam -o nsorted_issue225.bam

but not markdup,

gjjha@gjj-107:~/bin/sambamba-0.6.6$ markdup -r issue225.bam -o duprem_issue225.bam

markdup: command not found

ADD REPLYlink written 3.1 years ago by mirza110

I have used the following command for editing my path in vim .bashrc

PATH=${PATH/":/home/gjjha/bin/sambamba-0.6.6/sambamba"/":/home/gjjha/bin/sambamba-0.6.6"}

${variable/find/replacement} command

ADD REPLYlink written 3.1 years ago by mirza110

Just to say @mirza if your are finding the comments and answers helpful from any of the users please upvote or accept them as answers. Everyone of them deserves those credits when they are helping you out and you indeed get your problems resolved.

ADD REPLYlink written 3.1 years ago by ivivek_ngs4.9k

Thanks Vivek :-)

PS: This line is just to keep Biostars character count Nazi away

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k
3
gravatar for Santosh Anand
3.1 years ago by
Santosh Anand5.1k
Santosh Anand5.1k wrote:

I'll describe the whole process better here:

  1. Dload sambamba precompiled binary from here https://github.com/lomereiter/sambamba/releases

  2. unzip and untar it

    $ tar -axvf sambamba_v0.6.6_linux.tar.bz2

  3. Check if the commands run properly. Remember that the main program is sambamba_v0.6.6. So run it like this

    $ sambamba_v0.6.6 markdup

    $ sambamba_v0.6.6 sort

  4. If everything runs fine, now you can add the binary sambamba_v0.6.6 to path as described earlier.

ADD COMMENTlink written 3.1 years ago by Santosh Anand5.1k

Santosh, plz don't mind me asking, is it

$ tar -axvf or $ tar xvjf file.tar.gz

coz' as far as I have searched, I always find the later command to unzip a .bz2 file (& have used it to untar my sambamba file earlier). I am using Ubuntu16.04.

ADD REPLYlink written 3.1 years ago by mirza110
1

tar can also handle zipped files directly. Here the -a (automatic) flag in tar is to guess the zipping format (which is bzip2 here). Otherwise you need to write two commands

$ bunzip2  file.tar.gz
$ tar xvf file.tar

The beauty of -a flag is that it handles most of the zipping formats (gzip, bzip, zip etc.) without you need to figure out how to unzip first and then untar.

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by Santosh Anand5.1k

-a option for tar may only be there for newer versions

ADD REPLYlink written 3.1 years ago by genomax83k

since 2008-04-14 ;-)

https://www.gnu.org/software/tar/

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k

Thank you very much Santosh. It's working now :) I had used,

$ tar xvjf file.tar.gz

which untarred the file as a simple directory (with multiple sub-directories) and not in the executable format, hence all the trouble. Also, need to use "sambamba_v0.6.6" instead of just "sambamba" in the commands as you have stated above. I am really grateful for your continuous help.

ADD REPLYlink written 3.1 years ago by mirza110

My pleasure. Happy that it helped!

ADD REPLYlink written 3.1 years ago by Santosh Anand5.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1279 users visited in the last hour