---
title: "Hands On Session 1: Quantification, QC, and Preprocessing with OmicsBox"
canonical: "https://help.biobam.com/space/BTP/3350986788/Hands%20On%20Session%201%3A%20Quantification%2C%20QC%2C%20and%20Preprocessing%20with%20OmicsBox"
format: markdown
---
## Task 1. Customize the STARsolo run. 

It is very common to re-analyze already published data. We have seen that the scRNA-Seq quantification parameters are really technology-dependent. Thus making the library prep technology identification a crucial step in the analysis. Would you be able to identify the library prep technology used and the specific parameters to configure the “Single Cell RNA-Seq Quantification” step?

| **Dataset** | **Library Prep** | **Barcode Mate** | **Cell Barcode Start** | **Cell Barcode Length** | **UMI Start** | **UMI Length** | **Clip from 5' end** | **Clip from 3' end** | **Barcode Whitelist** |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [Dataset 1](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4481139/#S16title) |  | - [ ] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 |  |  |  |  |  |  | - [ ] Yes
- [ ] No |
| [Dataset 2](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10228738/) |  | - [ ] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 |  |  |  |  |  |  | - [ ] Yes
- [ ] No |
| [Dataset 3](https://www.cell.com/cell-reports/fulltext/S2211-1247(23)01108-7?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS2211124723011087%3Fshowall%3Dtrue) |  | - [ ] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 |  |  |  |  |  |  | - [ ] Yes
- [ ] No |
| [Dataset 4](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10499018/) |  | - [ ] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 |  |  |  |  |  |  | - [ ] Yes
- [ ] No |

> ℹ️ Useful resources:
> ℹ️ 
> ℹ️ - scRNA-Seq Quantification OmicsBox User Manual → [link](https://manual.omicsbox.biobam.com/user-manual/omicsbox-modules/module-transcriptomics/single-cell-data-analysis-tools/single-cell-rna-seq-quantification/)
> ℹ️ - Website with Library Prep read structure information →  [link](https://teichlab.github.io/scg_lib_structs/)

<details>
<summary>See the answer</summary>

| **Dataset** | **Library Prep** | **Barcode Mate** | **Cell Barcode Start** | **Cell Barcode Length** | **UMI Start** | **UMI Length** | **Clip from 5' end** | **Clip from 3' end** | **Barcode Whitelist** |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [Dataset 1](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4481139/) | Drop-seq | - [x] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 | 1 | 12 | 13 | 8 | No | No | - [ ] Yes
- [x] No |
| [Dataset 2](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10228738/) | CEL-Seq2 | - [x] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 | 1 | 8 | 9 | 8 | No | No | - [ ] Yes
- [x] No |
| [Dataset 3](https://www.cell.com/cell-reports/fulltext/S2211-1247(23)01108-7?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS2211124723011087%3Fshowall%3Dtrue) | 10c Chromium v3.1 | - [x] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 | 1 | 16 | 17 | 12 | No | No | - [x] Yes
- [ ] No |
| [Dataset 4](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10499018/) | 10c Chromium v2 | - [x] Separate Read
- [ ] Part of Mate 1
- [ ] Part of Mate 2 | 1 | 16 | 17 | 10 | No | No | - [x] Yes
- [ ] No |
</details>


## Task 2. Evaluate the effects of choosing different counting parameters. 

One of the major differences between the most commonly used scRNA-Seq Quantification tools (CellRanger and STARsolo) is the possibility to count multimapping reads or not. The default behavior of CellRanger is to discard multi-mapping reads, whereas STARsolo allows choosing between different algorithms to count multi-mapping reads. In addition, CellRanger only counts the reads mapping to the exon region, whereas STARsolo allows choosing between counting reads mapping only to exon regions or both exon and intron regions. 

In order to evaluate these two parameters, let’s take a look at the count matrices generated with these configurations:

| **file** | **multi-mapping reads** | **exons + introns** |
| --- | --- | --- |
| discard_exon.box | :cross_mark: | :cross_mark: |
| multimap_exon.box | :check_mark: | :cross_mark: |
| discard_genefull.box | :cross_mark: | :check_mark: |
| multimap_genefull.box | :check_mark: | :check_mark: |

> ℹ️ TIP 💡 
> ℹ️ 
> ℹ️ It is possible to merge the different count matrices from the Side Panel > Merge Single Cell Counts. In this way, the distribution charts will show the violin plots for each of the count matrices. This will ease the comparison.

Which configuration seems to produce more counts per cell?  

<details>
<summary>See the answer</summary>

By looking at the distribution of counts plots, it seems that the “multimap_genefull” produces in overall cells with more counts. The median number of counts per cell is higher that with the other configurations. In addition, counting multimapping reads produces an overall higher amount of counts than discarding them. So it happens with counting intronic reads in addition to exonic reads. 

![image](media://57fe099f-c76a-4def-be7b-92d1f3f60e9b)
</details>

And a greater number of expressed genes (with counts >0) per cell?

<details>
<summary>See the answer</summary>

Both the “discard_genefull” and “multimap_genefull” produce a higher number of expressed genes per cell. Thus, it seems that counting both reads mapping to exons and introns affects more this distribution.

![image](media://604492d9-be83-4336-893d-576327efe199)
</details>

Did you see any difference regarding the percentage of expressed mitochondrial genes? Why could be the cause?

<details>
<summary>See the answer</summary>

It seems that the counts obtained with the “discard_exon” options produce cells with higher percentages of mitochondrial genes. This could be caused because with other procedure the total number of expressed genes is higher, thus reducing the percentage that are mitochondrial. 

![image](media://cee42422-dadf-4bbe-bc38-61bac8941e42)
</details>

Which parameters seem to have more impact on the final count matrix with this dataset? Counting the multi-mapping reads or counting the intronic reads?

<details>
<summary>See the answer</summary>

With this general analysis, it seems that both parameters influence the final count table. Assessing deeper the impact will require further downstream analysis.
</details>

## Task 3. Choose the more appropriate Cell Barcode detection parameters.

How the algorithm handles the Cell Barcodes detected in the data will influence in the final cells included in the count matrix. Let’s see how the different parameters available in STARsolo influences the final counts. 

In order to evaluate these two parameters, let’s take a look at the count matrices generated with these configurations:

| **file** | **Cell Barcode Match Type** | **Cells Filtering** | **Num. Expected Cells** |
| --- | --- | --- | --- |
| p1_c1.box | 1MM Multi + Pseudocounts | CellRanger | 3000 |
| exactMatch.box | <span style="color: #0747a6">Exact Match</span> | CellRanger | 3000 |
| onemm.box | <span style="color: #0747a6">1MM</span> | CellRanger | 3000 |
| cr10k.box | 1MM Multi + Pseudocounts | CellRanger | <span style="color: #0747a6">10000</span> |
| top10k.box | 1MM Multi + Pseudocounts | <span style="color: #0747a6">Top Cells</span> | <span style="color: #0747a6">10000</span> |
| emptyDrops.box | 1MM Multi + Pseudocounts | <span style="color: #0747a6">Empty Drops</span> | 3000 |

How many cells were obtained on each configuration? Which seems to be influencing the most? Why?

|  | **p1_c1.box** | **exactMatch.box** | **onemm.box** | **cr10k.box** | **top10k.box** | **emptyDrops.box** |
| --- | --- | --- | --- | --- | --- | --- |
| **Num cells** |  |  |  |  |  |  |

<details>
<summary>See the answer</summary>

|  | **p1_c1.box** | **exactMatch.box** | **onemm.box** | **cr10k.box** | **top10k.box** | **emptyDrops.box** |
| --- | --- | --- | --- | --- | --- | --- |
| **Num cells** | 2,999 | 2,999 | 3,000 | 3,125 | 10,167 | 3,327 |


The Count Table obtained using the Top Cells algorithm with an incorrect number of expected cells is the most different. This algorithm report the top cells ordered by UMI count, so the output will contain a number of cells close to the given number.
</details>


Compare the results obtained with an expected number of cells of 3000 and 10000. Which would you say is more correct? 

<details>
<summary>See the answer</summary>

The most evident hint in this case would be the UMIs Per Cell plot. This is the plot obtained with the top10k configuration:

![image](media://d5e15938-3826-4cdf-aeae-afac835fba64)

And with the top3k configuration:

![image](media://108e84e6-4651-4627-854f-f47793b806e2)


The top10k configuration keeps cells that are beyond the harsh drop in the plot. These cells have a comparatively lower number of detected UMIs compared to the rest. Thus, cells that fall behind that drop are considered to be background noise and not truly cells or even cells that could be damaged and lost a huge part of their RNA content. Thus, by looking at these plots, it seems that 3000 is a better approximation of the number of cells present in the dataset. 

On the other hand,  if we look at the Distribution of Counts plots, we can see that most of the cells present in the top10k project contain a really low number of counts, whereas the top3k has a more even distribution:

![image](media://c8713a85-40b4-4aee-90bf-e3162a9ecdf1)


![image](media://c7c7a65e-7bda-4a12-8b36-90ddcb4716a8)
</details>

## Task 4. Decide filtering thresholds.

So far, we have been analyzing the count table generated for donor 1 and technical replicate 1. But the whole dataset consists of three donors with a few technical replicates each. You can find all the count tables in the task4 folder. Let’s try to define appropriate filtering thresholds for this dataset. 

> ℹ️ TIP 💡 
> ℹ️ 
> ℹ️ It is possible to merge the different count matrices from the Side Panel > Merge Single Cell Counts. In this way, the distribution charts will show the violin plots for each of the count matrices. This will ease the comparison.


Will you apply a filtering for the minimum and maximum number of counts per cell? Which one(s)?

<details>
<summary>See the answer</summary>

Looking at the distribution, it seems that cells with more than 30,000 / 35,000 counts are outliers. Thus, it would be appropriate to filter cells with a higher number of counts than this, since they could be doublets. 

![image](media://a69490bd-3976-458d-8fca-0c90071358d7)

Regarding the minimum number of counts, it seems that this particular dataset has cells with a high number of counts.  This can be seen by activating the dots in the violin plots and by sorting the count table by the column “Counts” in the Cell viewer in ascending order. So, in this case, a filter for the minimum number of counts might not be needed.
</details>

Will you apply a filtering for the minimum and maximum number of genes per cell? Which one(s)?

<details>
<summary>See the answer</summary>

It seems that the number of expressed genes has a more even distribution, with a few number of outliers. Thus, a filtering might not be needed in this case. 

![image](media://046dd1c2-a56f-4392-b9dc-b19d487df2c3)
</details>

Will you apply a filtering for the maximum percentage of mitochondrial genes per cell? Which one? 

<details>
<summary>See the answer</summary>

Most of the cells have a low percentage of mitochondrial genes expressed. However, there is som cells with comparatively high percentage of mitochondrial genes. It is recommended to filter these cells, since a high percentage of mitochondrial genes is considered to be an indicative of poor quality cells. In this case, a filter of 15% might be adequate. 

![image](media://6f5caa30-68c8-43ba-a7e7-8371ddb79e39)
</details>

Will you apply the same filters for all the samples? 

<details>
<summary>See the answer</summary>

The “p3” count tables contain comparatively a higher number of counts. Thus, it could be worth it to filter the count tables separately in order to apply different thresholds to the “p3” count tables.
</details>


## Task 5. Evaluate your results.

In the task5 folder, you’ll find a Single Cell RNA-Seq dataset of Drosophila melanogaster eye disc. There you will find the sequencing FASTQ files, and the reference genome and annotation. The single cell library has been obtained with **Drop-seq**. The length of the **cDNA read** is 51bp. 

With this information, try to configure the scRNA-Seq Quantification and take a look at your results. Would you change any parameters? What are the characteristics of your obtained count matrix?