Skip to content

Commit

Permalink
RMD Check is able to run successfully!
Browse files Browse the repository at this point in the history
  • Loading branch information
GregJohnsonJr committed May 31, 2024
1 parent 931b70b commit 9efe436
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 107 deletions.
19 changes: 0 additions & 19 deletions .vscode/c_cpp_properties.json

This file was deleted.

58 changes: 0 additions & 58 deletions .vscode/settings.json

This file was deleted.

3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
useDynLib(Opticluster, .registration=TRUE)
importFrom(Rcpp, evalCpp)
export(OptiCluster)
importFrom("utils", "read.table")
export(opti_cluster)
24 changes: 12 additions & 12 deletions R/Cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
#' Detailed description of the function.
#'
#' @export
#' @param param1 A Sparse Matrix.
#' @param param2 A cutoff value
#' @param param3 The number of iterations
#' @param sparse_matrix A Sparse Matrix.
#' @param cutoff A cutoff value
#' @param iterations The number of iterations
#' @return A data.frame of the clusters.
OptiCluster <- function(sparse_matrix, cutoff, iterations)
{
indexOneList <- sparse_matrix@i
indexTwoList <- sparse_matrix@j
valueList <- sparse_matrix@x
clustering_output_string <- MatrixToOpiMatrixCluster(indexOneList, indexTwoList, valueList, cutoff,
iterations)
df <- t(read.table(text = clustering_output_string, sep = "\t", header = TRUE))
df <- data.frame(df[-1,])
opti_cluster <- function(sparse_matrix, cutoff, iterations) {
index_one_list <- sparse_matrix@i
index_two_list <- sparse_matrix@j
value_list <- sparse_matrix@x
clustering_output_string <- MatrixToOpiMatrixCluster(index_one_list, index_two_list, value_list, cutoff,

Check warning

Code scanning / lintr

no visible global function definition for 'MatrixToOpiMatrixCluster' Warning

no visible global function definition for 'MatrixToOpiMatrixCluster'

Check notice

Code scanning / lintr

Lines should not be more than 80 characters. This line is 106 characters. Note

Lines should not be more than 80 characters. This line is 106 characters.
iterations)
df <- t(read.table(text = clustering_output_string,
sep = "\t", header = TRUE))
df <- data.frame(df[-1, ])
colnames(df)[1] <- "cluster"
return(df)
}
12 changes: 6 additions & 6 deletions man/OptiCluster.Rd → man/opti_cluster.Rd

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

File renamed without changes.
File renamed without changes.
15 changes: 4 additions & 11 deletions tests/testthat/test-test-opticluster.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
test_that("Clustering returns proper results", {
expected_df <- readRDS(here::here("tests/extdata/df_test_file.RDS"))
matrix <- readRDS(here::here("tests/extdata/matrix_data.RDS"))
df <- Opticluster::OptiCluster(matrix, 0.2, 2)
# Cluster object
# Print objects
# Summary
# Cluster object makes abundance table + print/write statment
# Create test for all the c++ classes
# dotur
expected_df <- readRDS(test_path("extdata","df_test_file.RDS"))

Check notice

Code scanning / lintr

Commas should always have a space after. Note test

Commas should always have a space after.
matrix <- readRDS(test_path("extdata","matrix_data.RDS"))

Check notice

Code scanning / lintr

Commas should always have a space after. Note test

Commas should always have a space after.
df <- Opticluster::opti_cluster(matrix, 0.2, 2)
expect_equal(class(df), "data.frame")
expect_equal(df, expected_df)
})

})

Check notice

Code scanning / lintr

Missing terminal newline. Note test

Missing terminal newline.

0 comments on commit 9efe436

Please sign in to comment.