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
                Advancing Precision Medicine for Rare Diseases in Children
                by seqadmin




                Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
                12-16-2024, 07:57 AM
              • seqadmin
                Recent Advances in Sequencing Technologies
                by seqadmin



                Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

                Long-Read Sequencing
                Long-read sequencing has seen remarkable advancements,...
                12-02-2024, 01:49 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 12-17-2024, 10:28 AM
              0 responses
              22 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-13-2024, 08:24 AM
              0 responses
              42 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-12-2024, 07:41 AM
              0 responses
              28 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 12-11-2024, 07:45 AM
              0 responses
              42 views
              0 likes
              Last Post seqadmin  
              Working...
              X