R/l_tools.R
download_ncbi_genome_file.Rd
This function downloads specific genomic files from NCBI's FTP server based on the provided accession number. It supports downloading different types of files, or the entire directory containing the files.
download_ncbi_genome_file(
accession,
out_dir = ".",
type = "gff",
file_suffix = NULL,
timeout = 300
)
A character string representing the NCBI accession number (e.g., "GCF_001036115.1_ASM103611v1" or "GCF_001036115.1"). The accession can start with "GCF" or "GCA".
A character string representing the directory where the downloaded files will be saved. Defaults to the current working directory (".").
A character string representing the type of file to download. Supported types are "all", "gff", "fna". If "all" is specified, the function will prompt the user to use command line tools to download the entire directory. Defaults to "gff".
A character string representing the specific file suffix to download.
If specified, this will override the type
parameter. Defaults to NULL.
A numeric value representing the maximum time in seconds to wait for the download. Defaults to 300.
No value
If the provided accession
does not contain the version suffix (e.g., "GCF_001036115.1"),
the function will query the NCBI FTP server to determine the full accession name.
When type
is set to "all", the function cannot download the entire directory
directly but provides a command line example for the user to download the directory
using tools like wget
.
if (FALSE) { # \dontrun{
download_ncbi_genome_file("GCF_001036115.1", out_dir = "downloads", type = "gff")
download_ncbi_genome_file("GCF_001036115.1", out_dir = "downloads", file_suffix = "_genomic.fna.gz")
} # }