
Calculate Naive Mapping Efficiency from Cell Ranger Metrics
obtain_mapping_efficiency.RdComputes the naive mapping efficiency as the proportion of total reads that map
to the transcriptome. This function is used internally by
reference_data_preprocessing_10x.
Note: This function only supports Cell Ranger count output format, not Cell Ranger multi.
Arguments
- QC_data
Data frame. Output of
obtain_qc_read_umi_tablecontaining anum_readscolumn with read counts per UMI.- path_to_cellranger_output
Character. Path to Cell Ranger run folder containing
outs/metrics_summary.csvwith a "Number of Reads" column.
Value
Numeric value between 0 and 1 representing the proportion of total reads that successfully mapped to the transcriptome.
Details
The function calculates:
$$\text{mapping_efficiency} = \frac{\text{mapped_reads}}{\text{total_reads}}$$
where:
mapped_reads= sum ofnum_readsfrom QC_datatotal_reads= "Number of Reads" from metrics_summary.csv
Important Notes
Only Cell Ranger count format is supported. Cell Ranger multi uses a different
metrics_summary.csvformat (row-based with "Library Type" and "Metric Name" columns) and is not compatible with this functionThe
metrics_summary.csvfile must contain a column named "Number of Reads" (Cell Ranger count format where metric names are column headers)The function removes commas from the "Number of Reads" field before conversion
This gives a "naive" estimate that will be adjusted in
reference_data_processingwhen a gene list is specified
See also
reference_data_preprocessing_10x for the complete aggregation workflow
Examples
# Get mapping efficiency from Cell Ranger output
cellranger_path <- system.file("extdata/cellranger_tiny", package = "perturbplan")
qc_data <- obtain_qc_read_umi_table(cellranger_path)
mapping_eff <- obtain_mapping_efficiency(qc_data, cellranger_path)
# View result
print(mapping_eff)
#> [1] 1