This is a test version of Biostars. For the public version, visit https://www.biostars.org.
From Bam To Wig Format (Not Pileup - Samtools)

Hello,

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?

Thanks,

samtools

So you want to get coverage of only matched bases in reads and skip all the mismatched bases? I don't think there is really an easy way to do that. But I don't think the resulting wig file will be very informative. Reads should be considered mapped or not mapped as an individual unit, not as series of bases. If 99% of a read matches, the 1% could be SNP, but should also be considered in your wig file as covered.

1 answer

My program bam2wig uses the cigar string to produce a wiggle file.

Log in to answer this question.