Changed implementation to dirname(basename()). This should be more robust. ...

This should be more robust as the dirname follows a more stringent format
than the filename itself.
master
Taha Ahmed 13 years ago
parent 16faf22b9f
commit ca87357da3

@ -3,7 +3,14 @@ ProvideSampleId <- function (pathexpfile) {
# with a path to an experimental file. # with a path to an experimental file.
## Note: the sample ID must derive directly from the file or path. ## Note: the sample ID must derive directly from the file or path.
sampleid <- sub("\\.[\\w]+$", "", basename(pathexpfile), perl = TRUE) # basename(dirname()) returns the name of the lowest sub-directory
# split()[[1]][2] splits the dirname at the hyphen and returns the sampleid
sampleid <- strsplit(x = basename(dirname(pathexpfile)),
split = "-")[[1]][2]
# # basename() returns the filename sans path
# # sub() returns the filename sans extension
# sampleid <- sub("\\.[\\w]+$", "", basename(pathexpfile), perl = TRUE)
#### The code below is the old ProvideSampleId() function #### The code below is the old ProvideSampleId() function
# ### OBS! Only very rudimentary error-checking. # ### OBS! Only very rudimentary error-checking.

Loading…
Cancel
Save