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
                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
              • seqadmin
                Addressing Off-Target Effects in CRISPR Technologies
                by seqadmin






                The first FDA-approved CRISPR-based therapy marked the transition of therapeutic gene editing from a dream to reality1. CRISPR technologies have streamlined gene editing, and CRISPR screens have become an important approach for identifying genes involved in disease processes2. This technique introduces targeted mutations across numerous genes, enabling large-scale identification of gene functions, interactions, and pathways3. Identifying the full range...
                08-27-2024, 04:44 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, Yesterday, 02:44 PM
              0 responses
              8 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 09-06-2024, 08:02 AM
              0 responses
              143 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 09-03-2024, 08:30 AM
              0 responses
              151 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 08-27-2024, 04:40 AM
              0 responses
              158 views
              0 likes
              Last Post seqadmin  
              Working...
              X