Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Bam to bigwig

    Hi,

    I have a bunch of sorted bam files and would like to get them converted into bigwig files. Any ideas are highly appreciated.

    Thanks in advance.

  • #2
    I use this: http://github.com/chapmanb/bcbb/blob...m_to_wiggle.py

    See also http://biostar.stackexchange.com/que...-sam-to-wiggle and Google.

    Comment


    • #3
      What's needed is "samtools depth" combined with "UCSC wigToBigWig" (that doesn't use 32 GB of memory.)

      Comment


      • #4
        I use a combo of samtools, bedtools, and UCSC scripts with a few steps in between to remove chimeras:
        samtools sort -n file.bam file_name_sorted
        samtools view -uf 0x2 ./file_name_sorted.bam | bamToBed -i stdin -bedpe > file.bedpe
        awk '$1 == $4' file.bedpe | awk '{OFS="\t"; print $1, $2, $6, $7}' | sort -k 1,1 > file.bed
        genomeCoverageBed -i file.bed -g hg19.genome -bg > file_name_sorted.cov
        bedGraphToBigWig file_name_sorted.cov hg19.genome file.bw

        Comment


        • #5
          Thank you all.

          Will give a try and shall let u know.

          Comment


          • #6
            Another alternative

            For RNA seq data (which has intron spanning reads) I made the following script which:
            1. Does not report coverage over introns.
            2. Generates one file for each strand
            3. Summarized data in 10 bp bins
            4. Does not report bins with less than 3 reads.


            here $bam is the full bam file and $base is the shorted sample name.

            samtools mpileup -d 100000 -q 10 --rf "REVERSE" --ff "UNMAP,SECONDARY,QCFAIL,DUP" $bam | awk -F '\t' '{
            curbin = "chr"$1"\t"int($2/10)*10"\t"int($2/10)*10+10
            if (curbin != lastbin ){
            if (tot/cts > 3){
            print lastbin"\t"tot/cts*-1;
            }
            cts=0;
            tot=0;
            lastbin = curbin
            }
            a=$5
            gsub(/<|>/,"",a)
            a=$4 - length($5) + length(a)
            cts = cts + 1;
            tot = tot + a
            }' > washu/bg/$base.Rev.bedGraph &

            samtools mpileup -d 100000 -q 10 --ff "REVERSE,UNMAP,SECONDARY,QCFAIL,DUP" $bam | awk -F '\t' '{
            curbin = "chr"$1"\t"int($2/10)*10"\t"int($2/10)*10+10
            if (curbin != lastbin ){
            if (tot/cts > 3){
            print lastbin"\t"tot/cts;
            }
            cts=0;
            tot=0;
            lastbin = curbin
            }
            a=$5
            gsub(/<|>/,"",a)
            a=$4 - length($5) + length(a)
            cts = cts + 1;
            tot = tot + a
            }' > washu/bg/$base.For.bedGraph &

            Comment


            • #7
              You could also just use bamCoverage from deepTools, which handles spliced reads as well.

              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
              11 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, Yesterday, 06:07 PM
              0 responses
              10 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-22-2024, 10:03 AM
              0 responses
              51 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-21-2024, 07:32 AM
              0 responses
              68 views
              0 likes
              Last Post seqadmin  
              Working...
              X