I've recently been involved in a research project that involves taking datasets from the National Cancer Institute, GDC Data Portal. The Methylation and RNA-seq dataset folders all have UUID names and we needed TCGA names. I've created some code that will go through and rename all of the sub-folders. I've seen people with similar problems so I've attached the code so it could possibly help others. I can share the whole R file if needed with libraries, packages, and comments, just let me know. How this helps!
old_files <- list.files(path="./RNA-Seq", pattern=NULL, full.names=TRUE)
for (file in old_files) {
file = sub("./RNA-Seq/","",file)
barcode = UUIDtoBarcode(file, from_type = "file_id")
new_files <- paste0("./RNA-Seq/",barcode[[2]])
file_name = paste("./RNA-Seq/",file,sep="")
file.rename(from = file_name, to = new_files)
}
list.files(path="./RNA-Seq", pattern=NULL, all.files=FALSE,full.names=FALSE)
May want to consider putting that up at GitHub on in
gist
and then paste the link in your post. Biostars code will automatically parsegist
links.