Main genome retrieval function for an organism of interest.
By specifying the scientific name of an organism of interest the
corresponding fasta-file storing the genome of the organism of interest
can be downloaded and stored locally. Genome files can be retrieved from
several databases. In addition, the genome summary statistics for the
retrieved species is stored locally to provide users with
insights regarding the genome assembly quality (see summary_genome
for details).
This is useful when comparing genomes with large difference in genome assembly qualities.
Usage
getGenome(
db = "refseq",
organism,
reference = FALSE,
release = NULL,
gunzip = FALSE,
path = file.path("_ncbi_downloads", "genomes"),
assembly_type = "toplevel"
)
Arguments
- db
a character string specifying the database from which the genome shall be retrieved:
db = "refseq"
db = "genbank"
db = "ensembl"
- organism
there are three options to characterize an organism:
by
scientific name
: e.g.organism = "Homo sapiens"
by
database specific accession identifier
: e.g.organism = "GCF_000001405.37"
(= NCBI RefSeq identifier forHomo sapiens
)by
taxonomic identifier from NCBI Taxonomy
: e.g.organism = "9606"
(= taxid ofHomo sapiens
)
- reference
a logical value indicating whether or not a genome shall be downloaded if it isn't marked in the database as either a reference genome or a representative genome.
- release
a numeric, the database release version of ENSEMBL (
db = "ensembl"
). Default isrelease = NULL
meaning that the most recent database version is used.release = 75
would for human would give the stable GRCh37 release in ensembl. Value must be > 46, since ensembl did not structure their data if the standard format before that.- gunzip
a logical value indicating whether or not files should be unzipped.
- path
a character string specifying the location (a folder) in which the corresponding genome shall be stored. Default is
path
=file.path("_ncbi_downloads","genomes")
.- assembly_type
a character string specifying from which assembly type the genome shall be retrieved from (ensembl only, else this argument is ignored): Default is
assembly_type = "toplevel")
. This will give you all multi-chromosomes (copies of the same chromosome with small variations). As an example the toplevel fasta genome in human is over 70 GB uncompressed. To get primary assembly with 1 chromosome variant per chromosome:assembly_type = "primary_assembly")
. As an example, the primary_assembly fasta genome in human is only a few GB uncompressed:
Details
Internally this function loads the the overview.txt file from NCBI:
refseq: ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/
genbank: ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/
and creates a directory '_ncbi_downloads/genomes' to store the genome of interest as fasta file for future processing. In case the corresponding fasta file already exists within the '_ncbi_downloads/genomes' folder and is accessible within the workspace, no download process will be performed.
Examples
if (FALSE) {
# download the genome of Arabidopsis thaliana from refseq
# and store the corresponding genome file in '_ncbi_downloads/genomes'
file_path <- getGenome( db = "refseq",
organism = "Arabidopsis thaliana",
path = file.path("_ncbi_downloads","genomes"))
Ath_genome <- read_genome(file_path, format = "fasta")
# download the genome of Arabidopsis thaliana from genbank
# and store the corresponding genome file in '_ncbi_downloads/genomes'
file_path <- getGenome( db = "genbank",
organism = "Arabidopsis thaliana",
path = file.path("_ncbi_downloads","genomes"))
Ath_genome <- read_genome(file_path, format = "fasta")
}