SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine multiple wigs into one bigwig biznatch Bioinformatics 1 08-25-2014 01:27 AM
Site pro bigwig on cistrome ritarebollo Bioinformatics 0 02-03-2012 10:18 AM
IGV and bigwig / bigbed Jim Robinson General 0 06-27-2011 09:28 AM
Problem with visualizing bigwig files... Help! anagari Bioinformatics 4 06-13-2011 12:10 PM
convert wig to bigwig khb Bioinformatics 1 12-16-2010 08:02 AM

Reply
 
Thread Tools
Old 02-01-2012, 07:56 AM   #1
gokhulkrishnakilaru
Member
 
Location: Bethesda, Maryland

Join Date: Jul 2011
Posts: 39
Default 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.
gokhulkrishnakilaru is offline   Reply With Quote
Old 02-01-2012, 10:07 AM   #2
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

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.
maubp is offline   Reply With Quote
Old 02-01-2012, 10:38 AM   #3
Richard Finney
Senior Member
 
Location: bethesda

Join Date: Feb 2009
Posts: 700
Default

What's needed is "samtools depth" combined with "UCSC wigToBigWig" (that doesn't use 32 GB of memory.)
Richard Finney is offline   Reply With Quote
Old 02-01-2012, 12:09 PM   #4
GW_OK
Senior Member
 
Location: Oklahoma

Join Date: Sep 2009
Posts: 411
Default

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
GW_OK is offline   Reply With Quote
Old 02-01-2012, 12:57 PM   #5
gokhulkrishnakilaru
Member
 
Location: Bethesda, Maryland

Join Date: Jul 2011
Posts: 39
Default

Thank you all.

Will give a try and shall let u know.
gokhulkrishnakilaru is offline   Reply With Quote
Old 11-21-2016, 08:57 AM   #6
aleferna
Senior Member
 
Location: sweden

Join Date: Sep 2009
Posts: 121
Default 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 &
aleferna is offline   Reply With Quote
Old 11-21-2016, 12:54 PM   #7
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

You could also just use bamCoverage from deepTools, which handles spliced reads as well.
dpryan is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 02:46 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO