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
                Recent Developments in Metagenomics
                by seqadmin





                Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
                09-23-2024, 06:35 AM
              • seqadmin
                Understanding Genetic Influence on Infectious Disease
                by seqadmin




                During the COVID-19 pandemic, scientists observed that while some individuals experienced severe illness when infected with SARS-CoV-2, others were barely affected. These disparities left researchers and clinicians wondering what causes the wide variations in response to viral infections and what role genetics plays.

                Jean-Laurent Casanova, M.D., Ph.D., Professor at Rockefeller University, is a leading expert in this crossover between genetics and infectious...
                09-09-2024, 10:59 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 10-02-2024, 04:51 AM
              0 responses
              13 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 10-01-2024, 07:10 AM
              0 responses
              22 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 09-30-2024, 08:33 AM
              0 responses
              26 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 09-26-2024, 12:57 PM
              0 responses
              18 views
              0 likes
              Last Post seqadmin  
              Working...
              X