@@ -95,6 +95,25 @@ make_download_urls <- function(data, type){
9595
9696}
9797
98+ # ' Make download destination paths
99+ # '
100+ # ' @param data A dataframe containing an asm_acc column
101+ # ' @param type the type of files you want to download, one of: 'fna', 'gbff', 'gff', 'gtf', 'faa', 'cds'
102+ # ' @param dest_dir path to the directory you want to use, must exist, should include a trailing '/'
103+ # '
104+ # ' @return returns a dataframe with an added "{type}_dest" column containing the paths to pass to download.file
105+ # ' @export
106+ # ' @importFrom rlang :=
107+ # '
108+ # ' @examples # download_data %>% make_dest_faths(type='fna', dest_dir='./data/')
109+ make_dest_paths <- function (data , type , dest_dir ){
110+
111+ base :: file.exists(dest_dir )
112+ supported_download_types(type )
113+
114+ data %> %
115+ dplyr :: mutate(" {type}_dest" : = paste0(dest_dir , .data $ asm_acc , ' .' , type , ' .gz' ))
116+ }
98117
99118# ' Download specified files from NCBI ftp site
100119# '
@@ -108,8 +127,8 @@ make_download_urls <- function(data, type){
108127# ' @export
109128# '
110129# ' @importFrom rlang :=
111- # ' @examples # download_data %>% download_files ('fna')
112- download_files <-
130+ # ' @examples # download_data %>% download_genomes ('fna')
131+ download_genomes <-
113132 function (data , type ){
114133 supported_download_types(type )
115134 url_var <- base :: paste0(type , ' _download' )
@@ -130,25 +149,7 @@ download_files <-
130149
131150
132151
133- # ' Make download destination paths
134- # '
135- # ' @param data A dataframe containing an asm_acc column
136- # ' @param type the type of files you want to download, one of: 'fna', 'gbff', 'gff', 'gtf', 'faa', 'cds'
137- # ' @param dest_dir path to the directory you want to use, must exist, should include a trailing '/'
138- # '
139- # ' @return returns a dataframe with an added "{type}_dest" column containing the paths to pass to download.file
140- # ' @export
141- # ' @importFrom rlang :=
142- # '
143- # ' @examples # download_data %>% make_dest_faths(type='fna', dest_dir='./data/')
144- make_dest_paths <- function (data , type , dest_dir ){
145152
146- base :: file.exists(dest_dir )
147- supported_download_types(type )
148-
149- data %> %
150- dplyr :: mutate(" {type}_dest" : = paste0(dest_dir , .data $ asm_acc , ' .' , type , ' .gz' ))
151- }
152153
153154
154155
0 commit comments