Skip to content

Instantly share code, notes, and snippets.

@DomBennett
Created January 14, 2019 09:37
Show Gist options
  • Save DomBennett/c80b3021396c5bb1880605f23ba36fac to your computer and use it in GitHub Desktop.
Save DomBennett/c80b3021396c5bb1880605f23ba36fac to your computer and use it in GitHub Desktop.
Getting extra sequence information for a phylotaR sequence
library(phylotaR)
data("yeasts")
# not all info is stored on the seq object
str(yeasts@sqs@sqs[[1]])
# but the accession can be used to download extra info
accssn <- yeasts@sqs@sqs[[1]]@id
library(rentrez)
smmry_obj <- entrez_summary(db = 'nucleotide', id = accssn)
str(smmry_obj)
# e.g. getting country
subtypes <- strsplit(smmry_obj[['subtype']], split = '\\|')[[1]]
subnames <- strsplit(smmry_obj[['subname']], split = '\\|')[[1]]
(subnames[subtypes == 'country'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment