txs_ms_dge: Species-specific transcripts

Description Usage Arguments Value Examples

View source: R/species_mixing.R

Description

Calculate number of species-specific transcripts per cell from DGE data from a species mixing experiment.

Usage

1
txs_ms_dge(dge, min_txs = 1000, min_frac = 0.9)

Arguments

dge

data.frame containing digital gene expression data (DGE) for all detected genes (rows) across cells (columns) from both species. Must contain a column named "SPECIES" (case insensitive) providing a species id for each gene. Any included gene id columns (not needed) must be named "GENE" (case insensitive). Such a data.frame can be created with read_ms_dge_files. For instructions how to extract dge data from species-mixing experiments, see the Drop-seq alignment cookbook provided by the [McCarroll lab](http://mccarrolllab.com/dropseq/).

min_txs

Cells with less than min_txs detected transcripts are not assigned to a species (NA).

min_frac

Minimal fraction of transcripts per cell that need to come from one species so that the cell to be assigned to that species. E.g. min_frac = 0.9 means that if at least 90 mapped to the human genome the cell will be labelled as human. If a cell has less than min_frac transcripts mapping to one species, the cell will be labeled as mixed.

Value

A data.frame containing number and fraction of transcripts per species, and inferred species for each cell.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(dropseqr)
library(ggplot2)

# load example DGE data
data(ms_dge_data)

# summarize number of species-specific transcripts cell and assign cells to
# species. at least a total of 6000 transcripts are required per cell to
# assign the cell to a species
txs <- txs_ms_dge(ms_dge_data, min_txs = 6000)

# visualize the results using ggplot2
ggplot(txs, aes(num_transcripts_human, num_transcripts_mouse)) +
  geom_point(aes(colour = species), alpha = 0.5) +
  xlab("Human transcripts") +
  ylab("Mouse transcripts") +
  scale_colour_manual(values = c("tomato", "blueviolet", "dodgerblue"),
                      na.value = "gray50",
                      breaks = c("human", "mouse", "mixed"))

argschwind/dropseqr documentation built on May 23, 2019, 4:24 p.m.