<p>The BAM file you downloaded has all of the detected 10X barcodes instead of those that represent cells.  In a given 10X experiment the number of input barcodes vastly outnumbers the input cell count.  After the reaction some of barcoded beads are invariably sequenced because they are encapsulated with ambient RNA, dead cells etc. After processing the BAM file Cell Ranger infers which cells likely represent cells and generates gene expression matrices from these files.  </p>

<p>You would need to download one of the output files that contains the list of passed barcodes such as the <code>Gene / cell matrix (filtered)</code> and then use the list of passed barocode sequences to filter your BAM file. Alternatively you could approximately select the same cells by selecting the top 2,000 barcodes with the highest numbers of reads.</p>

CC BY-SA 4.0
2020-01-06T15:37:37.463Z
2020-01-06T15:37:37.463Z
GWW
<p>I am analyzing a single-cell sequencing dataset from the website 10xgenomics, with 2000 cells. It is a BAM file and I am trying to obtain the individual cells per sample. I used the command</p>

<pre><code>samtools view mtdnaAsorted.bam | grep CB:Z: | sed 's/.CB:Z:([ACGT]).*/\1/' | sort | uniq -c &gt; reads_per_barcode_mtdnaA
</code></pre>

<p>to get a list of the individual bar codes and their reads, but there are 100,000 unique barcodes even with only 2000 cells. Does anyone know what could be the problem?</p>

<p>I know that there could be noise, but this is a problem for me because I'm trying to analyze coverage per cell, and if there are a lot of cells that contribute towards the total number of reads, the net coverage per cell is going to be really low</p>

<samtools><single-cell><10x-genomics>
Single-cell sequencing dataset has too many barcodes
# Single-cell sequencing dataset has too many barcodes

(Asked by: username_0 on 2020-01-06)

I am analyzing a single-cell sequencing dataset from the website 10xgenomics, with 2000 cells. It is a BAM file and I am trying to obtain the individual cells per sample. I used the command
samtools view mtdnaAsorted.bam | grep CB:Z: | sed 's/.CB:Z:([ACGT]).*/\1/' | sort | uniq -c > reads_per_barcode_mtdnaA

to get a list of the individual bar codes and their reads, but there are 100,000 unique barcodes even with only 2000 cells. Does anyone know what could be the problem?
I know that there could be noise, but this is a problem for me because I'm trying to analyze coverage per cell, and if there are a lot of cells that contribute towards the total number of reads, the net coverage per cell is going to be really low

**Tags:** samtools, single-cell, 10x-genomics

---

## 1 answers

### Answer by username_1 on 2020-01-06. Score: 4

The BAM file you downloaded has all of the detected 10X barcodes instead of those that represent cells. In a given 10X experiment the number of input barcodes vastly outnumbers the input cell count. After the reaction some of barcoded beads are invariably sequenced because they are encapsulated with ambient RNA, dead cells etc. After processing the BAM file Cell Ranger infers which cells likely represent cells and generates gene expression matrices from these files.

You would need to download one of the output files that contains the list of passed barcodes such as the `Gene / cell matrix (filtered)` and then use the list of passed barocode sequences to filter your BAM file. Alternatively you could approximately select the same cells by selecting the top 2,000 barcodes with the highest numbers of reads.


---

