Announcement

Collapse
No announcement yet.

SAM/BAM format to wiggle format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SAM/BAM format to wiggle format

    Hi,

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


    Regards,
    Pinki

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

    Comment


    • #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


      • #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


        • #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


          • #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


            • #7
              Hello Friends,

              Thank you for your valuable information.

              Comment


              • #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


                • #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


                  • #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


                    • #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


                      • #12
                        http://genome.ucsc.edu/FAQ/FAQformat.html#format6.1

                        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.

                        http://genome.ucsc.edu/goldenPath/help/bedgraph.html

                        Comment


                        • #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


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

                            Comment


                            • #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.

                              http://code.google.com/p/rseqc/downloads/list

                              Best,

                              Comment

                              Working...
                              X