diff --git a/DESCRIPTION b/DESCRIPTION index ee356ce..98928d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: phylostratr Title: Analyze phylostratigraphic data -Version: 0.2.0 +Version: 0.2.1 Authors@R: person("Zebulun", "Arendsee", email = "zbwrnz@gmail.com", role = c("aut", "cre")) Description: Infer the age of genes using phylostratigraphic methods. diff --git a/R/uniprot-access.R b/R/uniprot-access.R index e734456..89773f2 100644 --- a/R/uniprot-access.R +++ b/R/uniprot-access.R @@ -156,8 +156,22 @@ uniprot_fill_strata <- function(strata, ...){ #' @return Strata object #' @export uniprot_strata <- function(taxid, from=2){ + + # ensure the focal gene is included, even if not in uniprot (fix #10) + add_focal <- function(xs){ + if(!(taxid %in% xs)){ + message("The focal species is not present in UniProt. ", + "You may add it after retrieving uniprot sequences ", + "(i.e. with 'uniprot_fill_strata') with a command such as: ", + "strata_obj@data$faa[[focal_taxid]] <- '/path/to/your/focal-species.faa'") + xs <- c(taxid, xs) + } + xs + } + taxizedb::classification(taxid)[[1]]$id[from] %>% uniprot_downstream_ids %>% + add_focal %>% taxizedb::classification() %>% Filter(f=is.data.frame) %>% lineages_to_phylo(clean=TRUE) %>%