-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlabel_mutations.Rd
59 lines (55 loc) · 2.2 KB
/
label_mutations.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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/label_mutations.R
\name{label_mutations}
\alias{label_mutations}
\alias{label_mutations.ref_alt_cov_tbl}
\title{Label mutations}
\usage{
label_mutations(.data, .before = NULL, .after = NULL)
\method{label_mutations}{ref_alt_cov_tbl}(.data, .before = NULL, .after = NULL)
}
\arguments{
\item{.data}{The data set containing REF and ALT calls.}
\item{.before, .after}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
<\code{\link[=dplyr_tidy_select]{tidy-select}}> Optionally, control where new columns
should appear (the default is to add to the right-hand side). See
\code{\link[dplyr:relocate]{dplyr::relocate()}} for more details.}
}
\value{
The object \code{.data} with an added column that indicates the mutation type of
each row. The column is added to the right-hand side by default, but this may
be controlled by the \code{.before} and \code{.after} arguments.
}
\description{
For each data point, label a mutation as \code{"ref"}, \code{"alt"}, \code{"ins"}, or
\code{"del"}.
\itemize{
\item Data points that have more reference (REF) than alternate (ALT) calls will
be labeled as \code{"ref"}.
\item Mutations whose REF and ALT calls are both one base pair and who have more
ALT calls than REF calls will be labeled as \code{"alt"}.
\item Mutations whose REF and ALT calls differ in length and have more ALT calls
than REF calls will be labeled as \code{"ins"}.
\item Mutations whose REF and ALT calls differ in length and have more REF calls
than ALT calls will be labeled as \code{"del"}.
}
}
\examples{
# Read example data
data <- read_tbl_ref_alt_cov(
miplicorn_example("reference_AA_table.csv"),
miplicorn_example("alternate_AA_table.csv"),
miplicorn_example("coverage_AA_table.csv"),
gene == "atp6"
)
# Add ref and alt calls to data
sequences <- c("A", "T", "C", "G", "AT", "TC", "TGC")
data <- dplyr::mutate(
data,
ref = sample(sequences, size = nrow(data), replace = TRUE),
alt = sample(sequences, size = nrow(data), replace = TRUE)
)
# Label the mutations
label_mutations(data)
label_mutations(data, .after = alt)
}