# Bioconductor Cellbarcode

The package CellBarcode performs Cellular DNA Barcode analysis.

- Repository: https://github.com/bioMate-AI/biomate-bioconductor-kb (793 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-06-20
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add bioMate-AI/biomate-bioconductor-kb --skill bioconductor-cellbarcode -g -a claude-code -y`
Codex: `npx skills add bioMate-AI/biomate-bioconductor-kb --skill bioconductor-cellbarcode -g -a codex -y`
Cursor: `npx skills add bioMate-AI/biomate-bioconductor-kb --skill bioconductor-cellbarcode -g -a cursor -y`
Gemini CLI: `npx skills add bioMate-AI/biomate-bioconductor-kb --skill bioconductor-cellbarcode -g -a gemini-cli -y`

## Description

The package CellBarcode performs Cellular DNA Barcode analysis. It can handle all kinds of DNA barcodes, as long as the barcode is within a single sequencing read and has a pattern that can be matched by a regular expression. \code{CellBarcode} can handle barcodes with flexible lengths, with or without UMI (unique molecular identifier). This tool also can be used for pre-processing some amplicon data such as CRISPR gRNA screening, immune repertoire sequencing, and metagenome data.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CellBarcode

## Workflows

### Standard Workflow

Perform quality control, filter, extract, cure, and quantify lineage barcodes and UMIs from raw FASTQ files.

```r
library(CellBarcode)

# 1. Load User Inputs
example_data <- system.file("extdata", "mef_test_data", package = "CellBarcode")
fq_files <- dir(example_data, "fastq.gz", full=TRUE)
sample_name <- paste0("sample_", seq_along(fq_files))

# 2. Quality Control
qc_noFilter <- bc_seq_qc(fq_files)
bc_plot_seqQc(qc_noFilter)

# 3. Filtering
fq_filter <- bc_seq_filter(fq_files, min_average_quality = 30, min_read_length = 60, sample_name = sample_name)

# 4. Extraction
pattern <- "([ACGT]{12})CTCGAGGTCATCGAAGTATC([ACGT]+)CCGTAGCAAGCTCGAGAGTAGACCTACT"
bc_obj <- bc_extract(fq_filter, pattern = pattern, pattern_type = c("UMI" = 1, "barcode" = 2), sample_name = sample_name)

# 5. Curing and Quantification
bc_sub <- bc_cure_umi(bc_obj, depth = 2)
bc_sub <- bc_cure_depth(bc_sub, depth = 2)

# 6. Export
df_counts <- bc_2df(bc_sub)
mat_counts <- bc_2matrix(bc_sub)
```
*Inputs/Outputs:* Takes raw FASTQ files and a regular expression pattern as inputs, and outputs a `BarcodeObj` containing cleaned barcode and UMI counts, exportable to a data frame (`bc_2df`) or matrix (`bc_2matrix`).

### Scrnaseq Sam Lineage Barcoding

Extract lineage barcodes, cell barcodes, and UMIs from 10X Genomics single-cell RNA-seq SAM files.

```r
library(CellBarcode)

# 1. Load User Inputs
sam_file <- system.file("extdata", "scRNASeq_10X.sam", package = "CellBarcode")

# 2. Extract Lineage Barcode
d <- bc_extract_sc_sam(
  sam = sam_file,
  pattern = "AGATCAG(.*)TGTGGTA",
  cell_barcode_tag = "CR",
  umi_tag = "UR"
)
```
*Inputs/Outputs:* Takes a SAM file derived from 10X Genomics CellRanger output and a regular expression pattern as inputs, and outputs a data frame containing `cell_barcode`, `umi`, `barcode_seq`, and `count`.

The rest: https://github.com/bioMate-AI/biomate-bioconductor-kb/blob/HEAD/skills/transcriptomics/cellbarcode/SKILL.md
