Code Monkey home page Code Monkey logo

djvdj's Introduction

djvdj

R build status codecov

The djvdj package provides a range of tools to analyze and manipulate single cell V(D)J sequencing data. These tools are straightforward and easily integrate into a standard Seurat workflow.

Installation

You can install the development version of djvdj from github with:

# install.packages("devtools")
devtools::install_github("rnabioco/djvdj")

Import

With djvdj you can import V(D)J sequencing results from Cell Ranger and add these data to your current Seurat object using import_vdj(). Additional functions are provided to filter (filter_vdj()) and manipulate (mutate_vdj()) the Seurat object based on a range of V(D)J metrics including chains, clonotypes, and CDR3 sequences.

# Import VDJ data
paths <- c(
  KI_DN3_GE = "data/tcr/KI_DN3_TCR",
  KI_DN4_GE = "data/tcr/KI_DN4_TCR",
  WT_DN3_GE = "data/tcr/WT_DN3_TCR",
  WT_DN4_GE = "data/tcr/WT_DN4_TCR"
)

so_tcr <- import_vdj(
  sobj_in = so_tcr,                           # Seurat object
  vdj_dir = paths                             # Cellranger output directories
)

# Filter for paired chains
so_filt <- filter_vdj(
  sobj_in = so_tcr,                           # Seurat object
  filt    = all(c("TRA", "TRB") %in% chains)  # Condition for filtering
)

Calculate

djvdj allows you to calculate a range of population diversity and similarity metrics implemented with the abdiv package. The function calc_diversity() can be used to measure diversity on a per-cluster or per-sample basis to allow for comparison across conditions. calc_similarity() will measure repertoire overlap between clusters or samples to allow for direct comparisons between cells of interest. Additional functions are also available to calculate clonotype abundances (calc_abundance()) and relative gene usage (calc_usage()).

so_tcr <- calc_diversity(
  sobj_in     = so_tcr,                       # Seurat object
  cluster_col = "orig.ident",                 # meta.data column containing cell labels
  method      = abdiv::simpson                # Diversity metric to use
)

Plot

For each ‘calc’ function, djvdj also provides a corresponding ‘plot’ function to summarize the results.

# Compare the usage of different V and J genes
ggs <- plot_usage(
  sobj_in     = so_tcr,                       # Seurat object
  gene_cols   = c("v_gene", "j_gene"),        # meta.data column(s) containing genes
  cluster_col = "orig.ident",                 # meta.data column containing cell labels
  chain       = "TRB"                         # Chain to use for filtering genes
) %>%
  imap(~ .x + ggtitle(.y))

plot_grid(plotlist = ggs)

djvdj's People

Contributors

sheridar avatar jayhesselberth avatar raysinensis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.