Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vicm
    Junior Member
    • Mar 2013
    • 3

    #1

    SAM tools, BAM files... help for beginning

    Hi all,

    I am completely new in use of SAM tools and any kind of next. gen. seq. data analysis. Also I don’t have any experience with writing scripts…
    We just got sequencing data (small RNA) from our run at Ion Torrent PGM sequencer. Data are in BAM format. Based on what I have found, these data have to firstly be sorted, indexed from which BAI file will be generated. In this format data (sequences reads) can be viewed by other programs (e.g. Bamview).
    I have downloaded SAM tools, unzipped tar file (samtools-0.1.19.tar.bz2) and got samtools folder with different files.
    If I want to sort, index my BAM data how can I do that exactly (step-by-step)? I have Mac OS - can I used application called Terminal?
    I don’t plan to use this program for much more than just sorting, indexing my files (if this is the only thing that I need to do with them before being readable and further analysis) – can you please give me some advices how to do that?

    Many thanks,
    Vic
  • mastal
    Senior Member
    • Mar 2009
    • 666

    #2
    SAM tools, BAM files... help for

    Hi,

    Have a look at the FAQ and manual pages for samtools.

    ttp://sourceforge.net/apps/mediawiki/samtools/index.php?title=SAM_FAQ

    http://samtools.sourceforge.net/samtools.shtml


    Best wishes,
    Maria

    Comment

    • vicm
      Junior Member
      • Mar 2013
      • 3

      #3
      BAM sorting, indexing problem

      Thanks for reference!

      I have made a small progress but still having problems. I was not able to sort my BAM sequencing file data and then to index them.
      I have copied all (3) my BAM in one folder with samtools (samtools-0.1.19 folder and samtools-0.1.19.tar.bz2). I have tried (as an example) command (in Terminal) “samtools view myfile.bam>my file.sam” and it worked – I got a new SAM file from BAM file in that folder. But when I tried command “samtools sort myfile.bam myfile.sorted” which should sort data in my BAM file it gives message “-bash: samtools: command not found”.
      Can you please help me with this?
      I suppose that data should be sorted than indexed (to get BAM.BAI) and then can be further processed/viewed in other programs – is it correct or anything else is necessary to do with them?

      Thanks,
      Vic

      Comment

      • maubp
        Peter (Biopython etc)
        • Jul 2009
        • 1544

        #4
        Originally posted by vicm View Post
        I have made a small progress but still having problems. I was not able to sort my BAM sequencing file data and then to index them.
        I have copied all (3) my BAM in one folder with samtools (samtools-0.1.19 folder and samtools-0.1.19.tar.bz2). I have tried (as an example) command (in Terminal) “samtools view myfile.bam>my file.sam” and it worked – I got a new SAM file from BAM file in that folder. But when I tried command “samtools sort myfile.bam myfile.sorted” which should sort data in my BAM file it gives message “-bash: samtools: command not found”.
        Can you please help me with this?
        If you haven't installed samtools, then trying to run 'samtools view myfile.bam > my file.sam' on its own like that won't work. It needs to be on the PATH, a list of folders the operating system will check for tools.

        Instead, try running samtools with an explicit path. If as in your example samtools is in the current directory (represented as a dot), try './samtools view myfile.bam > my file.sam' instead. If your samtools is in /home/vicm/samtools-0.1.19/samtools, then use that: '/home/vicm/samtools-0.1.19/samtools view myfile.bam > my file.sam'

        Originally posted by vicm View Post
        I suppose that data should be sorted than indexed (to get BAM.BAI) and then can be further processed/viewed in other programs – is it correct or anything else is necessary to do with them?
        For most tasks yes, take the mapped reads as a BAM file, coordinate sort, and then index.
        Last edited by maubp; 04-01-2013, 02:53 AM. Reason: Answered second Q too

        Comment

        • vicm
          Junior Member
          • Mar 2013
          • 3

          #5
          samtools installation

          Thanks for your answer. I think commands (and pathway) themselves were OK... but the problem was that I have not installed samtools (properly).
          I have tried to find it in google... but still I am not sure how to install samtools (and get it to work) exactly "step by step". Can you please tell me this (or give me reference were it is clearly written)? I suppose, then when I will use those commands given on http://samtools.sourceforge.net/ it should work.

          Many thanks,
          Vic

          Comment

          • Jeremy
            Senior Member
            • Nov 2009
            • 190

            #6
            What sort of BAM did you get? mapped or unmapped?
            What do you want to do with the data? Do you want to assemble it or map it to a genome?
            My lab got some data from a torrent recently as an unmapped BAM, first thing we did was convert it to fastq so we could actually use it.

            Typically you index a BAM file that is the output of mapping raw reads to a genome/transcriptome which allows you to view it in something like IGV. I don't think you will get very much from trying to look at raw reads in a viewer.

            Comment

            • AJERYC
              Member
              • Jan 2012
              • 26

              #7
              Not sure if it is the same for RNA, but this is what I do for DNA. I hope you can get some hints from it:
              First you need a reference genome, for example hg19 for human DNA. Second, install properly some programs you need: bwa, picard, and samtools. Usually you get that by unzipping them in a directory and running make in linux, I think its install in Mac. Be sure you have proper access to them from your working directory by setting the path. If you have trouble with the path, just work in the same directory the programs are installed.
              Then you need a pipeline:
              #align
              bwa bwasw -t 5 hg19M/hg19M your_file.fastq > your_file.sam

              #order
              java -jar picard/AddOrReplaceReadGroups.jar I=your_file.sam O=your_fileordered.bam SORT_ORDER=coordinate RGPL=IT RGSM=MITO RGPU=Random RGLB=hg19

              #put some header
              java -jar picard/AddOrReplaceReadGroups.jar I=your_fileordered.bam O=your_fileorderedheader.bam LB=whatever PL=ION_TORRENT PU=whatever SM=whatever

              #index (you get an additional bai file)
              samtools index your_fileorderedheader.bam

              Now you would be able to see your data with some viewing program such as IGV

              !Don't desperate if starting seems tough. It has happened to everyone!
              Last edited by AJERYC; 04-03-2013, 10:38 PM.

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              22 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              42 views
              0 reactions
              Last Post SEQadmin2  
              Working...