Created
June 16, 2016 18:33
-
-
Save mikelove/f539631f9e187a8931d34779436a1c01 to your computer and use it in GitHub Desktop.
ENA accession to URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accession2url <- function(x) { | |
prefix <- "ftp://ftp.sra.ebi.ac.uk/vol1/fastq" | |
dir1 <- paste0("/",substr(x,1,6)) | |
dir2 <- ifelse(nchar(x) == 9, "", | |
ifelse(nchar(x) == 10, paste0("/00",substr(x,10,10)), | |
ifelse(nchar(x) == 11, paste0("/0",substr(x,10,11)), | |
paste0("/",substr(x,10,12))))) | |
paste0(prefix,dir1,dir2,"/",x) | |
} |
Thanks for this! It was super useful.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An R implementation of the rule:
http://www.ebi.ac.uk/ena/browse/read-download#downloading_files_ena_browser