Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.ComputeClusterStats update; add pattern method to outer functions. #6

Merged
merged 7 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: NAIR
Type: Package
Title: Network Analysis of Immune Repertoire
Version: 1.0.3.9002
Version: 1.0.4.9001
Authors@R: c(
person("Brian", "Neal", email = "[email protected]", role = c("aut", "cre")),
person("Hai", "Yang", email = "[email protected]", role = "aut"),
Expand Down
26 changes: 20 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
# NAIR Current Development Version

## Breaking Changes

* `buildRepSeqNetwork()` now removes data rows with `NA` count values (with a warning) prior to network building when count data is specified via the `count_cols` parameter. This is a reversion to behavior that existed prior to the initial release version 1.0.0.

## New Features

* New internal cpp function that computes graph adjacency matrix using pattern-based algorithm, developed by Daniil Matveev (implemented for metrics Hamming, Levenshtein and cutoffs 0, 1, 2). Faster than the default algorithm when network is sufficiently sparse and sequences are not too long, but can incur memory issues with large or densely-connected networks.
* `generateAdjacencyMatrix()` has new parameter `method` used to specify the algorithm. Accepts value `"pattern"` to call the new routine for the pattern-based algorithm.
* Speed improvements to the default algorithms for computing graph adjacency matrices
* Speed improvement to the argument check used for function parameters that accept an adjacency matrix
* New internal cpp function to compute graph adjacency matrix using pattern-based algorithm developed by Daniil Matveev (implemented for metrics Hamming, Levenshtein and cutoffs 0, 1, 2).
* `generateAdjacencyMatrix()` and `generateNetworkObjects()` have new parameter `method` used to specify the algorithm. Accepts value `"pattern"` to call the new routine for the pattern-based algorithm.
* `buildRepSeqNetwork()` has new parameter `net_build_method` used to specify the algorithm.
* Speed improvements:
* Default algorithms for computing graph adjacency matrices
* Computation of cluster properties
* Argument check for function parameters that accept an adjacency matrix

## Minor Changes and Bug Fixes

* Saving network output using `output_type = "individual"` now also saves the entire network list as an RData file (`.rda`).
* Updated tests for compatibility with upcoming changes to guides in `ggplot2` (thanks to Teun van den Brand and the `ggplot2` development team for contributing the updates)
* `filterInputData()` parameter `count_col` is no longer deprecated; when provided, data rows with `NA` count values are removed with a warning.



# NAIR 1.0.4

## Minor Changes and Bug Fixes

* Updated tests for compatibility with changes to guides in `ggplot2` (thanks to Teun van den Brand and the `ggplot2` development team for contributing the updates)
* Saving network output using `output_type = "individual"` now also saves the entire network list as an RData file (`.rda`).



# NAIR 1.0.3
Expand Down
3 changes: 3 additions & 0 deletions R/arghecks_upper.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@
}

.matchMethod <- function(x, cutoff) {
if (cutoff == 0) {
return("pattern")
}
if (pmatch(x, "pattern", 0)) {
if (!any(cutoff == c(0, 1, 2))) {
warning(
Expand Down
12 changes: 10 additions & 2 deletions R/main_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ buildRepSeqNetwork <- function(
dist_type = "hamming",
dist_cutoff = 1,
drop_isolated_nodes = TRUE,
net_build_method = "default",
node_stats = FALSE,
stats_to_include = chooseNodeStats(),
cluster_stats = FALSE,
Expand Down Expand Up @@ -55,6 +56,7 @@ buildRepSeqNetwork <- function(
drop_matches <- .check(drop_matches, .isString, NULL, ornull = TRUE)
dist_type <- .checkDistType(dist_type, "hamming")
dist_cutoff <- .check(dist_cutoff, .isNonneg, 1)
net_build_method <- .checkMethod(net_build_method, dist_cutoff)
drop_isolated_nodes <- .checkTF(drop_isolated_nodes, TRUE)
node_stats <- .checkTF(node_stats, FALSE)
if (isTRUE(node_stats)) {
Expand Down Expand Up @@ -105,8 +107,14 @@ buildRepSeqNetwork <- function(
}

# Build network
net <- generateNetworkObjects(data, seq_col, dist_type, dist_cutoff,
drop_isolated_nodes, verbose
net <- generateNetworkObjects(
data,
seq_col,
dist_type = dist_type,
dist_cutoff = dist_cutoff,
drop_isolated_nodes = drop_isolated_nodes,
method = net_build_method,
verbose = verbose
)
if (is.null(net)) {
warning("Graph contains no nodes; returning NULL. ",
Expand Down
Loading
Loading