You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to retrieve NCBI taxids for all genomes in a particular phylum. It seems that downstream() only works for one level below the given taxid, so I wrote some for loops to collect the information from each subsequent taxonomic level. When I get to the species level, I get "Error: Bad Request (HTTP 400)" and I can link this to a small number of specific species.
Is there a way to ensure the taxids still get downloaded for the downstream() taxa of interest, even if some of them generate the error? My code is below along with the final error and session info.
phylum = "Mollusca"
phy_ids <- as.data.frame(get_ids(phylum, db='ncbi')$ncbi)[1]
class_ids <- ncbi_downstream(id=phy_ids[1], downto="class")$childtaxa_id
order_ids <- list()
for (x in class_ids) {
orders_tmp <- ncbi_downstream(id=x, downto="order")
order_ids <- append(order_ids, list(orders_tmp))
}
family_ids <- list()
for (x in order_ids) {
fam_tmp <- ncbi_downstream(id=c(x$childtaxa_id), downto="family")
family_ids <- append(family_ids, list(fam_tmp))
}
genus_ids <- list()
for (x in family_ids) {
gen_tmp <- ncbi_downstream(id=c(x$childtaxa_id), downto="genus")
genus_ids <- append(genus_ids, list(gen_tmp))
}
species_ids <- list()
for (x in genus_ids) {
spp_tmp <- ncbi_downstream(id=c(x$childtaxa_id), downto="species")
species_ids <- append(species_ids, list(spp_tmp))
}
I am trying to retrieve NCBI taxids for all genomes in a particular phylum. It seems that downstream() only works for one level below the given taxid, so I wrote some for loops to collect the information from each subsequent taxonomic level. When I get to the species level, I get "Error: Bad Request (HTTP 400)" and I can link this to a small number of specific species.
Is there a way to ensure the taxids still get downloaded for the downstream() taxa of interest, even if some of them generate the error? My code is below along with the final error and session info.
Session Info
The text was updated successfully, but these errors were encountered: