Skip to contents

Return the sequence(s) for a record(s) from the accession ID(s).

Usage

gb_sequence_get(id, dnabin = FALSE)

Arguments

id

character, sequence accession ID(s)

dnabin

Logical vector of length 1; should the sequences be returned using the bit-level coding scheme of the ape package? Default FALSE.

Value

named vector of sequences, if no results found NULL

Details

For more information about the dnabin format, see ape::DNAbin().

Examples

library(restez)
restez_path_set(filepath = tempdir())
#> ... Creating '/tmp/RtmpJvhvXj/restez'
#> ... Creating '/tmp/RtmpJvhvXj/restez/downloads'
demo_db_create(n = 5)
(seq <- gb_sequence_get(id = 'demo_1'))
#>       demo_1 
#> "ATAGTTACCC" 
(seqs <- gb_sequence_get(id = c('demo_1', 'demo_2')))
#>       demo_1       demo_2 
#> "ATAGTTACCC" "AACATTTAAG" 
(fasta_dnabin <- gb_sequence_get(id = 'demo_1', dnabin = TRUE))
#> 1 DNA sequence in binary format stored in a list.
#> 
#> Sequence length: 10 
#> 
#> Label:
#> demo_1
#> 
#> Base composition:
#>   a   c   g   t 
#> 0.3 0.3 0.1 0.3 
#> (Total: 10 bases)

# delete demo after example
db_delete(everything = TRUE)