Return a vector of all IDs in a database.
See also
Other database:
count_db_ids()
,
db_create()
,
db_delete()
,
db_download()
,
demo_db_create()
,
is_in_db()
Examples
library(restez)
restez_path_set(filepath = tempdir())
#> ... Creating '/tmp/RtmpUsDojX/restez'
#> ... Creating '/tmp/RtmpUsDojX/restez/downloads'
demo_db_create(n = 5)
# Warning: not recommended for real databases
# with potentially millions of IDs
all_ids <- list_db_ids()
#> Warning: Number of ids returned was limited to [100].
#> Set `n=NULL` to return all ids.
# What shall we do with these IDs?
# ... how about make a mock fasta file
seqs <- gb_sequence_get(id = all_ids)
defs <- gb_definition_get(id = all_ids)
# paste together
fasta_seqs <- paste0('>', defs, '\n', seqs)
fasta_file <- paste0(fasta_seqs, collapse = '\n')
cat(fasta_file)
#> >A demonstration sequence | id demo_1
#> AGGCGTCTGC
#> >A demonstration sequence | id demo_2
#> ATCCTTGCAT
#> >A demonstration sequence | id demo_3
#> AAAGCACCGT
#> >A demonstration sequence | id demo_4
#> AAGCATGGAC
#> >A demonstration sequence | id demo_5
#> TTTATGGGTT
# delete after example
db_delete(everything = TRUE)