Unconfigured Ad

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

    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




    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

              • mylaser
                Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                by mylaser
                Kheloyar – Everything You Need to Know About Kheloyaar Login and Kheoyar Id
                If you are looking for an online gaming platform that offers a user-friendly experience, Kheloyar has become a name that many users search for. Whether you're interested in creating a new account, accessing your dashboard through Kheloyaar Login, or learning how to obtain a Kheoyar Id, understanding the platform's features and account process is essential.
                This guide explains everything you need to know about...
                Yesterday, 01:13 AM
              • SEQadmin2
                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                by SEQadmin2



                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                ...
                07-09-2026, 11:10 AM
              • SEQadmin2
                Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                by SEQadmin2



                Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                07-08-2026, 05:17 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 07-09-2026, 10:04 AM
              0 responses
              17 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-08-2026, 10:08 AM
              0 responses
              10 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-07-2026, 11:05 AM
              0 responses
              24 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-02-2026, 11:08 AM
              0 responses
              31 views
              0 reactions
              Last Post SEQadmin2  
              Working...