Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pinki999
    Member
    • Oct 2010
    • 37

    SAM/BAM format to wiggle format

    Hi,

    Can anyone tell me how to convert SAM/BAM format to wiggle format?


    Regards,
    Pinki
  • shurjo
    Senior Member
    • Jan 2009
    • 132

    #2
    You could try the rsem-bam2wig utility from RSEM(http://deweylab.biostat.wisc.edu/rsem/docs.html).

    Comment

    • dawe
      Senior Member
      • Apr 2009
      • 258

      #3
      Originally posted by pinki999 View Post
      Hi,

      Can anyone tell me how to convert SAM/BAM format to wiggle format?
      Take a look here, examples 2 and 3.

      d

      Comment

      • ETHANol
        Senior Member
        • Feb 2010
        • 308

        #4
        If you are doing ChIP-seq, MACS writes you wig files as part of its output and is really simple to use. Some other software chip-seq software packages do the same.
        --------------
        Ethan

        Comment

        • mgogol
          Senior Member
          • Mar 2008
          • 197

          #5
          You can use bedtools to get a bedgraph:

          samtools sort sample.bam sample.sorted

          genomeCoverageBed -bg -ibam sample.sorted.bam -g chromsizes.txt > sample.bedgraph

          #on second look, dawe already said this, but the page was down for me.

          Comment

          • Thomas Doktor
            Senior Member
            • Apr 2009
            • 105

            #6
            Yet another way if you have a raw SAM file:
            TopHat has an undocumented tool, Wiggles, which will compute coverage of a SAM file and produce a bedgraph file (usage will tell you that it outputs a .wig file, but it really is a bedgraph file).

            Note that the Wiggles tool will probably be removed from the source of TopHat as it is no longer used by the TopHat pipeline.

            Comment

            • pinki999
              Member
              • Oct 2010
              • 37

              #7
              Hello Friends,

              Thank you for your valuable information.

              Comment

              • seq_GA
                Senior Member
                • Feb 2009
                • 124

                #8
                HiI tried using RSEM and I get segmentation fault. I tried using sorted bam file but still I get segmentation fault. Any clue on this? Thanks.

                Comment

                • seq_GA
                  Senior Member
                  • Feb 2009
                  • 124

                  #9
                  I also tried using bedtools as mentioned above.
                  Take a look here, examples 2 and 3.
                  Code:
                  Example 3
                  Summary:    A slightly different way (than ex. 2) to create BigWig files from BAM
                  Contributor: Assaf Gordon
                  Date:             09-July-2010
                  Tools used:  samtools, genomeCoverageBed, bedGraphToBigWig
                  More Information : http://cancan.cshl.edu/labmembers/gordon/files/viz2.pdf
                  ============================================================
                  Workflow:
                  # 1. Convert SAM to BAM
                  samtools view -S -b -o sample.bam sample.sam
                  # 2. Sort the BAM file
                  samtools sort sample.bam sample.sorted
                  # 3. Create BedGraph coverage file
                  genomeCoverageBed -bg -ibam sample.sorted.bam -g chromsizes.txt > sample.bedgraph
                  # 4. Convert the BedGraph file to BigWig
                  bedGraphToBigWig sample.bedgraph chromsizes.txt sample.bw
                  But the output sample.bw is not a human readable file. But I have ot tried uploading them into ucsc yet. Why is it so? Anyone has tried above steps? Thanks.

                  Comment

                  • adamdeluca
                    Member
                    • Jul 2010
                    • 95

                    #10
                    Originally posted by seq_GA View Post
                    But the output sample.bw is not a human readable file. But I have ot tried uploading them into ucsc yet. Why is it so? Anyone has tried above steps? Thanks.
                    bigwig is a binary format. UCSC has utilities for reading the file format, bigWigSummary bigWigToBedGraph etc.

                    Comment

                    • seq_GA
                      Senior Member
                      • Feb 2009
                      • 124

                      #11
                      Originally posted by adamdeluca View Post
                      bigwig is a binary format. UCSC has utilities for reading the file format, bigWigSummary bigWigToBedGraph etc.

                      Thanks for your response. I tried uploading into ucsc but i get the following error:

                      Code:
                      [COLOR="Red"][I][B]Error[/B][/I][/COLOR] [B]Can't read file: output.bw[/B]
                      I have uploaded the zipped test output.
                      Attached Files

                      Comment

                      • adamdeluca
                        Member
                        • Jul 2010
                        • 95

                        #12


                        bigWig files are to be linked from your ftp/http server. That way you don't need to transfer the whole file to UCSC, just what is needed for a given view. I don't think you can upload them to ucsc. bigWigInfo can parse the file you uploaded so it appears valid. You should be able to upload the bedGraph file from step 3.

                        Comment

                        • seq_GA
                          Senior Member
                          • Feb 2009
                          • 124

                          #13
                          Hi adamdeluca,
                          Thanks for your response. I have a bedgraph as below:
                          Code:
                          chr10   68271   68272   44
                          chr10   68272   68274   43
                          chr10   68274   68275   46
                          chr10   68275   68282   50
                          chr10   68282   68283   52
                          chr10   68283   68284   55
                          chr10   68284   68285   54
                          chr10   68285   68287   59
                          chr10   68287   68289   62
                          chr10   68289   68291   54
                          Is there any procedure to upload them into tracks. Because I want to see the density graph like. Thanks.

                          Comment

                          • repinementer
                            Member
                            • Dec 2009
                            • 80

                            #14
                            shouldn't you go for normalized reads visualization instead of raw reads(SAM/BAM) ?

                            Comment

                            • liguow
                              Member
                              • Apr 2009
                              • 12

                              #15
                              Originally posted by pinki999 View Post
                              Hi,

                              Can anyone tell me how to convert SAM/BAM format to wiggle format?


                              Regards,
                              Pinki
                              Surprisingly to find that this problem is still not well resolved.

                              I write a python program "bam2wig.py" that is specially designed for RNA-seq, so it works fine for spliced read, for both single-end and pair-end, for both strand-specific and non-strand specific RNA-seq data.

                              The input BAM file should be sorted and indexed using SamTools before hand.



                              Best,

                              Comment

                              Latest Articles

                              Collapse

                              • SEQadmin2
                                From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                                by SEQadmin2


                                Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                                The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                                ...
                                06-02-2026, 10:05 AM
                              • SEQadmin2
                                Single-Cell Sequencing at an Inflection Point: Early Impacts of New Platforms and Emerging Trends
                                by SEQadmin2


                                With the launch of new single-cell sequencing platforms in 2026, the field stands at an exciting inflection point. This article surveys the most impactful advances in the field and discusses how they’re reshaping research in cancer, immunology, and beyond.


                                Introduction

                                Single-cell sequencing technologies have undergone remarkable advances over the past decade, transitioning from low-throughput experimental approaches to highly scalable platforms capable of...
                                05-22-2026, 06:42 AM
                              • SEQadmin2
                                Environmental Genomics in the Age of NGS: From Microbes to Conservation Strategies
                                by SEQadmin2

                                Studying ecosystems means dealing with complex, multi-species communities that are hard to observe at scale. This complexity, however, hides many important questions to be answered, from how biogeochemical cycles work and how climate change can affect species distribution to how conservation strategies can work best.


                                Genomics, particularly since the expansion of NGS, has transformed ecosystem ecology. By sequencing environmental DNA, we can now assess biodiversity without direct...
                                05-06-2026, 09:04 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, 06-02-2026, 12:03 PM
                              0 responses
                              21 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-02-2026, 11:40 AM
                              0 responses
                              14 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 05-28-2026, 11:40 AM
                              0 responses
                              29 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 05-26-2026, 10:12 AM
                              0 responses
                              31 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...