This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract list of mapped UMIs in cell ranger output

Hi everyone, and thanks in advance. I am trying to compare the reads in a sample that are mapping to two different reference genomes. I have all the cell ranger outputs, including the bam files, and I would like to extract the UMIs that are mapping to each. Is this possible, or are the UMIs already removed at this point? Thanks

umi cellranger rnaseq bam 10x

2 answers

The corrected molecular barcodes are present as a tag in the BAM files in this case: UB.

https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/output/bam

To extract them you should search the forum for how to do this:

How to extract certain tag value by key from sam/bam file?

That should be the UB:Z: tag in the CellRanger bam file, see this example read, the last column:

A00917:642:H52V3DSX2:4:1105:22761:17832 0       chr1    3038735 255     101M117591N49M  *       0       0       AAGTGAGGCAACAGTGGAGATAGAAACACTAGGAAAGAAATCTGGAACCATAGATGCGAGCATCAGCAACAGAATACAAGAAATGGAAGAGAGAATCTCAGGTGCAGAAGATTCCATAGAGAACATCGGCACAACAATCAAAAAAAAAAA        FFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:F:FFFFFF:FFFF:FFFFFFFFFFFFFFFFFFF,FFFFFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FF        NH:i:1  HI:i:1  AS:i:146        nM:i:0  RG:Z:1_mapped:0:1:H52V3DSX2:4   RE:A:I  xf:i:0  CR:Z:CTATCCGAGGCCACCT   CY:Z:FFFFFFFFFFFFFFFF   CB:Z:CTATCCGAGGCCACCT-1 UR:Z:CCCGCCCTGCCA       UY:Z:FFFFFFFFFF:F     UB:Z:CCCGCCCTGCCA

Since it happens to be the last column a simple regex splitting the line at 'UB:Z:' and then taking the right-hand part should do fine.

Log in to answer this question.