Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
SAM/BAM format to wiggle format pinki999 Bioinformatics 19 08-12-2015 12:35 AM
.bam to .wig conversion kalidaemon Bioinformatics 7 05-10-2012 02:39 PM
significant peaks in WIG format fsher Epigenetics 2 03-15-2011 06:08 AM
Bioviz Integrated Genome Browser preview - BAM and better wig support aloraine Bioinformatics 0 05-08-2010 09:13 AM
Pair-End SAM/BAM to .wig converter davisc Bioinformatics 0 04-15-2010 03:49 PM

Thread Tools
Old 02-17-2012, 02:03 AM   #1
Location: Germany

Join Date: Jun 2011
Posts: 24
Default From bam to wig format


I have bam files and I need to convert it to wig format to be like this:

variableStep chrom=chr2
300701 12.5
300702 12.5
300703 12.5
300704 12.5
300705 12.5

I know that there is an options in samtools called: pileup or mpileup, but it doesn't work well with me for the following reason:
if only some nucleotides of a read is mapped to a genome, it reports coverage equally to all nucleotides of that read. I need to report only coverage for mapped nucleotides within the read, do u know any other tool that make this?

mhadidi2002 is offline   Reply With Quote
Old 02-17-2012, 03:26 AM   #2
Richard Finney
Senior Member
Location: bethesda

Join Date: Feb 2009
Posts: 700

Try some thing like this:
samtools depth yourfile.bam | awk '{if ($1!=prev)print "variableStep chrom="$1;print $2"\t"$3;prev=$1}

example :
samtools depth TCGA-23-1110-01A-01W-0486-08_IlluminaGA-DNASeq_capture.bam | awk '{if ($1!=prev)print "variableStep chrom="$1;print $2"\t"$3;prev=$1}' |head
variableStep chrom=chrM
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 2
30 3
Richard Finney is offline   Reply With Quote

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 11:12 PM.

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