Skip to content

Merging Dev into Main.#4

Merged
GregJohnsonJr merged 17 commits intomasterfrom
dev
Jun 14, 2024
Merged

Merging Dev into Main.#4
GregJohnsonJr merged 17 commits intomasterfrom
dev

Conversation

@GregJohnsonJr
Copy link
Copy Markdown
Collaborator

After the creation of the unit test and stability checks, we should be able to merge this back into main.

* Fixed the wrapper for Calling Opticluster!

* Fixing the .RD file

* Fixed issue where opticluster was returning a matrix array and not a data.frame.

* Changing documentation

* Fixing the warnings from building the code.

* Update to the test

* Updating the gitignore
* Added Cpp testing structure!

* Added Test Fixture Class

* Forced the cluster to only return OTU data, and created the fix test fixture with test!

* Created all of the test for the optimatrix adapter and removed the .dll from being tracked!

* Created all the test in the testfixture for listvectors and now I am adding them to the test files.

* Created base test for listVector

* Basic test for listVector are completed!

* Created the basic structure and test fixture for cluster commands

* Cluster Testing suite being pushed up!

* Fix cluster algorithm (#2)

* Fixed a slew of issues by adding bidirection distances.

* Fixed the clustering issue, clustering should be working correctly now!

* Generated Definitions for OptiCluster Test

* Finished creating unit test of the cluster command and opticluster

* Added OptiData test fixture

* Started creating the unit test for utils

* Utils command cluster and test work as expected!!

* Removed old code from one of the testing suites.

* Added another test in utils.

* Clustor has a 89% test coverage! Everything should be tested and ready to merge back!
Comment thread R/Cluster.R Fixed
Comment thread R/Cluster.R Fixed
Comment thread R/Cluster.R Fixed
Comment thread R/Cluster.R Fixed
Comment thread R/Cluster.R Fixed
Comment thread R/RcppExports.R Fixed
Comment thread R/RcppExports.R Fixed
Comment thread R/RcppExports.R Fixed
Comment thread R/RcppExports.R Fixed
Comment thread tests/testthat/test-test-opticluster.R Fixed
Comment thread R/Cluster.R Fixed
Comment thread R/Cluster.R Fixed
@@ -0,0 +1,7 @@
test_that("Clustering returns proper results", {
expected_df <- readRDS(test_path("extdata","df_test_file.RDS"))

Check notice

Code scanning / lintr

Commas should always have a space after.

Commas should always have a space after.
Comment thread tests/testthat/test-test-opticluster.R Fixed
Comment thread tests/testthat/test-test-opticluster.R Fixed
Comment thread tests/testthat/test-test-opticluster.R Fixed
…roper stats". I appears it is returning incorrect data on different computer architectures. It is also not needed in the code.
* This should be the fix for the failing cluster test.

* Changed the test to look for equivalence rows instead of equal dataframes. Gives the same results, the only differences is that the cluster have different numbers.
Comment thread R/RcppExports.R

MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols.

Variable and function name style should match snake_case or symbols.
Comment thread R/RcppExports.R

MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols.

Variable and function name style should match snake_case or symbols.
Comment thread R/RcppExports.R

MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {

Check notice

Code scanning / lintr

Variable and function name style should match snake_case or symbols.

Variable and function name style should match snake_case or symbols.
Comment thread R/RcppExports.R

MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 107 characters.
Comment thread R/RcppExports.R
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, iterations, shuffle)

Check notice

Code scanning / lintr

Indentation should be 2 spaces but is 4 spaces.

Indentation should be 2 spaces but is 4 spaces.
Comment thread R/RcppExports.R
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, iterations, shuffle)

Check warning

Code scanning / lintr

no visible binding for global variable '_Opticluster_MatrixToOpiMatrixCluster'

no visible binding for global variable '_Opticluster_MatrixToOpiMatrixCluster'
Comment thread R/RcppExports.R
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations)
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L, shuffle = TRUE) {
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, iterations, shuffle)

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 107 characters.
@@ -0,0 +1,8 @@
test_that("Clustering returns proper results", {
expected_df <- readRDS(test_path("extdata","df_test_file.RDS"))
matrix <- readRDS(test_path("extdata","matrix_data.RDS"))

Check notice

Code scanning / lintr

Commas should always have a space after.

Commas should always have a space after.
* Added to build ignore and properly documented the new R code.

* Unstable, have to fix the mismatch header situation, but was able to return a vector with all the metrics!

* Cluster now returns test metrics and added test to support it.
Comment thread R/Cluster.R
#' @export
#' @param sparse_matrix A Sparse Matrix.
#' @param cutoff A cutoff value
#' @param iterations The number of iterations

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 103 characters.
Comment thread R/Cluster.R
opti_cluster <- function(sparse_matrix, cutoff, iterations, shuffle = TRUE) {
index_one_list <- sparse_matrix@i
index_two_list <- sparse_matrix@j
value_list <- sparse_matrix@x

Check warning

Code scanning / lintr

no visible global function definition for 'MatrixToOpiMatrixCluster'

no visible global function definition for 'MatrixToOpiMatrixCluster'
Comment thread R/Cluster.R
opti_cluster <- function(sparse_matrix, cutoff, iterations, shuffle = TRUE) {
index_one_list <- sparse_matrix@i
index_two_list <- sparse_matrix@j
value_list <- sparse_matrix@x

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 111 characters.
Comment thread R/Cluster.R
index_one_list <- sparse_matrix@i
index_two_list <- sparse_matrix@j
value_list <- sparse_matrix@x
clustering_output_string_list <- MatrixToOpiMatrixCluster(index_one_list, index_two_list, value_list, cutoff,

Check notice

Code scanning / lintr

Hanging indent should be 60 spaces but is 55 spaces.

Hanging indent should be 60 spaces but is 55 spaces.
Comment thread R/Cluster.R
clustering_output_string <- clustering_output_string_list[1]
clustering_metric <- clustering_output_string_list[2]
clustering_metric_2 <- clustering_output_string_list[3]
df_cluster_metrics <- (read.table(text = clustering_metric,

Check notice

Code scanning / lintr

Hanging indent should be 36 spaces but is 21 spaces.

Hanging indent should be 36 spaces but is 21 spaces.
Comment thread R/Cluster.R
clustering_metric_2 <- clustering_output_string_list[3]
df_cluster_metrics <- (read.table(text = clustering_metric,
sep = "\t", header = TRUE))
df_other_cluster_metrics <- (read.table(text = clustering_metric_2,

Check notice

Code scanning / lintr

Hanging indent should be 43 spaces but is 21 spaces.

Hanging indent should be 43 spaces but is 21 spaces.
Comment thread R/Cluster.R
df_other_cluster_metrics <- (read.table(text = clustering_metric_2,
sep = "\t", header = TRUE))

df_cluster <- t(read.table(text = clustering_output_string,

Check notice

Code scanning / lintr

Hanging indent should be 29 spaces but is 21 spaces.

Hanging indent should be 29 spaces but is 21 spaces.
expected_df <- readRDS(test_path("extdata","df_test_file.RDS"))
matrix <- readRDS(test_path("extdata","matrix_data.RDS"))
df <- Opticluster::opti_cluster(matrix, 0.2, 2, FALSE)
df$cluster$exists <- do.call(paste0, df$cluster) %in% do.call(paste0, expected_df)

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 84 characters.
@GregJohnsonJr
Copy link
Copy Markdown
Collaborator Author

Stable build in main!

@GregJohnsonJr GregJohnsonJr reopened this Jun 14, 2024
@GregJohnsonJr GregJohnsonJr merged commit 3ef2d62 into master Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants