Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -2625,12 +2625,21 @@ Online <- function(url, strict = FALSE, seconds = 5L) {
# Parenting(parent.find = 'Seurat', features = features[features > 7])
#
Parenting <- function(parent.find = 'Seurat', ...) {
calls <- as.character(x = sys.calls())
calls <- lapply(
X = strsplit(x = calls, split = '(', fixed = TRUE),
FUN = '[',
1
)
# Extract function names from call stack without serializing entire objects
# This avoids the performance issue when large objects are passed via do.call
calls <- vapply(sys.calls(), function(call) {
if (is.call(call) && length(call) > 0) {
# Get just the function name, not the full call with arguments
func <- call[[1]]
if (is.name(func)) {
return(as.character(func))
} else if (is.call(func)) {
# Handle cases like pkg::function - use deparse1 to preserve format
return(deparse1(func))
}
}
return("")
}, character(1))
parent.index <- grep(pattern = parent.find, x = calls)
if (length(x = parent.index) != 1) {
warning(
Expand Down