- add documentation for cBioPortal class
- document arguments ..., sampleListId, etc.
- remove .onLoad function (cbioportal) object
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
Package: cBioPortalData |
2 | 2 |
Title: Exposes and makes available data from the cBioPortal web resources |
3 |
-Version: 0.99.61 |
|
3 |
+Version: 0.99.62 |
|
4 | 4 |
Authors@R: c(person("Levi", "Waldron", email = "[email protected]", |
5 | 5 |
role = "aut"), |
6 | 6 |
person("Marcel", "Ramos", email = "[email protected]", |
... | ... |
@@ -10,7 +10,6 @@ Description: The cBioPortalData package takes compressed resources |
10 | 10 |
object with Bioconductor classes. |
11 | 11 |
Depends: R (>= 3.5.0), |
12 | 12 |
AnVIL, |
13 |
- methods, |
|
14 | 13 |
MultiAssayExperiment |
15 | 14 |
Remotes: |
16 | 15 |
Bioconductor/AnVIL_rapiclient, |
... | ... |
@@ -31,6 +30,7 @@ Imports: |
31 | 30 |
S4Vectors, |
32 | 31 |
SummarizedExperiment, |
33 | 32 |
stats, |
33 |
+ rlang, |
|
34 | 34 |
tidyr, |
35 | 35 |
TCGAutils, |
36 | 36 |
utils |
... | ... |
@@ -52,4 +52,3 @@ Collate: |
52 | 52 |
'utils.R' |
53 | 53 |
'loadStudy.R' |
54 | 54 |
'studyDownload.R' |
55 |
- 'zzz.R' |
... | ... |
@@ -4,7 +4,6 @@ export(allSamples) |
4 | 4 |
export(cBioPortal) |
5 | 5 |
export(cBioPortalData) |
6 | 6 |
export(cbioCache) |
7 |
-export(cbioportal) |
|
8 | 7 |
export(clinicalData) |
9 | 8 |
export(downloadStudy) |
10 | 9 |
export(genePanelMolecular) |
... | ... |
@@ -52,6 +51,7 @@ importFrom(TCGAutils,findGRangesCols) |
52 | 51 |
importFrom(TCGAutils,generateMap) |
53 | 52 |
importFrom(methods,as) |
54 | 53 |
importFrom(methods,is) |
54 |
+importFrom(methods,new) |
|
55 | 55 |
importFrom(readr,read_tsv) |
56 | 56 |
importFrom(readr,type_convert) |
57 | 57 |
importFrom(stats,na.omit) |
... | ... |
@@ -1,7 +1,9 @@ |
1 |
+utils::globalVariables(c("clinicalAttributeId", "value", "sampleId")) |
|
2 |
+ |
|
1 | 3 |
.invoke_fun <- function(api, name, ...) { |
2 | 4 |
if (!is(api, "cBioPortal")) |
3 | 5 |
stop("Provide a 'cBioPortal' class API object") |
4 |
- ops <- names(operations(api)) |
|
6 |
+ ops <- names(AnVIL::operations(api)) |
|
5 | 7 |
if (!name %in% ops) |
6 | 8 |
stop("<internal> operation name not found in API") |
7 | 9 |
do.call(`$`, list(api, name))(...) |
... | ... |
@@ -17,9 +19,21 @@ |
17 | 19 |
.bind_content(.invoke_fun(api, name, ...)) |
18 | 20 |
} |
19 | 21 |
|
20 |
-#' @export |
|
21 |
-cbioportal <- NULL |
|
22 |
- |
|
22 |
+#' @name cBioPortal-class |
|
23 |
+#' |
|
24 |
+#' @title A class for representing the cBioPortal API |
|
25 |
+#' |
|
26 |
+#' @description The cBioPortal class is a product of the cBioPortal API that |
|
27 |
+#' inherits from the `Service` class |
|
28 |
+#' |
|
29 |
+#' @importFrom methods new |
|
30 |
+#' |
|
31 |
+#' @seealso AnVIL::Service |
|
32 |
+#' |
|
33 |
+#' @examples |
|
34 |
+#' |
|
35 |
+#' cbio <- cBioPortal() |
|
36 |
+#' |
|
23 | 37 |
#' @export |
24 | 38 |
.cBioPortal <- setClass("cBioPortal", contains = "Service") |
25 | 39 |
|
... | ... |
@@ -142,6 +156,9 @@ clinicalData <- function(cbio, studyId) { |
142 | 156 |
#' @section Molecular Profiles: |
143 | 157 |
#' * molecularProfiles - Produce a molecular profiles dataset for a given |
144 | 158 |
#' study identifier |
159 |
+#' |
|
160 |
+#' @param projection character(default: "SUMMARY") Specify the projection |
|
161 |
+#' type for data retrieval for details see API documentation |
|
145 | 162 |
#' |
146 | 163 |
#' @inheritParams cBioPortal |
147 | 164 |
#' |
... | ... |
@@ -204,7 +221,7 @@ molecularSlice <- function(cbio, molecularProfileId, |
204 | 221 |
#' |
205 | 222 |
#' @export |
206 | 223 |
searchOps <- function(cbio, keyword) { |
207 |
- grep(keyword, names(operations(cbio)), value = TRUE, ignore.case = TRUE) |
|
224 |
+ grep(keyword, names(AnVIL::operations(cbio)), value = TRUE, ignore.case = TRUE) |
|
208 | 225 |
} |
209 | 226 |
|
210 | 227 |
#' @name cBioPortal |
... | ... |
@@ -212,6 +229,8 @@ searchOps <- function(cbio, keyword) { |
212 | 229 |
#' @section API Metadata: |
213 | 230 |
#' * geneTable - Get a table of all genes by 'entrezGeneId' or |
214 | 231 |
#' 'hugoGeneSymbol' |
232 |
+#' |
|
233 |
+#' @param ... Additional arguments to lower level API functions |
|
215 | 234 |
#' |
216 | 235 |
#' @export |
217 | 236 |
geneTable <- function(cbio, ...) { |
... | ... |
@@ -247,7 +266,7 @@ samplesInSampleLists <- function(cbio, sampleListIds) { |
247 | 266 |
if (missing(sampleListIds)) |
248 | 267 |
stop("Provide valid 'sampleListIds' from 'sampleLists()'") |
249 | 268 |
|
250 |
- sampleListIds <- setNames(sampleListIds, sampleListIds) |
|
269 |
+ sampleListIds <- stats::setNames(sampleListIds, sampleListIds) |
|
251 | 270 |
meta <- structure(vector("list", length(sampleListIds)), |
252 | 271 |
.Names = sampleListIds) |
253 | 272 |
res <- lapply(sampleListIds, function(x) { |
... | ... |
@@ -330,6 +349,9 @@ getGenePanel <- function(cbio, genePanelId) { |
330 | 349 |
#' @section Gene Panels: |
331 | 350 |
#' * genePanelMolecular - get gene panel data for a paricular |
332 | 351 |
#' `molecularProfileId` and `sampleListId` combination |
352 |
+#' |
|
353 |
+#' @param sampleListId character(1) A sample list identifier as obtained from |
|
354 |
+#' `sampleLists()`` |
|
333 | 355 |
#' |
334 | 356 |
#' @export |
335 | 357 |
genePanelMolecular <- |
... | ... |
@@ -364,7 +386,7 @@ genePanelMolecular <- |
364 | 386 |
getGenePanelMolecular <- |
365 | 387 |
function(cbio, molecularProfileIds, sampleIds) |
366 | 388 |
{ |
367 |
- if (missing(molecularProfileId)) |
|
389 |
+ if (missing(molecularProfileIds)) |
|
368 | 390 |
stop("Provide valid 'molecularProfileIds' from 'molecularProfiles()'") |
369 | 391 |
if (missing(sampleIds)) |
370 | 392 |
stop(paste0("Provide valid 'sampleIds' from 'samplesInSampleLists()'", |
... | ... |
@@ -467,7 +489,8 @@ getDataByGenePanel <- |
467 | 489 |
molecularProfileIds <- |
468 | 490 |
molecularProfiles(cbio, studyId)[["molecularProfileId"]] |
469 | 491 |
|
470 |
- molecularProfileIds <- setNames(molecularProfileIds, molecularProfileIds) |
|
492 |
+ molecularProfileIds <- stats::setNames(molecularProfileIds, |
|
493 |
+ molecularProfileIds) |
|
471 | 494 |
|
472 | 495 |
expers <- lapply(molecularProfileIds, function(molprof) { |
473 | 496 |
moldata <- getDataByGenePanel(cbio, by = by, |
... | ... |
@@ -489,11 +512,17 @@ getDataByGenePanel <- |
489 | 512 |
#' data. |
490 | 513 |
#' |
491 | 514 |
#' @inheritParams cBioPortal |
515 |
+#' |
|
516 |
+#' @param idConvert function(default: `identity()`) A function to process identifiers for matching |
|
517 |
+#' patients to samples |
|
492 | 518 |
#' |
493 | 519 |
#' @examples |
494 | 520 |
#' |
495 | 521 |
#' cb <- cBioPortal() |
496 |
-#' cBioPortalData(cb, by = "hugoGeneSymbol") |
|
522 |
+#' cBioPortalData(cb, by = "hugoGeneSymbol", studyId = "acc_tcga", |
|
523 |
+#' genePanelId = "IMPACT341", |
|
524 |
+#' molecularProfileIds = c("acc_tcga_rppa", "acc_tcga_linear_CNA") |
|
525 |
+#' ) |
|
497 | 526 |
#' |
498 | 527 |
#' @export |
499 | 528 |
cBioPortalData <- |
... | ... |
@@ -1,3 +1,5 @@ |
1 |
+utils::globalVariables("element") |
|
2 |
+ |
|
1 | 3 |
.biocExtract <- function(object, names.field) { |
2 | 4 |
hasRanged <- RTCGAToolbox:::.hasRangeNames(object) |
3 | 5 |
build <- RTCGAToolbox:::.getBuild(object) |
... | ... |
@@ -149,7 +151,7 @@ endpoint_map <- data.frame( |
149 | 151 |
|
150 | 152 |
.barg <- function(type) { |
151 | 153 |
switch(type, |
152 |
- studyId = expr(list(keyword = element)), |
|
154 |
+ studyId = rlang::expr(list(keyword = element)), |
|
153 | 155 |
NULL |
154 | 156 |
) |
155 | 157 |
} |
6 | 0 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/cBioPortal.R |
|
3 |
+\docType{class} |
|
4 |
+\name{cBioPortal-class} |
|
5 |
+\alias{cBioPortal-class} |
|
6 |
+\alias{.cBioPortal} |
|
7 |
+\title{A class for representing the cBioPortal API} |
|
8 |
+\description{ |
|
9 |
+The cBioPortal class is a product of the cBioPortal API that |
|
10 |
+ inherits from the `Service` class |
|
11 |
+} |
|
12 |
+\examples{ |
|
13 |
+ |
|
14 |
+cbio <- cBioPortal() |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\seealso{ |
|
18 |
+AnVIL::Service |
|
19 |
+} |
... | ... |
@@ -62,6 +62,9 @@ getDataByGenePanel(cbio, studyId, genePanelId, by = c("entrezGeneId", |
62 | 62 |
\item{studyId}{character(1) Indicates the "studyId" as taken from |
63 | 63 |
`getStudies`} |
64 | 64 |
|
65 |
+\item{projection}{character(default: "SUMMARY") Specify the projection |
|
66 |
+type for data retrieval for details see API documentation} |
|
67 |
+ |
|
65 | 68 |
\item{molecularProfileId}{character(1) Indicates a molecular profile ID} |
66 | 69 |
|
67 | 70 |
\item{entrezGeneIds}{numeric() A vector indicating entrez gene IDs} |
... | ... |
@@ -71,12 +74,17 @@ getDataByGenePanel(cbio, studyId, genePanelId, by = c("entrezGeneId", |
71 | 74 |
\item{keyword}{character(1) Keyword or pattern for searching through |
72 | 75 |
available operations} |
73 | 76 |
|
77 |
+\item{...}{Additional arguments to lower level API functions} |
|
78 |
+ |
|
74 | 79 |
\item{sampleListIds}{character() A vector of 'sampleListId' as obtained from |
75 | 80 |
`sampleLists`} |
76 | 81 |
|
77 | 82 |
\item{genePanelId}{character(1) Identifies the gene panel, as obtained |
78 | 83 |
from the `genePanels` function} |
79 | 84 |
|
85 |
+\item{sampleListId}{character(1) A sample list identifier as obtained from |
|
86 |
+`sampleLists()``} |
|
87 |
+ |
|
80 | 88 |
\item{molecularProfileIds}{character() A vector of molecular profile IDs} |
81 | 89 |
|
82 | 90 |
\item{by}{character(1) Whether to use 'entrezGeneId' or 'hugoGeneSymbol' |
... | ... |
@@ -19,8 +19,14 @@ from the `genePanels` function} |
19 | 19 |
|
20 | 20 |
\item{molecularProfileIds}{character() A vector of molecular profile IDs} |
21 | 21 |
|
22 |
+\item{sampleListId}{character(1) A sample list identifier as obtained from |
|
23 |
+`sampleLists()``} |
|
24 |
+ |
|
22 | 25 |
\item{by}{character(1) Whether to use 'entrezGeneId' or 'hugoGeneSymbol' |
23 | 26 |
as row metadata} |
27 |
+ |
|
28 |
+\item{idConvert}{function(default: `identity()`) A function to process identifiers for matching |
|
29 |
+patients to samples} |
|
24 | 30 |
} |
25 | 31 |
\description{ |
26 | 32 |
Obtain a `MultiAssayExperiment` object for a particular gene panel, |
... | ... |
@@ -31,6 +37,9 @@ data. |
31 | 37 |
\examples{ |
32 | 38 |
|
33 | 39 |
cb <- cBioPortal() |
34 |
-cBioPortalData(cb, by = "hugoGeneSymbol") |
|
40 |
+cBioPortalData(cb, by = "hugoGeneSymbol", studyId = "acc_tcga", |
|
41 |
+ genePanelId = "IMPACT341", |
|
42 |
+ molecularProfileIds = c("acc_tcga_rppa", "acc_tcga_linear_CNA") |
|
43 |
+) |
|
35 | 44 |
|
36 | 45 |
} |