-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved add_taxonomy from method to function
- Loading branch information
1 parent
f17eae6
commit daad048
Showing
4 changed files
with
38 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: qSIP2 | ||
Title: qSIP Analysis | ||
Version: 0.4.5.9004 | ||
Version: 0.4.5.9005 | ||
Authors@R: | ||
person("Jeff", "Kimbrel", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "YOUR-ORCID-ID")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#' Add a taxonomy table to qSIP abundance data | ||
#' | ||
#' @param feature_object An object of `qsip_feature_data` class | ||
#' @param taxa A taxa table | ||
#' @param id The column name for the taxa ids that match the ids in the | ||
#' abundance table | ||
#' | ||
#' @export | ||
#' | ||
#' @keywords abundance | ||
|
||
add_taxonomy <- function(feature_object, taxa, feature_id) { | ||
|
||
taxa = taxa |> | ||
dplyr::rename("feature_id" := feature_id) | ||
|
||
|
||
feature_object_ids = feature_object@data['feature_id'] | ||
taxa_ids = taxa['feature_id'] | ||
|
||
if (length(setdiff(feature_object_ids, taxa_ids)) > 0) { | ||
stop("Some ids found in the abundance object are not found in the taxa table") | ||
} else if (length(setdiff(taxa_ids, feature_object_ids)) > 0) { | ||
setdiff(taxa_ids, feature_object_ids) | ||
stop("Some ids found in the taxa table are not found in the abundance object") | ||
} else { | ||
|
||
feature_object@taxonomy = taxa | ||
feature_object | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.