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

Dev #48

Merged
merged 122 commits into from
Nov 8, 2024
Merged

Dev #48

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
5cae88f
Added unit test and created a easy opticluster function
GregJohnsonJr Apr 24, 2024
37ec06d
Release v0.0.1 (#1)
GregJohnsonJr Apr 29, 2024
931b70b
Add cpp test (#3)
GregJohnsonJr May 17, 2024
9efe436
RMD Check is able to run successfully!
GregJohnsonJr May 31, 2024
678d5a3
Correcting the paths of my cpp files, should fix the action errors.
GregJohnsonJr May 31, 2024
2c99c18
Update to the cluster command test fixture
GregJohnsonJr May 31, 2024
8f3cbc1
Modifying the test for opticluster
GregJohnsonJr Jun 3, 2024
626e70a
Ensuring everything works with c++11
GregJohnsonJr Jun 3, 2024
5b1bdb0
Removing code issues from cluster command
GregJohnsonJr Jun 3, 2024
e35e710
Adding the build ignore
GregJohnsonJr Jun 3, 2024
11a41dd
Founds some issue where I am using c++ 17 syntax and not 11.
GregJohnsonJr Jun 5, 2024
8fcff5d
Github action fixes, needed to update syntax towards cpp 11
GregJohnsonJr Jun 6, 2024
6eb79ec
Modified the testing structure by removing the "Opticluster returns p…
GregJohnsonJr Jun 6, 2024
50c3a7c
Fix cluster unit test (#5)
GregJohnsonJr Jun 10, 2024
b717404
Printing out the metrics after you perform a cluster and added a true…
GregJohnsonJr Jun 10, 2024
77ebc1c
Release polish (#6)
GregJohnsonJr Jun 14, 2024
58a4056
Added a depends for lazy-loading and other R related issues.
GregJohnsonJr Jun 14, 2024
d958121
More cluster features (#7)
GregJohnsonJr Jul 12, 2024
12aaa2e
Merge branch 'master' into dev
GregJohnsonJr Jul 12, 2024
2682ec5
The fix for github actions.
GregJohnsonJr Jul 12, 2024
b7a77be
Change to the include file.
GregJohnsonJr Jul 12, 2024
869656e
Removing srand from Utils, going to attempt to set seeds inside of R.
GregJohnsonJr Jul 12, 2024
fc8b722
Fix for race condition issue.
GregJohnsonJr Jul 15, 2024
8603183
Fix for RCMD check warnings
GregJohnsonJr Jul 15, 2024
79fb369
The fix for the windows version of RMD Check!
GregJohnsonJr Jul 16, 2024
1a4256b
Adding dependency for time.
GregJohnsonJr Jul 16, 2024
8e0ae22
Make shared (#9)
GregJohnsonJr Aug 30, 2024
7564d48
Forgot a unit test. (#10)
GregJohnsonJr Sep 3, 2024
3bd7dea
Fix results (#11)
GregJohnsonJr Sep 10, 2024
2be797e
Removing and fixing check issues.
GregJohnsonJr Sep 10, 2024
a445421
Fix compilation warnings (#12)
GregJohnsonJr Sep 11, 2024
e7d8625
Fix for negative index value
GregJohnsonJr Sep 11, 2024
ad47beb
Cleaning up build notes.
GregJohnsonJr Sep 11, 2024
ba93c19
Merge branch 'master' into dev
GregJohnsonJr Sep 11, 2024
e6a4c9f
lintr fixes
GregJohnsonJr Sep 11, 2024
386a0c7
Fix for lintr
GregJohnsonJr Sep 11, 2024
7ea9c0b
Read phylip files (#14)
GregJohnsonJr Sep 12, 2024
fa25af7
Initial push
GregJohnsonJr Sep 12, 2024
25a357d
Adding r documentation about mothur and clustur
GregJohnsonJr Sep 12, 2024
e6f00a8
Added functionality for column distance file reading!
GregJohnsonJr Sep 13, 2024
6f830c6
Column distance files work!
GregJohnsonJr Sep 13, 2024
3d8015f
Adding read column feature (#15)
GregJohnsonJr Sep 16, 2024
42162e1
Documentation (#16)
GregJohnsonJr Sep 16, 2024
d7dc294
Fix for opticluster clustering.
GregJohnsonJr Sep 16, 2024
37cdb7e
Fixing up the documentation
GregJohnsonJr Sep 16, 2024
48a0f38
I am getting the same number of bins!
GregJohnsonJr Sep 16, 2024
4c63f8c
example data
GregJohnsonJr Sep 17, 2024
58a7e8e
Fix for test error
GregJohnsonJr Sep 17, 2024
0d3e798
Testing values to RMD file
GregJohnsonJr Sep 17, 2024
3bddc53
Small changes
GregJohnsonJr Sep 18, 2024
d486604
Added sorting by bin size to cluster output and fixed the clustering …
GregJohnsonJr Sep 18, 2024
d89afb5
Modification to the test!
GregJohnsonJr Sep 18, 2024
60d16f5
Updates to test file
GregJohnsonJr Sep 18, 2024
acfbc9a
Cleaning up test
GregJohnsonJr Sep 18, 2024
585736e
Small change
GregJohnsonJr Sep 18, 2024
1623601
Method to check if each cluster exist in the dataframe
GregJohnsonJr Sep 21, 2024
d08a209
Using content paths instead of absolutes
GregJohnsonJr Sep 21, 2024
a745510
Create 96_sq_column_results_mac.list
GregJohnsonJr Sep 23, 2024
5af269d
Pushing results for different operating systems
GregJohnsonJr Sep 23, 2024
3cb0ba4
Updating documentation
GregJohnsonJr Sep 24, 2024
7c694e3
Added inst folders
GregJohnsonJr Sep 24, 2024
0b5a145
Update Cluster.R
GregJohnsonJr Sep 24, 2024
7eec4fb
Pushing the temporary fix!
GregJohnsonJr Sep 24, 2024
63d515e
Pushing spare_matrix data file
GregJohnsonJr Sep 24, 2024
6a5df20
Squashed commit of the following:
GregJohnsonJr Sep 24, 2024
a714b7d
Creating vignettes
GregJohnsonJr Sep 25, 2024
4a4fcfa
Created base pkgdown structure
GregJohnsonJr Sep 25, 2024
05c8a07
Base structure of documentation and website
GregJohnsonJr Sep 25, 2024
8c648bd
Small optimzation to clustur
GregJohnsonJr Sep 25, 2024
e87319e
Fixing unit test
GregJohnsonJr Sep 25, 2024
1251c3c
Removing comments
GregJohnsonJr Sep 25, 2024
2c642f3
Changed the name of the package to clustur
GregJohnsonJr Sep 25, 2024
3f04170
Removing unneeded data and fixing issue to validate count_table
GregJohnsonJr Sep 25, 2024
3f2d399
Fixing check errors.
GregJohnsonJr Sep 25, 2024
10c2ad9
Consistent randomization (#17)
GregJohnsonJr Sep 26, 2024
45ba179
Consistent randomization (#18)
GregJohnsonJr Sep 26, 2024
6d30db8
Squashed commit of the following:
GregJohnsonJr Sep 26, 2024
00b5013
Merge branch 'Documentation' into dev
GregJohnsonJr Sep 26, 2024
439668a
Documentation (#16) (#19) (#20)
GregJohnsonJr Sep 26, 2024
e2e52c4
Removing old vignette
GregJohnsonJr Sep 26, 2024
ea4d749
Adding additional documentation
GregJohnsonJr Sep 29, 2024
d62037b
Adding links (#22)
GregJohnsonJr Sep 30, 2024
012fc12
Moving RDS file
GregJohnsonJr Sep 30, 2024
3471ba2
Small changes to test
GregJohnsonJr Sep 30, 2024
7501509
Merge branch 'master' into dev
GregJohnsonJr Sep 30, 2024
c1cab5b
Adding a vignette, fixed the test that were failing, and removed old …
GregJohnsonJr Sep 30, 2024
a9e8095
Small change to test
GregJohnsonJr Sep 30, 2024
69b13c4
Pushing lintr fixes
GregJohnsonJr Sep 30, 2024
4f758f2
Distance files to sparse matrix (#23)
GregJohnsonJr Oct 3, 2024
43b21cf
Unify clustering (#25)
GregJohnsonJr Oct 4, 2024
64812ba
Refactor package methods (#26)
GregJohnsonJr Oct 11, 2024
a8a0863
Added tests for the validate_count_table function
GregJohnsonJr Oct 11, 2024
aca2d2e
Removing R profile from tracking
GregJohnsonJr Oct 13, 2024
cfa9e93
Merge branch 'master' into dev
GregJohnsonJr Oct 13, 2024
f2b152f
Delete .Rprofile
GregJohnsonJr Oct 13, 2024
4a8a2cf
Fix lintr and pkgdown issues
GregJohnsonJr Oct 13, 2024
ca49407
Fix for pkgdown and lintr
GregJohnsonJr Oct 13, 2024
046ed48
Change to test in cluster_object-getters.
GregJohnsonJr Oct 13, 2024
4a5b787
Squashed commit of the following:
GregJohnsonJr Oct 14, 2024
8e509d9
Sync branches (#29)
GregJohnsonJr Oct 14, 2024
3d7cddb
Fix for reading column and phylip files.
GregJohnsonJr Oct 14, 2024
8ad307c
removing data files
GregJohnsonJr Oct 14, 2024
dc9c807
Code profiling (#31)
GregJohnsonJr Oct 14, 2024
b93d89a
Removing extra storage files and merge issues
GregJohnsonJr Oct 14, 2024
1b26f74
Added New test for determining if the file is a phylip or column file…
GregJohnsonJr Oct 15, 2024
9c59c09
Merge branch 'master' into dev
GregJohnsonJr Oct 15, 2024
82de80a
lintr fix
GregJohnsonJr Oct 15, 2024
f8f524a
Merge branch 'dev' of https://github.com/SchlossLab/Clustur into dev
GregJohnsonJr Oct 15, 2024
4e4ffd2
Added new function for creating sparse matrices, and added test
GregJohnsonJr Oct 16, 2024
898c67d
Package documentation (#36)
GregJohnsonJr Oct 21, 2024
7df91d7
Merge branch 'master' into dev
GregJohnsonJr Oct 21, 2024
b461a46
lintr fixes
GregJohnsonJr Oct 21, 2024
bd9082b
Squashed commit of the following:
GregJohnsonJr Nov 6, 2024
862ed7c
Fix for sparse matrix failing
GregJohnsonJr Nov 7, 2024
f52e9b6
Sparse matrix fix (#42)
GregJohnsonJr Nov 7, 2024
c45262e
Fixing readme/readme.rmd
GregJohnsonJr Nov 7, 2024
e3bc2cb
Merge branch 'master' into dev
GregJohnsonJr Nov 7, 2024
756717e
Fix for lintr
GregJohnsonJr Nov 7, 2024
385bff8
Merge branch 'master' into dev
GregJohnsonJr Nov 7, 2024
f6ce50f
Merge branch 'master' into dev
GregJohnsonJr Nov 8, 2024
57bd9d4
Finishing touches (#47)
GregJohnsonJr Nov 8, 2024
72a0564
Removing old function and fixing the lintr issues.
GregJohnsonJr Nov 8, 2024
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
12 changes: 2 additions & 10 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

WritePhylipFile <- function(xPosition, yPosition, data, cutoff, countTable, saveLocation) {
invisible(.Call('_clustur_WritePhylipFile', PACKAGE = 'clustur', xPosition, yPosition, data, cutoff, countTable, saveLocation))
}

WriteColumnFile <- function(xPosition, yPosition, data, cutoff, countTable, saveLocation) {
invisible(.Call('_clustur_WriteColumnFile', PACKAGE = 'clustur', xPosition, yPosition, data, cutoff, countTable, saveLocation))
}

DetermineIfPhylipOrColumnFile <- function(filePath) {
.Call('_clustur_DetermineIfPhylipOrColumnFile', PACKAGE = 'clustur', filePath)
}
Expand Down Expand Up @@ -37,7 +29,7 @@ OptiCluster <- function(DistanceData, featureColumnName, binColumnName, cutoff)
.Call('_clustur_OptiCluster', PACKAGE = 'clustur', DistanceData, featureColumnName, binColumnName, cutoff)
}

CreateDataFrameFromSparse <- function(countTable) {
.Call('_clustur_CreateDataFrameFromSparse', PACKAGE = 'clustur', countTable)
CreateDataFrameFromSparseCountTable <- function(countTable) {
.Call('_clustur_CreateDataFrameFromSparseCountTable', PACKAGE = 'clustur', countTable)
}

3 changes: 2 additions & 1 deletion R/cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ read_count <- function(count_table_path) {
if (grepl("#", test_read[1, 1], fixed = TRUE)) {
count_table_sparse <- read.delim(count_table_path, sep = "\t", skip = 2)
count_table_sparse <- lapply(count_table_sparse, as.character)
return(validate_count_table(CreateDataFrameFromSparse(count_table_sparse)))
ct <- CreateDataFrameFromSparseCountTable(count_table_sparse)
return(validate_count_table(ct))
}
return(validate_count_table(read.delim(count_table_path, sep = "\t")))
}
Expand Down
1 change: 0 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ To get started, look at the ["Getting started"](www.schlosslab.org/clustur/) pag

For feature request please visit the issue page in github and use the feature
tag. If you would like to contribute pull request are welcomed!

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ library(clustur)
## Getting Started

To get started, look at the [“Getting
started”](https:://www.schlosslab.org/clustur/) page.
started”](www.schlosslab.org/clustur/) page.

## Contributions

Expand Down
3 changes: 1 addition & 2 deletions src/Adapters/CountTableAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <queue>
#include <set>

#include "../RowData.h"


class CountTableAdapter {
public:
Expand All @@ -29,7 +29,6 @@ class CountTableAdapter {
std::vector<std::string> GetGroups() const;
Rcpp::DataFrame GetCountTable() const {return countTable;}
Rcpp::DataFrame ReCreateDataFrame() const;
std::set<std::string> CheckDistanceFileOnlyHasNamesInCount(const std::vector<RowData>&) const;
private:
void CreateNameToIndex();
struct IndexAbundancePair {
Expand Down
4 changes: 1 addition & 3 deletions src/Adapters/DistanceFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "CountTableAdapter.h"
#include "../MothurDependencies/ListVector.h"
#include "../RowData.h"
#include "../MothurDependencies/SparseDistanceMatrix.h"

class DistanceFileReader {
Expand All @@ -18,12 +17,11 @@ class DistanceFileReader {
// We need to deduce type, the easy way to do that is to see if there is a number for the first item read.
// Phylip files have a number of sequences located at the top. We can use that to our advantage.
virtual bool Read(const std::string& filePath) {return false;}
DistanceFileReader(SparseDistanceMatrix*, ListVector*, bool);
DistanceFileReader(SparseDistanceMatrix*, ListVector*, double, bool);
DistanceFileReader() = default;
// Phylip files do not need a count table
SparseDistanceMatrix* GetSparseMatrix() const {return new SparseDistanceMatrix(*sparseMatrix);}
ListVector* GetListVector() const {return new ListVector(*list);}
void SetRowDataMatrix(const std::vector<RowData>& data);
void SetCountTable(CountTableAdapter data);
Rcpp::DataFrame SparseMatrixToDataFrame() const;
Rcpp::DataFrame GetCountTable() const;
Expand Down
2 changes: 0 additions & 2 deletions src/Adapters/MatrixAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class MatrixAdapter {
MatrixAdapter(const std::vector<int> &iIndexes, const std::vector<int> &jIndexes,
const std::vector<double> &dataValues, double cutOff, bool isSimularity, CountTableAdapter table);
~MatrixAdapter() = default;
bool CreatePhylipFile(const std::string &saveFileLocation);
bool CreateColumnDataFile(const std::string &saveFileLocation);
SparseDistanceMatrix CreateSparseMatrix();
ListVector CreateListVector() const;

Expand Down
9 changes: 0 additions & 9 deletions src/Adapters/OptimatrixAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include <unordered_map>
#include <sstream>

#include "../RowData.h"


class OptimatrixAdapter {
///Closeness is the data represntation, it is a vector of sets that tells us which values are closes to it ->
/// So, close[0], if Namemap[0] = A, then close[0] is the values that are within the cutoff to A.
Expand All @@ -28,14 +25,8 @@ class OptimatrixAdapter {
explicit OptimatrixAdapter(const double cutoff) {
this->cutoff = cutoff;
}
OptiMatrix* ConvertToOptimatrix(const std::vector<int>
&xPosition, const std::vector<int>& yPosition, const std::vector<double>& data);
OptiMatrix* ConvertToOptimatrix(const std::vector<RowData>&, bool);
OptiMatrix* ConvertToOptimatrix(const SparseDistanceMatrix* matrixData,
const ListVector* listVector, bool sim);
std::vector<std::unordered_set<long long>> GetCloseness() {return {};}
std::vector<std::string> GetNameList() {return {};}
std::vector<std::string> GetSingletons() {return {};}
private:
double cutoff;
//TODO Get rid of values inside of the adapter, it should not care about them
Expand Down
8 changes: 2 additions & 6 deletions src/ClusterCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ ClusterExport* ClusterCommand::runOptiCluster(OptiMatrix *optiMatrix, const doub
}
util.AddRowToDataFrameMap(dataframeMapClusterMetrics, clusterMetrics, clusterMetricsHeaders);
std::chrono::time_point<std::chrono::system_clock> start, end;
//m->mothurOutEndLine();
// Stable Metric -> Keep the data stable, to prevent errors (rounding errors)
// The difference between what the current and last metric (delta)
// MaxIters -> is an exit condition

while ((delta > stableMetric) && (iters < maxIters)) {
//long start = std::time(nullptr);
double oldMetric = listVectorMetric;
Expand Down Expand Up @@ -126,7 +123,6 @@ ClusterExport* ClusterCommand::runOptiCluster(OptiMatrix *optiMatrix, const doub
clusterInformation.clusterBins = list->print(listFile);
data->AddToData(clusterInformation);
data->SetListVector(*list, std::to_string(cutoff));
// clusterMatrixOutput = list->print(listFile);
stats = cluster.getStats(tp, tn, fp, fn);

sensFile += std::to_string(cutoff) + ',' + std::to_string(cutoff) + ',' + std::to_string(tp) + ',' +
Expand Down Expand Up @@ -157,7 +153,7 @@ ClusterExport* ClusterCommand::runMothurCluster(const std::string &clusterMethod
float previousDist = 0.00000;
float rndPreviousDist = 0.00000;
oldList = *list;
bool printHeaders = false;
constexpr bool printHeaders = false;
std::string clusterResult;
double highestDistLabel = -1;
std::string binResults;
Expand Down
20 changes: 0 additions & 20 deletions src/ClusterCommandTestFixture.cpp

This file was deleted.

10 changes: 0 additions & 10 deletions src/CountTableAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ Rcpp::DataFrame CountTableAdapter::ReCreateDataFrame() const {
return countTable;
}

std::set<std::string> CountTableAdapter::CheckDistanceFileOnlyHasNamesInCount(const std::vector<RowData>& data) const {
std::set<std::string> names;
for(const auto& value : data) {
if(nameToRowIndex.find(value.name) == nameToRowIndex.end()) {
names.insert(value.name);
}
}
return names;
}


void CountTableAdapter::CreateNameToIndex() {
for(size_t i = 0; i < sampleNames.size(); i++) {
Expand Down
3 changes: 2 additions & 1 deletion src/DistanceFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@


DistanceFileReader::DistanceFileReader(SparseDistanceMatrix *sparseDistanceMatrix,
ListVector *listVector, const bool isSim):sparseMatrix(sparseDistanceMatrix), list(listVector), sim(isSim){}
ListVector *listVector, const double cutoff, const bool isSim):sparseMatrix(sparseDistanceMatrix),
list(listVector), cutoff(cutoff), sim(isSim){}

Rcpp::DataFrame DistanceFileReader::SparseMatrixToDataFrame() const {
const size_t size = sparseMatrix->seqVec.size();
Expand Down
2 changes: 0 additions & 2 deletions src/Makevars.txt

This file was deleted.

46 changes: 0 additions & 46 deletions src/MatrixAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,6 @@ MatrixAdapter::MatrixAdapter(const std::vector<int> &iIndexes, const std::vector
data(dataValues) {
}


bool MatrixAdapter::CreatePhylipFile(const std::string &saveFileLocation) {
// if(saveFileLocation.empty())
// return false;
// const auto matrix = DistanceMatrixToSquareMatrix();
// int count = 0;
// const size_t size = matrixNames.size();
// std::string distanceString = "\t" + std::to_string(size) + "\n";
// for (const auto &cells: matrix) {
// distanceString += matrixNames[count];
// for (int i = 0; i < count; i++) {
// distanceString += "\t" + std::to_string(cells.rowValues[i]);
// }
// distanceString += "\n";
// count++;
// }
// std::ofstream writeOut(saveFileLocation);
// if (!writeOut.is_open()) {
// TestHelper::Print("Failed to open: \n");
// }
// writeOut << distanceString;
// writeOut.close();
return true;
}

bool MatrixAdapter::CreateColumnDataFile(const std::string &saveFileLocation) {
if(saveFileLocation.empty())
return false;
const auto matrix = CreateSparseMatrix();
std::string data;
for (size_t i = 0; i < matrix.seqVec.size(); i++) {
std::string firstCellName = matrixNames[i];
for(size_t j = 0; j < matrixNames[i].size(); j++) {
std::string otherCell = matrixNames[matrix.seqVec[i][j].index];
data += firstCellName + "\t" + otherCell + "\t" + std::to_string(matrix.seqVec[i][j].dist) + "\n";
}
}
std::ofstream writeOut(saveFileLocation);
if (!writeOut.is_open()) {
Rcpp::Rcout << "Failed to open: \n";
}
writeOut << data;
writeOut.close();
return true;
}

SparseDistanceMatrix MatrixAdapter::CreateSparseMatrix() {
// The indexes are +1, i need to push them back so that 1 -> 0, 2-> 1, etc (name map maybe?)
std::set<std::string> names;
Expand Down
7 changes: 0 additions & 7 deletions src/MatrixAdapterTestFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ bool MatrixAdapterTestFixture::TestCreateSparseMatrix(const size_t expectedResul
return result == expectedResult;
}

bool MatrixAdapterTestFixture::TestCreatePhylipFile(const bool expectedResult) {
Setup();
const auto result = matrixAdapter->CreatePhylipFile("");
TearDown();
return result == expectedResult;
}

bool MatrixAdapterTestFixture::TestGetListVector(const bool createSparseFirst, const bool expectedResult) {
Setup();
if(createSparseFirst) matrixAdapter->CreateSparseMatrix();
Expand Down
1 change: 0 additions & 1 deletion src/MothurDependencies/ColumnDistanceMatrixReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vector>
#include "ListVector.h"
#include "SparseDistanceMatrix.h"
#include "../RowData.h"
#include "../Adapters/CountTableAdapter.h"
#include "../Adapters/DistanceFileReader.h"

Expand Down
6 changes: 3 additions & 3 deletions src/MothurDependencies/OptiMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class OptiMatrix final : public OptiData{

public:
OptiMatrix(const std::vector<std::unordered_set<long long>>& close, const std::vector<std::string>& name,
const std::vector<std::string>& single, const double c): OptiData(c)
const std::vector<std::string>& singleton, const double c): OptiData(c)
{
closeness = close;
nameMap = name;
singletons = single;
singletons = singleton;
}//closeness, namemap, singleton, cutoff
~OptiMatrix(){}
~OptiMatrix() override = default;
std::vector<std::unordered_set<long long>> GetCloseness() {return closeness;}
std::vector<std::string> GetNameList() {return nameMap;}
std::vector<std::string> GetSingletons() {return singletons;}
Expand Down
31 changes: 0 additions & 31 deletions src/MothurDependencies/RSparseMatrix.h

This file was deleted.

1 change: 0 additions & 1 deletion src/MothurDependencies/ReadPhylipMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <fstream>
#include <string>
#include <vector>
#include "../RowData.h"
#include <unordered_set>
#include "ListVector.h"
#include "SparseDistanceMatrix.h"
Expand Down
1 change: 0 additions & 1 deletion src/MothurDependencies/SharedFileBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "ClusterExport.h"
#include "ListVector.h"
#include "RSparseMatrix.h"
#include "SharedFile.h"
#include "OtuAbundancePair.h"
#include "../Adapters/CountTableAdapter.h"
Expand Down
3 changes: 2 additions & 1 deletion src/MothurDependencies/SparseDistanceMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "PDistCell.h"

#include <vector>

#include <Rcpp.h>
#include "Utils.h"


Expand Down Expand Up @@ -44,6 +44,7 @@ class SparseDistanceMatrix {
int addCellSorted(unsigned long, PDistCell);
std::vector<std::vector<PDistCell> > seqVec;
bool print() const;
void FilterSparseMatrix(float cutoff);

private:
PDistCell smallCell; //The cell with the smallest distance
Expand Down
22 changes: 18 additions & 4 deletions src/OptiClusterTestFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,26 @@ bool OptiClusterTestFixture::OptiClusterGetsTheCorrectNumberOfBins(const long lo


void OptiClusterTestFixture::Setup() {
const auto xVals = std::vector<int>{0,0,0,1,1,2,3};
const auto yVals = std::vector<int>{1,2,4,2,4,4,4};
const auto data = std::vector<double>{0.02,0.04,0.025,0.01,0.028,0.045,0.05};
const auto xVals = std::vector<int>{0,0,0,1,1};
const auto yVals = std::vector<int>{1,2,4,2,4};
const auto data = std::vector<float>{0.02,0.04,0.025,0.01,0.028};
SparseDistanceMatrix sparse;
ListVector vec;
vec.push_back("0");
vec.push_back("1");
vec.push_back("2");
vec.push_back("3");
vec.push_back("4");
const size_t size = xVals.size();
sparse.resize(size);
for(size_t i = 0; i < size; i++) {
sparse.addCell(xVals[i], PDistCell(yVals[i], data[i]));
}
OptimatrixAdapter adapter(0.03);
OptiData *matrix = adapter.ConvertToOptimatrix(xVals, yVals, data);
OptiData *matrix = adapter.ConvertToOptimatrix(&sparse, &vec, false);
optiCluster = new OptiCluster(matrix, new MCC(), 0);;
double value = 0;
optiCluster->initialize(value, false, "");
}

void OptiClusterTestFixture::TearDown() {
Expand Down
Loading
Loading