-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathClonalVolumePlot.Rd
101 lines (88 loc) · 3.43 KB
/
ClonalVolumePlot.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/clonalstatplot.R
\name{ClonalVolumePlot}
\alias{ClonalVolumePlot}
\title{ClonalVolumePlot}
\usage{
ClonalVolumePlot(
data,
clone_call = "aa",
chain = "both",
scale = FALSE,
plot_type = c("bar", "box", "violin"),
x = "Sample",
group_by = NULL,
facet_by = NULL,
split_by = NULL,
order = list(),
ylab = NULL,
...
)
}
\arguments{
\item{data}{The product of \link[scRepertoire:combineTCR]{scRepertoire::combineTCR}, \link[scRepertoire:combineTCR]{scRepertoire::combineTCR}, or
\link[scRepertoire:combineExpression]{scRepertoire::combineExpression}.}
\item{clone_call}{How to call the clone - VDJC gene (gene), CDR3 nucleotide (nt),
CDR3 amino acid (aa), VDJC gene + CDR3 nucleotide (strict) or a custom variable
in the data}
\item{chain}{indicate if both or a specific chain should be used - e.g. "both",
"TRA", "TRG", "IGH", "IGL"}
\item{scale}{Whether to use clone proportion or clone size for the plot.}
\item{plot_type}{The type of plot to use. Default is "bar".
Possible values are "bar", "box", and "violin".
When "box" or "violin" is used, the data will be broken down by the Sample and plotted
for each group.}
\item{x}{The column name in the meta data to use as the x-axis. Default: "Sample"}
\item{group_by}{The column name in the meta data to group the cells. Default: NULL}
\item{facet_by}{The column name in the meta data to facet the plots. Default: NULL}
\item{split_by}{The column name in the meta data to split the plots. Default: NULL}
\item{order}{The order of the x-axis items or groups. Default is an empty list.
It should be a list of values. The names are the column names, and the values are the order.}
\item{ylab}{The y-axis label.}
\item{...}{Other arguments passed to the specific plot function.
\itemize{
\item For \code{bar} plot, see \code{\link[plotthis:barplot]{plotthis::BarPlot()}}.
\item For \code{box} plot, see \code{\link[plotthis:boxviolinplot]{plotthis::BoxPlot()}}.
\item For \code{violin} plot, see \code{\link[plotthis:boxviolinplot]{plotthis::ViolinPlot()}}.
}}
}
\value{
A ggplot object or a list if \code{combine} is FALSE
}
\description{
ClonalVolumePlot
}
\examples{
set.seed(8525)
data(contig_list, package = "scRepertoire")
data <- scRepertoire::combineTCR(contig_list)
data <- scRepertoire::addVariable(data,
variable.name = "Type",
variables = sample(c("B", "L"), 8, replace = TRUE)
)
data <- scRepertoire::addVariable(data,
variable.name = "Sex",
variables = sample(c("M", "F"), 8, replace = TRUE)
)
ClonalVolumePlot(data)
ClonalVolumePlot(data, x = "Type")
ClonalVolumePlot(data, x = "Type", order = list(Type = c("L", "B")))
ClonalVolumePlot(data, x = c("Type", "Sex"), scale = TRUE)
ClonalVolumePlot(data, x = "Type", group_by = "Sex", position = "stack")
ClonalVolumePlot(data,
plot_type = "box", x = "Type", comparisons = TRUE,
group_by = "Sex"
)
ClonalVolumePlot(data, plot_type = "violin", x = "Type", add_box = TRUE)
# on a Seurat object
data(scRep_example, package = "scRepertoire")
data(contig_list, package = "scRepertoire")
combined <- scRepertoire::combineTCR(contig_list,
samples = c("P17B", "P17L", "P18B", "P18L", "P19B", "P19L", "P20B", "P20L")
)
sobj <- scRepertoire::combineExpression(combined, scRep_example)
ClonalVolumePlot(sobj)
ClonalVolumePlot(sobj, x = "seurat_clusters")
ClonalVolumePlot(sobj, group_by = "seurat_clusters")
ClonalVolumePlot(sobj, x = "seurat_clusters", plot_type = "box")
}