morinlab / GAMBLR

Set of standardized functions to operate with genomic data
MIT License
4 stars 2 forks source link

`get_cn_states` gets error when `all_cytobands = TRUE` #243

Open vladimirsouza opened 1 year ago

vladimirsouza commented 1 year ago

Code to reproduce the error and output error message:

library(GAMBLR)
library(dplyr)

fl_meta = get_gambl_metadata() %>% dplyr::filter(pathology == "FL")
cn_matrix = get_cn_states(these_samples_metadata = fl_meta, all_cytobands = TRUE, use_cytoband_name = TRUE)

# Currently, only grch37 is supported                                                                                                         
# Cytobands are in respect to hg19. This will take awhile but it does work, trust me!
# Error in `[.data.frame`(cn_matrix, , region_names, drop = FALSE) :                                                                          
#   undefined columns selected

In the last line of get_cn_states code, region_names contains column names that are not in cn_matrix data.frame.

#order the regions the same way the user provided them for convenience
cn_matrix = cn_matrix[,region_names, drop=FALSE]