premessa
premessa copied to clipboard
Regex does not find files.
Hi there,
Using premessa panel editor and selecting a file in a folder containing "PATHWITHDRIVE/FILENAME.FCS" files, we had the issue that no files were found by premessa, which resulted in an error in line 35 of file paneleditor_shinyGUI/server.R: names(panel.table)[2] <- "Most common" as panel.table is empty.
Debugging the application I found this line (line 58 paneleditor_shinyGUI/server.R ) that did not return any files, just NULL. files.list <- list.files(working.directory, pattern = "*.fcs$", ignore.case = T)
The pattern argument in list.files as I understand is expected to be regex and not a glob expansion. Should the correct regex pattern then not be: pattern = ".*\.fcs$"?
I don't really know why this was an issue for us and not others, but this change resulted in the application working for us, but it might be a windows specific issue.
Checked premessa versions: 0.3.2, 0.3.4/ R version 4.1.1 / operating system windows 10
Thanks and best, cwlkr
I already saw this kind of imperfect pattern in many packages. It usually returns a list of files, not an empty one as you observed. IMHO, the correct pattern should be "\.fcs$". The beginning ".*" is useless, the "" must be escaped by itself :-) Thanks for your feedback that @pfgherardini will take into account. BTW thanks @pfgherardini for this package.