This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BLAST in R, taxonomy

I am a student working on a microbiome project and I am using R to retrieve species names from NCBI taxonomy data. I have obtained the accession numbers through rBLAST and now I need to retrieve the corresponding species names.

I have tried using different R packages such as taxonomizr, taxize, and now I am using rentrez. With rentrez, I was able to retrieve the taxonomy data, but it is in a list format where each UID has an additional level containing the item 'title' that corresponds to the species/strain name.

I am looking for guidance on how to efficiently extract the species names from the nested list structure in rentrez. I want to extract the 'title' value for each UID without having to manually specify the nested levels.

Any suggestions or code examples on how to accomplish this task would be greatly appreciated. Thank you! I used entrez_summary(): taxonomy_result <- entrez_summary(db = "nuccore", id = accession_numbers, rettype = "xml", parsed=TRUE)

taxonomy r microbiome blast

1 answer

You will need to translate this into R but you do this with the parent EntrezDirect package as follows:

$ esearch -db nuccore -query "XM_040895040" | efetch -format docsum | xtract -pattern DocumentSummary -element Organism
Aspergillus ochraceoroseus IBT 24754

Log in to answer this question.