waldronlab / TCGAutils

Toolbox package for organizing and working with TCGA data
https://bioconductor.org/packages/TCGAutils
22 stars 6 forks source link

barcodeToUUID error: EXPR must be a length 1 vector #14

Closed lwaldron closed 5 years ago

lwaldron commented 5 years ago

A cryptic error trying to map some OV barcodes, seems caused truncated barcodes. Would be better to filter those with a warning.

suppressPackageStartupMessages(library(ExperimentHub))
eh <- ExperimentHub()
#> snapshotDate(): 2018-08-20
ovmap <- eh[["EH843"]]
#> see ?curatedTCGAData and browseVignettes('curatedTCGAData') for documentation
#> downloading 0 resources
#> loading from cache 
#>     '/Users/lwaldron//.ExperimentHub/843'
suppressPackageStartupMessages(library(TCGAutils))
TCGAutils::barcodeToUUID(ovmap$colname, id_type="file_id")
#> Error in switch(sectionLimit, participant = paste0(startPoint, ".submitter_id"), : EXPR must be a length 1 vector
len <- lengths(strsplit(ovmap$colname, ""))
TCGAutils::barcodeToUUID(ovmap$colname[len==28], id_type="file_id")
#> Error in data.frame(barcode = if (!length(ids(info))) character(0L) else unlist(id_list), : arguments imply differing number of rows: 6078, 6062
LiNk-NY commented 5 years ago

BTW, it seems like a number of these sample barcodes have been truncated / mangled.

head(ovmap$colname[lengths(strsplit(ovmap$colname, "-")) == 4], 10)

The function should still work for those barcodes that are complete. See #13

Note: Use unique(ovmap$colname) to avoid querying the same barcode more than once.