README.md

rBCS

An open-source package that can write BioTuring Compressed Study (bcs) file from a Seurat object.

bcs files can be loaded directly into BBrowser, a software for single cell data.

This package is compatible with R 3.x and 4.x.

Installation

require(devtools)
install_github("bioturing/rBCS", INSTALL_opts="--no-multiarch")
# Remove INSTALL_opts if you want to use on arch i386

Examples

Basic usage

require(rBCS)
ExportSeurat(seurat.obj, "/mnt/example/path.bcs")

Advanced usage

require(rBCS)
ExportSeurat(
    seurat.obj,
    "/mnt/example/path.bcs",
    unique.limit = 200, # Allow at most 200 unique in a categorical metadata
    batch.name = "sample_id", # Use `sample_id` as batch identifiers
    compression.level = 9, # Maximize compression level
    author = "me@iamtheauthor.com", # I am the author
    raw.rna = "RNA", # Assay that has raw count of RNA
    norm.rna = "RNA", # Assay that has normalized count of RNA
    raw.adt = "ADT", # Assay that has raw count of ADT
    norm.adt = "ADT", # Assay that has normalized count of ADT
    overwrite = TRUE # Overwite existing bcs file
)

# Export a Seurat object that was applied scTransform.
#
# In this case, you may want to get raw count from `RNA` assay
# and normalized count from `SCT` assay.
ExportSeurat(seurat.obj, "/mnt/example/path.bcs", raw.rna="RNA", norm.rna="SCT")

# Export a Seurat object with Spatial information
ExportSeurat(seurat.obj, "/mnt/example/path.bcs", raw.rna="Spatial", norm.rna="Spatial")

# Export a Seurat object with Spatial information and was applied scTransform
ExportSeurat(seurat.obj, "/mnt/example/path.bcs", raw.rna="Spatial", norm.rna="SCT")

Note: Avoid using ~/... in Windows

Other utilities

Write a 10X feature-barcode matrix

require(rBCS)

# Write a 10X matrix with an expression matrix
Write10X(expr.mat, "/mnt/example/output_folder")

# Write a 10X matrix with a Seurat object
# This example can be also applied to objects with an ADT assay
Write10XSeurat(seurat.obj, "/mnt/example/output_folder")

Write a 10X feature-barcode matrix (more specific)

require(rBCS)

# Write a 10X matrix with a Seurat object (another way)
Write10X(seurat.obj$RNA@counts, "/mnt/example/output_folder")

# Write a 10X matrix of RNA and ADT assay in a Seurat object
Write10X(list(
  "Gene Expression" = seurat.obj$RNA@counts,
  "Antibody Capture" = seurat.obj$ADT@counts 
), "/mnt/example/output_folder")


bioturing/rBCS documentation built on May 18, 2022, 5:26 p.m.