Get the read count per genomic bin for each 10x barcode (10x Genomics Single Cell Gene Expression protocol)
Given the BAM output of Cell Ranger (that contains all reads for each barcodes-cells) I want to count reads mapped to genomic bins for each barcode.
I combined answer from How do I get the read counts for each barcode? with option -L as in:
samtools view -L bins.bed possorted_genome_bam.bam | grep CB:Z: | sed 's/.*CB:Z:\([ACGT]*\).*/\1/' | sort | uniq -c > reads_per_barcode
It works but the output read count is not for each target region, but overall across bins.
Can you point me to a possible way to get an output like:
bin1 read_count barcodeA
bin1 read_count barcodeB
bin1 read_count barcodeC
...
binN read_count barcodeA
binN read_count barcodeB
binN read_count barcodeC
thanks.
• 2,813 views
•
link
0 answers
No answers yet.
Log in to answer this question.
I think you'll need to make a loop that goes through the lines of bins.bed one at a time