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
                Essential Discoveries and Tools in Epitranscriptomics
                by seqadmin


                The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist on Modified Bases...
                Yesterday, 07:01 AM
              • seqadmin
                Current Approaches to Protein Sequencing
                by seqadmin


                Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                04-04-2024, 04:25 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              40 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              41 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 09:21 AM
              0 responses
              36 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-04-2024, 09:00 AM
              0 responses
              55 views
              0 likes
              Last Post seqadmin  
              Working...
              X