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

Merging Dev into Main. #4

Merged
merged 17 commits into from
Jun 14, 2024
Merged

Merging Dev into Main. #4

merged 17 commits into from
Jun 14, 2024

Conversation

GregJohnsonJr
Copy link
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!
R/Cluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide fixed
R/RcppExports.R Fixed Show fixed Hide fixed
R/RcppExports.R Fixed Show fixed Hide fixed
R/RcppExports.R Fixed Show fixed Hide fixed
R/RcppExports.R Fixed Show fixed Hide fixed
tests/testthat/test-test-opticluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide fixed
R/Cluster.R Fixed Show fixed Hide 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. Note test

Commas should always have a space after.
tests/testthat/test-test-opticluster.R Fixed Show fixed Hide fixed
tests/testthat/test-test-opticluster.R Fixed Show fixed Hide 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.
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

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. Note

Variable and function name style should match snake_case or symbols.
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

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. Note

Variable and function name style should match snake_case or symbols.
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

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. Note

Variable and function name style should match snake_case or symbols.
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

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. Note

Lines should not be more than 80 characters. This line is 107 characters.
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. Note

Indentation should be 2 spaces but is 4 spaces.
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' Warning

no visible binding for global variable '_Opticluster_MatrixToOpiMatrixCluster'
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. Note

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. Note test

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.
#' @param sparse_matrix A Sparse Matrix.
#' @param cutoff A cutoff value
#' @param iterations The number of iterations
#' @param shuffle a boolean to determine whether or not you want to shuffle the data before you cluster

Check notice

Code scanning / lintr

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

Lines should not be more than 80 characters. This line is 103 characters.
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 warning

Code scanning / lintr

no visible global function definition for 'MatrixToOpiMatrixCluster' Warning

no visible global function definition for 'MatrixToOpiMatrixCluster'
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

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

Lines should not be more than 80 characters. This line is 111 characters.
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,
iterations, shuffle)

Check notice

Code scanning / lintr

Hanging indent should be 60 spaces but is 55 spaces. Note

Hanging indent should be 60 spaces but is 55 spaces.
clustering_metric <- clustering_output_string_list[2]
clustering_metric_2 <- clustering_output_string_list[3]
df_cluster_metrics <- (read.table(text = clustering_metric,
sep = "\t", header = TRUE))

Check notice

Code scanning / lintr

Hanging indent should be 36 spaces but is 21 spaces. Note

Hanging indent should be 36 spaces but is 21 spaces.
df_cluster_metrics <- (read.table(text = clustering_metric,
sep = "\t", header = TRUE))
df_other_cluster_metrics <- (read.table(text = clustering_metric_2,
sep = "\t", header = TRUE))

Check notice

Code scanning / lintr

Hanging indent should be 43 spaces but is 21 spaces. Note

Hanging indent should be 43 spaces but is 21 spaces.
sep = "\t", header = TRUE))

df_cluster <- t(read.table(text = clustering_output_string,
sep = "\t", header = TRUE))

Check notice

Code scanning / lintr

Hanging indent should be 29 spaces but is 21 spaces. Note

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. Note test

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

Stable build in main!

@GregJohnsonJr GregJohnsonJr reopened this Jun 14, 2024
@GregJohnsonJr GregJohnsonJr merged commit 3ef2d62 into master Jun 14, 2024
23 checks passed
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.

1 participant