Skip to content

Commit bc63e66

Browse files
committed
rename download_files to download_genome.
reorganize package site.
1 parent c4fb92d commit bc63e66

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

R/genome_download_tools.R

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

_pkgdown.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
url: ~
22

33
reference:
4-
- title: Download helpers
4+
- title: Metadata download helpers
55
- contents:
66
- list_PDGs
77
- list_organisms
@@ -13,7 +13,14 @@ reference:
1313
- make_ftp_paths
1414
- make_download_urls
1515
- make_SNPtree_urls
16-
16+
- title: Genome download helpers
17+
- contents:
18+
- download_gbk_assembly_summary
19+
- make_SNPtree_urls
20+
- make_ftp_paths
21+
- make_download_urls
22+
- make_dest_paths
23+
- download_genomes
1724
- title: Metadata manipulations
1825
- contents:
1926
- extract_consensus_ag_species

0 commit comments

Comments
 (0)