... | ... |
@@ -346,16 +346,19 @@ barcodeToUUID <- |
346 | 346 |
|
347 | 347 |
#' @rdname ID-translation |
348 | 348 |
#' |
349 |
-#' @param filenames character() A vector of file names usually obtained |
|
349 |
+#' @param filenames `character()` A vector of file names usually obtained |
|
350 | 350 |
#' from a `GenomicDataCommons` query |
351 | 351 |
#' |
352 |
-#' @param slides logical(1L) Whether the provided file names correspond to |
|
353 |
-#' slides typically with an `.svs` extension. **Note** The barcodes returned |
|
354 |
-#' correspond 1:1 with the `filename` inputs. Always triple check the |
|
355 |
-#' output against the Genomic Data Commons Data Portal by searching the |
|
356 |
-#' file name and comparing associated "Entity ID" with the `submitter_id` |
|
352 |
+#' @param slides `logical(1L)` **DEPRECATED**: Whether the provided file names |
|
353 |
+#' correspond to slides typically with an `.svs` extension. **Note** The |
|
354 |
+#' barcodes returned correspond 1:1 with the `filename` inputs. Always triple |
|
355 |
+#' check the output against the Genomic Data Commons Data Portal by searching |
|
356 |
+#' the file name and comparing associated "Entity ID" with the `submitter_id` |
|
357 | 357 |
#' given by the function. |
358 | 358 |
#' |
359 |
+#' @details When providing slide file names, the function will only work if |
|
360 |
+#' **all** the provided files are slide files with an `.svs` extension. |
|
361 |
+#' |
|
359 | 362 |
#' @examples |
360 | 363 |
#' library(GenomicDataCommons) |
361 | 364 |
#' |
... | ... |
@@ -386,6 +389,19 @@ barcodeToUUID <- |
386 | 389 |
#' |
387 | 390 |
#' @export filenameToBarcode |
388 | 391 |
filenameToBarcode <- function(filenames, slides = FALSE) { |
392 |
+ endwithsvs <- endsWith(filenames, "svs") |
|
393 |
+ if (!all(endwithsvs) && any(endwithsvs)) |
|
394 |
+ stop("Not all file names have an 'svs' extension.") |
|
395 |
+ if (!missing(slides)) { |
|
396 |
+ .Deprecated( |
|
397 |
+ msg = "The 'slides' argument is deprecated.", package = "TCGAutils" |
|
398 |
+ ) |
|
399 |
+ if (all(endwithsvs) && !slides) |
|
400 |
+ warning( |
|
401 |
+ "All files have an 'svs' extension. Setting 'slides' to TRUE." |
|
402 |
+ ) |
|
403 |
+ slides <- all(endwithsvs) |
|
404 |
+ } |
|
389 | 405 |
filesres <- files() |
390 | 406 |
endpoint <- "cases.samples.portions.analytes.aliquots.submitter_id" |
391 | 407 |
reselem <- "cases" |
... | ... |
@@ -31,14 +31,14 @@ type of \code{id_vector} entered (default \code{"case_id"})} |
31 | 31 |
|
32 | 32 |
\item{barcodes}{character() A vector of TCGA barcodes} |
33 | 33 |
|
34 |
-\item{filenames}{character() A vector of file names usually obtained |
|
34 |
+\item{filenames}{\code{character()} A vector of file names usually obtained |
|
35 | 35 |
from a \code{GenomicDataCommons} query} |
36 | 36 |
|
37 |
-\item{slides}{logical(1L) Whether the provided file names correspond to |
|
38 |
-slides typically with an \code{.svs} extension. \strong{Note} The barcodes returned |
|
39 |
-correspond 1:1 with the \code{filename} inputs. Always triple check the |
|
40 |
-output against the Genomic Data Commons Data Portal by searching the |
|
41 |
-file name and comparing associated "Entity ID" with the \code{submitter_id} |
|
37 |
+\item{slides}{\code{logical(1L)} \strong{DEPRECATED}: Whether the provided file names |
|
38 |
+correspond to slides typically with an \code{.svs} extension. \strong{Note} The |
|
39 |
+barcodes returned correspond 1:1 with the \code{filename} inputs. Always triple |
|
40 |
+check the output against the Genomic Data Commons Data Portal by searching |
|
41 |
+the file name and comparing associated "Entity ID" with the \code{submitter_id} |
|
42 | 42 |
given by the function.} |
43 | 43 |
|
44 | 44 |
\item{id}{character(1) A UUID whose history of versions is sought} |
... | ... |
@@ -70,6 +70,9 @@ Based on the file UUID supplied, the appropriate entity_id (TCGA barcode) is |
70 | 70 |
returned. In previous versions of the package, the 'end_point' parameter |
71 | 71 |
would require the user to specify what type of barcode needed. This is no |
72 | 72 |
longer supported as \code{entity_id} returns the appropriate one. |
73 |
+ |
|
74 |
+When providing slide file names, the function will only work if |
|
75 |
+\strong{all} the provided files are slide files with an \code{.svs} extension. |
|
73 | 76 |
} |
74 | 77 |
\examples{ |
75 | 78 |
## Translate UUIDs >> TCGA Barcode |