-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUni2Entrez.Rd
354 lines (285 loc) · 11.4 KB
/
Uni2Entrez.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/go.R
\name{Uni2Entrez}
\alias{Uni2Entrez}
\alias{Ref2Entrez}
\title{Map UniProt accessions to Entrez IDs}
\usage{
Uni2Entrez(
species = "human",
abbr_species = NULL,
filename = NULL,
db_path = "~/proteoQ/dbs/entrez",
overwrite = FALSE
)
Ref2Entrez(
species = "human",
abbr_species = NULL,
filename = NULL,
db_path = "~/proteoQ/dbs/entrez",
overwrite = FALSE
)
}
\arguments{
\item{species}{Character string; the name of a species.}
\item{abbr_species}{Two-letter character string; the abbreviated name of
species used with
\href{https://bioconductor.org/packages/release/data/annotation/html/org.Hs.eg.db.html}{org.Xx.eg.db}.
The value of \code{abbr_species} will be determined automatically if the
species is in one of \code{c("human", "mouse", "rat")}. Otherwise, for
example, users need to provide \code{abbr_species = Ce} for fetching the
\code{org.Ce.eg.db} package in the name space of proteoQ.
For analysis against
\href{http://current.geneontology.org/products/pages/downloads.html}{gene
ontology} and \href{https://www.gsea-msigdb.org/gsea/index.jsp}{Molecular
Signatures}, the argument is further applied to differentiate the same
biological terms under different species; e.g., \code{GO~0072686 mitotic
spindle} becomes \code{hs_GO~0072686 mitotic spindle} for human and
\code{mm_GO~0072686 mitotic spindle} for mouse.}
\item{filename}{Character string; An output file name. At the \code{NULL}
default, the name will be determined automatically at a given
\code{species}; i.e., \code{msig_hs.rds} for \code{human} data. The file is
saved as a \code{.rds} object for uses with \code{\link{prnGSPA}}.}
\item{db_path}{Character string; the local path for database(s). The default
is \code{"~/proteoQ/dbs/entrez"}.}
\item{overwrite}{Logical; if TRUE, overwrite the downloaded database(s). The
default is FALSE.}
}
\description{
\code{Uni2Entrez} prepares lookup tables between UniProt accessions and
Entrez IDs for uses with \link{normPSM} and downstream gene-set analysis such
as \link{prnGSPA}. The utility is optional for \code{human}, \code{mouse} and
\code{rat} data. It is \strong{required} for other species with \link{prnGSPA}
in users' workflows. It can also be used to update and overrule the lookups
for \code{human}, \code{mouse} and \code{rat} that are defaulted by
\code{proteoQ}.
\code{Ref2Entrez} prepares lookup tables between RefSeq accessions and
Entrez IDs and gene names for uses with \link{normPSM} and downstream gene-set
analysis such as \link{prnGSPA}. The utility is optional for \code{human} and
\code{mouse} data. It is \strong{required} for other species with
\link{prnGSPA} in users' workflows. It can also be used to update and overrule
the lookups for \code{human} and \code{mouse} that are defaulted by
\code{proteoQ}.
}
\examples{
\donttest{
# ===============================================
# Apply custom `human` and `mouse` Entrez lookups
# ===============================================
## A RefSeq example
# Prep I: fetch up-to-date `org.Xx.eg.db`
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("org.Hs.eg.db")
BiocManager::install("org.Mm.eg.db")
# Prep II: make available RefSeq Fasta(s) if not yet
library(proteoQDA)
db_path <- "~/proteoQ/dbs/fasta/refseq"
copy_refseq_hs(db_path)
copy_refseq_mm(db_path)
# Prep III: copy metadata and PSMs if not yet
dat_dir <- "~/proteoQ/custom_refseq_lookups"
copy_global_exptsmry(dat_dir)
copy_global_fracsmry(dat_dir)
# (for MaxQuant, use `copy_global_maxquant()`)
# (for Spectrum Mill, use `copy_global_sm()`)
copy_global_mascot(dat_dir)
# --- workflow begins ---
library(proteoQ)
load_expts("~/proteoQ/custom_refseq_lookups")
# prepare RefSeq-to-Entrez lookups
Ref2Entrez(species = human)
Ref2Entrez(species = mouse)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/refseq_entrez_hs.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/refseq_entrez_mm.rds")))
# overrule the default `Entrez` lookups with the custom databases
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/refseq/refseq_hs_2013_07.fasta",
"~/proteoQ/dbs/fasta/refseq/refseq_mm_2013_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/refseq_entrez_hs.rds",
"~/proteoQ/dbs/entrez/refseq_entrez_mm.rds"),
)
## A UniProt example
# Prep I: set up UniProt Fasta(s) if not yet
library(proteoQDA)
db_path <- "~/proteoQ/dbs/fasta/uniprot"
copy_uniprot_hs(db_path)
copy_uniprot_mm(db_path)
# Prep II: copy metadata and PSMs if not yet
dat_dir <- "~/proteoQ/custom_uniprot_lookups"
copy_global_exptsmry(dat_dir)
copy_global_fracsmry(dat_dir)
# (for Mascot, use `copy_global_mascot()`)
# (for Spectrum Mill, use `copy_global_sm()`)
copy_global_maxquant(dat_dir)
# Prep III: simulate UniProt data from RefSeq PSMs
# (for Mascot, use `simulUniprotPSM(Mascot)`)
library(proteoQ)
simulUniprotPSM(MaxQuant)
# --- workflow begins ---
library(proteoQ)
dat_dir <- "~/proteoQ/custom_uniprot_lookups"
load_expts()
# prepare UniProt-to-Entrez lookups
Uni2Entrez(species = human)
Uni2Entrez(species = mouse)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/uniprot_entrez_hs.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/uniprot_entrez_mm.rds")))
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/uniprot/uniprot_hs_2014_07.fasta",
"~/proteoQ/dbs/fasta/uniprot/uniprot_mm_2014_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/uniprot_entrez_hs.rds",
"~/proteoQ/dbs/entrez/uniprot_entrez_mm.rds"),
)
}
\dontrun{
# name your `species`
Uni2Entrez(species = this_human, abbr_species = Hs, filename = my_human.rds)
Uni2Entrez(species = this_mouse, abbr_species = Mm, filename = my_mouse.rds)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/my_human.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/my_mouse.rds")))
# in PSM and subsequent outputs, values under column `species`
# will be shown as "this_human" or "this_mouse"
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/refseq/refseq_hs_2013_07.fasta",
"~/proteoQ/dbs/fasta/refseq/refseq_mm_2013_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/my_human.rds",
"~/proteoQ/dbs/entrez/my_mouse.rds"),
)
}
\dontrun{
## Custom database(s) are required for workflows
# with species other than `human`, `mouse` and `rat`
BiocManager::install("org.Ce.eg.db")
library(org.Ce.eg.db)
library(proteoQ)
Uni2Entrez(species = "worm", abbr_species = "Ce", filename = uniprot_entrez_ce.rds)
# --- PAUSE: prepare Fasta file(s) before proceeding to `normPSM`. ---
normPSM(
fasta = "~/proteoQ/dbs/fasta/specify_your_worm.fasta",
entrez = c("~/proteoQ/dbs/entrez/uniprot_entrez_ce.rds"),
)
}
\dontrun{
# wrong `abbr_species` provided `species` other than "human", "mouse" and "rat"
Uni2Entrez(species = "my human", abbr_species = Hu, filename = my_human.rds, overwrite = TRUE)
# the value of `abbr_species` ignored at `species` among "human", "mouse" and "rat"
Uni2Entrez(species = human, abbr_species = ok_not_Hs, filename = my_human.rds, overwrite = TRUE)
}
\donttest{
# ===============================================
# Apply custom `human` and `mouse` Entrez lookups
# ===============================================
## A RefSeq example
# Prep I: fetch up-to-date `org.Xx.eg.db`
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("org.Hs.eg.db")
BiocManager::install("org.Mm.eg.db")
# Prep II: make available RefSeq Fasta(s) if not yet
library(proteoQDA)
db_path <- "~/proteoQ/dbs/fasta/refseq"
copy_refseq_hs(db_path)
copy_refseq_mm(db_path)
# Prep III: copy metadata and PSMs if not yet
dat_dir <- "~/proteoQ/custom_refseq_lookups"
copy_global_exptsmry(dat_dir)
copy_global_fracsmry(dat_dir)
# (for MaxQuant, use `copy_global_maxquant()`)
# (for Spectrum Mill, use `copy_global_sm()`)
copy_global_mascot(dat_dir)
# --- workflow begins ---
library(proteoQ)
load_expts("~/proteoQ/custom_refseq_lookups")
# prepare RefSeq-to-Entrez lookups
Ref2Entrez(species = human)
Ref2Entrez(species = mouse)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/refseq_entrez_hs.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/refseq_entrez_mm.rds")))
# overrule the default `Entrez` lookups with the custom databases
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/refseq/refseq_hs_2013_07.fasta",
"~/proteoQ/dbs/fasta/refseq/refseq_mm_2013_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/refseq_entrez_hs.rds",
"~/proteoQ/dbs/entrez/refseq_entrez_mm.rds"),
)
## A UniProt example
# Prep I: set up UniProt Fasta(s) if not yet
library(proteoQDA)
db_path <- "~/proteoQ/dbs/fasta/uniprot"
copy_uniprot_hs(db_path)
copy_uniprot_mm(db_path)
# Prep II: copy metadata and PSMs if not yet
dat_dir <- "~/proteoQ/custom_uniprot_lookups"
copy_global_exptsmry(dat_dir)
copy_global_fracsmry(dat_dir)
# (for Mascot, use `copy_global_mascot()`)
# (for Spectrum Mill, use `copy_global_sm()`)
copy_global_maxquant(dat_dir)
# Prep III: simulate UniProt data from RefSeq PSMs
# (for Mascot, use `simulUniprotPSM(Mascot)`)
library(proteoQ)
simulUniprotPSM(MaxQuant)
# --- workflow begins ---
library(proteoQ)
dat_dir <- "~/proteoQ/custom_uniprot_lookups"
load_expts()
# prepare UniProt-to-Entrez lookups
Uni2Entrez(species = human)
Uni2Entrez(species = mouse)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/uniprot_entrez_hs.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/uniprot_entrez_mm.rds")))
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/uniprot/uniprot_hs_2014_07.fasta",
"~/proteoQ/dbs/fasta/uniprot/uniprot_mm_2014_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/uniprot_entrez_hs.rds",
"~/proteoQ/dbs/entrez/uniprot_entrez_mm.rds"),
)
}
\dontrun{
# name your `species`
Uni2Entrez(species = this_human, abbr_species = Hs, filename = my_human.rds)
Uni2Entrez(species = this_mouse, abbr_species = Mm, filename = my_mouse.rds)
# head(readRDS(file.path("~/proteoQ/dbs/entrez/my_human.rds")))
# head(readRDS(file.path("~/proteoQ/dbs/entrez/my_mouse.rds")))
# in PSM and subsequent outputs, values under column `species`
# will be shown as "this_human" or "this_mouse"
normPSM(
group_psm_by = pep_seq_mod,
group_pep_by = gene,
fasta = c("~/proteoQ/dbs/fasta/refseq/refseq_hs_2013_07.fasta",
"~/proteoQ/dbs/fasta/refseq/refseq_mm_2013_07.fasta"),
entrez = c("~/proteoQ/dbs/entrez/my_human.rds",
"~/proteoQ/dbs/entrez/my_mouse.rds"),
)
}
\dontrun{
## Custom database(s) are required for workflows
# with species other than `human`, `mouse` and `rat`
BiocManager::install("org.Ce.eg.db")
library(org.Ce.eg.db)
library(proteoQ)
Uni2Entrez(species = "worm", abbr_species = "Ce", filename = uniprot_entrez_ce.rds)
# --- PAUSE: prepare Fasta file(s) before proceeding to `normPSM`. ---
normPSM(
fasta = "~/proteoQ/dbs/fasta/specify_your_worm.fasta",
entrez = c("~/proteoQ/dbs/entrez/uniprot_entrez_ce.rds"),
)
}
\dontrun{
# wrong `abbr_species` provided `species` other than "human", "mouse" and "rat"
Uni2Entrez(species = "my human", abbr_species = Hu, filename = my_human.rds, overwrite = TRUE)
# the value of `abbr_species` ignored at `species` among "human", "mouse" and "rat"
Uni2Entrez(species = human, abbr_species = ok_not_Hs, filename = my_human.rds, overwrite = TRUE)
}
}