-
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.
Added a check for gene ID matching between gene pairs and CDS + updat…
…ed vignette accordingly
- Loading branch information
1 parent
0e3c5f0
commit 7765ce7
Showing
15 changed files
with
136 additions
and
278 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
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
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,37 @@ | ||
|
||
#' Check if gene names in set 1 are present in set 2 | ||
#' | ||
#' @param ref_ids Character vector of reference gene set. | ||
#' @param test_ids Character vector of test gene set. | ||
#' @param setnames Character vector of length with set names. | ||
#' Default: \code{c("gene pairs", "CDS")} | ||
#' | ||
#' @return TRUE if names match, otherwise an error is shown. | ||
#' @importFrom utils head | ||
#' @details | ||
#' This internal function can be used, for instance, to check if CDS names | ||
#' match gene IDs in the gene pair list. | ||
#' @noRd | ||
check_geneid_match <- function( | ||
ref_ids, test_ids, setnames = c("gene pairs", "CDS") | ||
) { | ||
|
||
mismatch_ids <- ref_ids[!ref_ids %in% test_ids] | ||
mismatch_perc <- length(mismatch_ids) / length(ref_ids) | ||
mismatch_perc <- round(mismatch_perc * 100, 2) | ||
|
||
if(mismatch_perc >0) { | ||
stop( | ||
mismatch_perc, "%", " (N=", length(mismatch_ids), ") of the IDs in ", setnames[1], | ||
" were not found in ", setnames[2], ".\n", | ||
"All gene IDs in ", setnames[1], " must be in ", setnames[2], | ||
". Did you check if gene IDs match?", | ||
"\n\nHere are some examples of nonmatching IDs (from ", setnames[1], ") :\n", | ||
paste0(head(mismatch_ids, n = 5), collapse = "\n"), | ||
"\n\nAnd here are some examples of IDs in ", setnames[2], ":\n", | ||
paste0(head(test_ids, n = 5), collapse = "\n") | ||
) | ||
} | ||
|
||
return(TRUE) | ||
} |
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
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.