Skip to content

Commit

Permalink
DOC: another connector helper
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Aug 4, 2024
1 parent c7b76f8 commit 3009743
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ Suggests:
LazyData: TRUE
Remotes: ANTsX/ANTsRCore
VignetteBuilder: knitr
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Encoding: UTF-8
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export(setAntsrTransformParameters)
export(simlr)
export(simlr.perm)
export(simlrU)
export(simlr_path_models)
export(simulateDisplacementField)
export(skeletonize)
export(smoothAppGradCCA)
Expand Down
48 changes: 48 additions & 0 deletions R/multiscaleSVDxpts.R
Original file line number Diff line number Diff line change
Expand Up @@ -4032,3 +4032,51 @@ visualize_lowrank_relationships <- function(X1, X2, V1, V2, plot_title, nm1='X1'
))
}




#' SiMLR Path Models helper
#'
#' Creates the list that should be passed to the connectors argument
#' to simlr. the different options are default (0) which connects
#' each to all others but not itself, a single integer > 0 which forces
#' modeling to focus on a given target and then a pca like option.
#'
#' @param n The length of the output list.
#' @param type The type of modeling. Can be one of the following:
#' - 0: "Exclude self" - each entry contains all integers except the one corresponding to its position.
#' - Integer greater than 0: "focus on a target" - each entry contains the target integer, except for the entry at the target position, which contains all integers except the target.
#' - 'pca': "Identity" - each entry contains its own position number.
#'
#' @return A list of length n with contents based on the input type.
#' @export
simlr_path_models <- function(n, type = 0) {
# Initialize an empty list to store the results
result <- vector("list", n)

# If type is 0, create a list where each entry contains the integers that do not include the integer encoding the position
if (type == 0) {
for (i in 1:n) {
result[[i]] <- setdiff(1:n, i)
}
}
# If type is an integer greater than 0, create a list where each entry contains the integer itself, except for its own entry which contains the integers up to n that do not include itself
else if (type > 0 && type != 'pca') {
for (i in 1:n) {
if (i == type) {
result[[i]] <- setdiff(1:n, i)
} else {
result[[i]] <- type
}
}
}
# If type is 'pca', create a list where each entry contains the integer that encodes the list position
else if (type == 'pca') {
for (i in 1:n) {
result[[i]] <- i
}
}

# Return the resulting list
return(result)
}
2 changes: 1 addition & 1 deletion man/ANTsR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions man/brackets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/simlr_path_models.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3009743

Please sign in to comment.