Skip to content

Commit

Permalink
Handle focal species not in UniProt (fix #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
arendsee committed Jul 22, 2019
1 parent 9f6d1ee commit e789ecc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 14 additions & 0 deletions R/uniprot-access.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) %>%
Expand Down

0 comments on commit e789ecc

Please # to comment.