Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting SAMtools to work on Ubuntu

    So I have my .sam file aligned from Bowtie2 and have dowloaded SAMtools and BCFtools. I added SAMtools to PATH using:

    export PATH:$PATH:#path/#to/SAMtools (I renamed whatever the samtools name was to just "SAMtools"

    Now, the instructions say that to convert from .sam to .bam, you simply type:

    samtools view -bS filename.SAM > filename.BAM

    However, no matter what I try I keep getting "samtools: command not found"

    What am I doing wrong?

  • #2
    Can you run samtools from the full path?

    Did you download a compiled version?

    Comment


    • #3
      Originally posted by ECO View Post
      Can you run samtools from the full path?

      Did you download a compiled version?
      So I'm very new at bioinformatics and linux. From what I'm reading, I need to "make" SAMtools. I'm doing to exact same thing it says under "Installing SAMtools"


      However, I get an error that says

      make[1]: Entering directory `/home/adam/SAMtools'
      make[2]: Entering directory `/home/adam/SAMtools'
      gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -DBGZF_CACHE -I. bgzf.c -o bgzf.o
      In file included from bgzf.c:32:0:
      bgzf.h:33:18: fatal error: zlib.h: No such file or directory
      compilation terminated.
      make[2]: *** [bgzf.o] Error 1
      make[2]: Leaving directory `/home/adam/SAMtools'
      make[1]: *** [lib-recur] Error 1
      make[1]: Leaving directory `/home/adam/SAMtools'
      make: *** [all-recur] Error 1
      adam@ubuntu:~/SAMtools$ make samtools
      make[1]: Entering directory `/home/adam/SAMtools'
      gcc -c -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -DBGZF_CACHE -I. bgzf.c -o bgzf.o
      In file included from bgzf.c:32:0:
      bgzf.h:33:18: fatal error: zlib.h: No such file or directory
      compilation terminated.
      make[1]: *** [bgzf.o] Error 1
      make[1]: Leaving directory `/home/adam/SAMtools'
      make: *** [lib-recur] Error 1

      Comment


      • #4
        You need to install zlib (which is missing) via apt-get. Then try the "make" again.

        $sudo apt-get install zlib1g-dev
        or you can use "Ubuntu software center". Search for "zlib1g-dev" and then install.

        PS: Taking a chance and assuming that you are using Ubuntu (since many "new to unix" people do).
        Last edited by GenoMax; 10-16-2013, 10:33 AM.

        Comment


        • #5
          Originally posted by GenoMax View Post
          You need to install zlib (which is missing) via apt-get. Then try the "make" again.



          or you can use "Ubuntu software center". Search for "zlib1g-dev" and then install.

          PS: Taking a chance and assuming that you are using Ubuntu (since many "new to unix" people do).
          I did sudo apt-get install build-essential, which supposedly has the make function in it. Do i still need zlib1g-dev?

          yes, ubuntu 12.04 LTS
          Last edited by KnowNothing2; 10-16-2013, 10:57 AM.

          Comment


          • #6
            Better yet, just do:
            $ sudo apt-get install samtools

            this should take care of the required dependencies.

            Comment


            • #7
              Originally posted by KnowNothing2 View Post
              I did sudo apt-get install build-essential, which supposedly has the make function in it. Do i still need zlib1g-dev?

              yes, ubuntu 12.04 LTS
              You do. "zlib1g-dev" provides "libraries" (e.g. zlib.h) which are needed by the "make" to compile samtools. This is basically code that can be used by multiple applications. WikiPedia link for explanation of "libraries": http://en.wikipedia.org/wiki/Library_%28computing%29

              Comment


              • #8
                Originally posted by eco32i View Post
                Better yet, just do:
                $ sudo apt-get install samtools

                this should take care of the required dependencies.
                Indeed. Samtools appears to be available from ubuntu software center. I am not sure what version though. Is it the latest?

                Comment


                • #9
                  Version: 0.1.18 (r982:295)

                  But I am on 13.04. It's probably behind on LTS.

                  Comment


                  • #10
                    Originally posted by GenoMax View Post
                    You do. "zlib1g-dev" provides "libraries" (e.g. zlib.h) which are needed by the "make" to compile samtools. This is basically code that can be used by multiple applications. WikiPedia link for explanation of "libraries": http://en.wikipedia.org/wiki/Library_%28computing%29
                    Cool, so I installed that and reran "make" in my SAMtools directory. It made a bunch of 'object' files. Now I tried rerunning my code:

                    samtools view -bS filename.sam > filename.bam

                    And it still stays:

                    samtools: command not found

                    Theres mention of moving the samtools binary into PATH. Which file is the binary?

                    I added #path/to/SAMtools to my PATH, but it still doesnt work.
                    Last edited by KnowNothing2; 10-16-2013, 11:23 AM.

                    Comment


                    • #11
                      Originally posted by KnowNothing2 View Post
                      Cool, so I installed that and reran "make" in my SAMtools directory. It made a bunch of 'object' files. Now I tried rerunning my code:

                      samtools view -bS filename.sam > filename.bam

                      And it still stays:

                      samtools: command not found

                      Theres mention of moving the samtools binary into PATH. Which file is the binary?
                      In your SAMtools directory there should be a file called "samtools". Name should be "green" in color if you are using the default terminal in ubuntu, which indicates that it is an "executable" file.

                      You can run the command this way:

                      Code:
                      $/home/adam/SAMtools/samtools view -bS filename.sam > filename.bam

                      Comment


                      • #12
                        Originally posted by KnowNothing2 View Post
                        Cool, so I installed that and reran "make" in my SAMtools directory. It made a bunch of 'object' files. Now I tried rerunning my code:

                        samtools view -bS filename.sam > filename.bam

                        And it still stays:

                        samtools: command not found

                        Theres mention of moving the samtools binary into PATH. Which file is the binary?

                        I added #path/to/SAMtools to my PATH, but it still doesnt work.
                        Run $ sudo make install after you run make. This will put the binaries where they are expected to be on the system.

                        Comment


                        • #13
                          Thanks everyone. I just made it easy on myself and ran apt-get install samtools. Worked right away.

                          Comment


                          • #14
                            export PATH:$PATH:#path/#to/SAMtools (I renamed whatever the samtools name was to just "SAMtools"
                            is wrong.

                            It should be:

                            export PATH=$PATH:/path/to/SAMtools
                            Last edited by sophiespo; 10-16-2013, 11:51 PM.

                            Comment


                            • #15
                              Originally posted by sophiespo View Post
                              is wrong.

                              It should be:
                              Yeah, I did it the correct way, sorry just sloppy notation. When I performed

                              echo $PATH

                              I saw my directory.

                              Comment

                              Latest Articles

                              Collapse

                              • seqadmin
                                Strategies for Sequencing Challenging Samples
                                by seqadmin


                                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                                03-22-2024, 06:39 AM
                              • seqadmin
                                Techniques and Challenges in Conservation Genomics
                                by seqadmin



                                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                                Avian Conservation
                                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                                03-08-2024, 10:41 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by seqadmin, Yesterday, 06:37 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, Yesterday, 06:07 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 03-22-2024, 10:03 AM
                              0 responses
                              49 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 03-21-2024, 07:32 AM
                              0 responses
                              66 views
                              0 likes
                              Last Post seqadmin  
                              Working...
                              X