ncbi

How to get taxonomic specific ids for kingdom, phylum, class, order, family, genus and species from taxid?

情到浓时终转凉″ 提交于 2019-12-05 21:46:42
问题 I have a list of taxids that looks like this: 1204725 2162 1300163 420247 I am looking to get a file with taxonomic ids in order from the taxids above: kingdom_id phylum_id class_id order_id family_id genus_id species_id I am using the package "ete3". I use the tool ete-ncbiquery that tells you the lineage from the ids above. (I run it from my linux laptop with the command below) ete3 ncbiquery --search 1204725 2162 13000163 420247 --info The result looks like this: # Taxid Sci.Name Rank

How can I get taxonomic rank names from taxid?

喜夏-厌秋 提交于 2019-12-04 15:20:58
This question is related to: How to get taxonomic specific ids for kingdom, phylum, class, order, family, genus and species from taxid? The solution given there works but I would like to have the names for each taxonomic ids for defined ranks. I have found this on ete3 which can do the job: names = ncbi.get_taxid_translator(lineage) print [names[taxid] for taxid in lineage] but not being python programmer, I am failing to incorporate this into the code given in the link above. Here is what I have tried: import csv from ete3 import NCBITaxa ncbi = NCBITaxa() def get_desired_ranks(taxid, desired

error with a function to retrieve data from a database

我只是一个虾纸丫 提交于 2019-12-01 03:00:04
问题 I am trying to get a FASTA file form NCBI website, I use the following function getncbiseq <- function(accession){ dbs <- c() for (i in 1:numdbs){ db <- dbs[i] choosebank(db) resquery <- try(query(".tmpquery", paste("AC=", accession)),silent = TRUE) if (!(inherits(resquery, "try-error"))){ queryname <- "query2" thequery <- paste("AC=",accession,sep="") query(`queryname`,`thequery`) # see if a sequence was retrieved: seq <- getSequence(query2$req[[1]]) closebank() return(seq) } closebank() }