Skip to content

Latest commit

 

History

History
96 lines (70 loc) · 3.19 KB

README.md

File metadata and controls

96 lines (70 loc) · 3.19 KB

The {scMitoMut} package

R

The {scMitoMut} is a R/Bioconductor Package for lineage informative mitochondrial mutation calling in Single-Cell sequencing.

The mitochondrial somatic mutations are promising lineage markers for single-cell sequencing data. The {scMitoMut} package provides a comprehensive function to call the lineage informative mitochondrial mutations using beta-binomial model.

Installation

Install from bioconductor

## Install `BiocManager` package to manage Bioconductor packages.
install.packages("BiocManager")
## Install `scMitoMut` from Bioconductor
BiocManager::install("scMitoMut")

Install the devel version from GitHub or Bioconductor

# install.packages("devtools")
devtools::install_github("wenjie1991/scMitoMut", build_vignettes = TRUE)
# or
BiocManager::install("scMitoMut", version = "devel")

Vignette

A vignette can be found in Bioconductor.

And the source code can be found here.

You can also access the vignette by the R command browseVignettes('scMitoMut') after installing the package.

Mini Example

This is a simple example that demonstrates the main function of the package. It can be executed in less than 1 minute.

library(scMitoMut)

# load the data
## Use the example data
f = system.file("extdata", "mini_dataset.tsv.gz", package = "scMitoMut")

## Load the data with parse_table function
f_h5 = parse_table(f, sep = "\t", h5_file = "./mut.h5")

## open the h5f file
x = open_h5_file(f_h5)

# run the model fit
# You can increase the cpu core to accelerate
# This step need some time, so the result will be kept in h5 file,
# you do not need to re-run this step, when you load the h5 file next time.
run_model_fit(x, mc.cores = 1)

# Filter the loci based on the model fit results
# The filter options will be keeped in the object by memory
# Next time you re-load the h5 file, the filter will be initiated as default
x = filter_loc(x, 
    min_cell = 5, 
    model = "bb", 
    p_threshold = 0.01, 
    p_adj_method = "fdr"
    )
x

# Set the cell annotation
f = system.file("extdata", "mini_dataset_cell_ann.csv", package = "scMitoMut")
cell_ann = read.csv(f, row.names=1)
# Prepare the color for cell annotation
colors = c(
    "Cancer Epi" = "#f28482",
    Blood = "#f6bd60")
ann_colors = list("SeuratCellTypes" = colors)

# plot the heatmap for p-value
plot_heatmap(x, type = "p", cell_ann = cell_ann, ann_colors = ann_colors, percent_interp = 0.2)

# plot the heatmap for allele frequency
plot_heatmap(x, type = "af", cell_ann = cell_ann, ann_colors = ann_colors, percent_interp = 0.2)

# check af~coverage for one loci
plot_af_coverage(x, "chrM.1227")

Contribution

You are welcome to open an issue or make a pull request.