Question: Getting coverage per barcode from bamfile with barcoded reads
gravatar for sci
5.6 years ago by
sci0 wrote:


I'd like to do the following with a huge bam file, reads are randomly barcoded:

1. Take all reads associated with barcode (DONE)

2. If possible build a fragment using reads mapped within say 100kb of each other (DONE)

3. Find coverage for this barcode in each assembled "fragment" - obviously I am expecting this number to be quite low- maybe a few hundred reads in a region of a few hundred kb since I'm only looking at reads from a single barcode. I've used bedtools coverage/genomecov in the past so l'd be using this again for simplicity's sake.

My problem is the following: Once I've gotten the reads with barcode XYZ out of the bamfile (samtools view | less -S | grep) into an output file, what do I actually have there? Is the output file a sam file? How do I compress the reads I've selected back into a bam file so I can run bedtools on this set of reads?

Thank you!


ADD COMMENTlink modified 5.4 years ago by James Ashmore3.0k • written 5.6 years ago by sci0
gravatar for James Ashmore
5.4 years ago by
James Ashmore3.0k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore3.0k wrote:

The output form your samtools view command will be your read alignments in SAM format. Just convert this file back into a BAM file and use it in BEDtools:

samtools view -bS input.sam > output.bam
ADD COMMENTlink modified 14 months ago by _r_am32k • written 5.4 years ago by James Ashmore3.0k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2221 users visited in the last hour