-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathread-deprecated.Rd
131 lines (110 loc) · 5.15 KB
/
read-deprecated.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read-deprecated.R
\name{read-deprecated}
\alias{read-deprecated}
\alias{read}
\alias{read_file}
\title{Read data}
\usage{
read(
.ref_file,
.alt_file,
.cov_file,
...,
chrom = deprecated(),
gene = deprecated()
)
read_file(.file, ..., .name = "value")
}
\arguments{
\item{.ref_file}{File path to the reference table.}
\item{.alt_file}{File path to the alternate table.}
\item{.cov_file}{File path to the coverage table.}
\item{...}{<\code{\link[dplyr:dplyr_data_masking]{data-masking}}> Expressions that
return a logical value and are used to filter the data. If multiple
expressions are included, they are combined with the \code{&} operator. Only
rows for which all conditions evaluate to \code{TRUE} are kept.}
\item{chrom}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}: The chromosome(s) to filter
to.}
\item{gene}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}: The gene(s) to filter to.}
\item{.file}{File path to a file.}
\item{.name}{The information contained in the specific file. For example
\code{"coverage"} or \code{"ref_umi_count"}.}
}
\value{
A \code{\link[tibble:tibble-package]{tibble()}}. The first six columns contain the
metadata associated with each sample and mutation. Columns \code{ref_umi_count}
and \code{alt_umi_count} contain the umi count of the reference and alternate
allele, respectively. Column \code{coverage} contains the coverage for each data
point.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
\code{read_file()} has been replaced by \code{read_tbl_reference()},
\code{read_tbl_alternate()}, and \code{read_tbl_coverage()} to provide more specific
functionality.
\code{read()} has been renamed to \code{read_tbl_ref_alt_cov()}.
}
\details{
Read files containing
\href{https://github.com/bailey-lab/MIPTools}{MIPTools'} data tables.
\code{read_file()} reads a single file. \code{read()} is a convenience function that
reads all files output by
\href{https://github.com/bailey-lab/MIPTools}{MIPTools} and combines them.
Data files include the reference table, the alternate table, and the coverage
table. Data is read lazily using the
\href{https://vroom.r-lib.org/index.html}{\code{vroom}} package. Data can be
filtered, retaining all rows that satisfy the conditions. To be retained, the
row in question must produce a value of \code{TRUE} for all conditions. Note that
when a condition evaluates to NA, the row will be dropped.
}
\section{Data structure}{
Input data must contain six rows of metadata. The metadata can vary depending
on what type of file is read, but typically contains information about the
location of a mutation. The remaining rows represent the data for each sample
sequenced. Together, the alternate, reference, and coverage tables can
provide information about mutations observed and the coverage at each site.
}
\section{Useful filter functions}{
The \code{\link[dplyr:filter]{dplyr::filter()}} function is employed to subset the rows of the data
applying the expressions in \code{...} to the column values to determine which
rows should be retained.
There are many functions and operators that are useful when constructing the
expressions used to filter the data:
\itemize{
\item \code{\link{==}}, \code{\link{>}}, \code{\link{>=}}, etc.
\item \code{\link{&}}, \code{\link{|}}, \code{\link{!}}, \code{\link[=xor]{xor()}}
\item \code{\link[=is.na]{is.na()}}
\item \code{\link[dplyr:between]{between()}}, \code{\link[dplyr:near]{near()}}
}
}
\examples{
# Get path to example file
ref_file <- miplicorn_example("reference_AA_table.csv")
alt_file <- miplicorn_example("alternate_AA_table.csv")
cov_file <- miplicorn_example("coverage_AA_table.csv")
cov_file
# Input sources -------------------------------------------------------------
# Read from a path
read_file(cov_file, .name = "coverage")
read(ref_file, alt_file, cov_file)
# You can also use paths directly
# read_file("reference_AA_table.csv")
# read("reference_AA_table.csv", "alternate_AA_table.csv", "coverage_AA_table.csv")
# Read entire file ----------------------------------------------------------
read_file(cov_file, .name = "coverage")
read(ref_file, alt_file, cov_file)
# Data filtering ------------------------------------------------------------
# Filtering by one criterion
read_file(cov_file, gene == "atp6", .name = "coverage")
read(ref_file, alt_file, cov_file, gene == "atp6")
# Filtering by multiple criteria within a single logical expression
read_file(cov_file, gene == "atp6" | targeted == "Yes", .name = "coverage")
read(ref_file, alt_file, cov_file, gene == "atp6" & targeted == "Yes")
# When multiple expressions are used, they are combined using &
read(ref_file, alt_file, cov_file, gene == "atp6", targeted == "Yes")
}
\seealso{
\code{\link[vroom:vroom]{vroom::vroom()}} \code{\link[dplyr:filter]{dplyr::filter()}}
}
\keyword{internal}