Skip to content

Fix build and some bugs #9

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin
src/cluster/bin
src/cluster/meshclust
9 changes: 6 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# CXX = /usr/bin/c++
CXX ?= g++
ifeq ($(shell uname), Darwin)
CXX = xcrun -sdk macosx clang++
else
CXX ?= g++
endif

CXXFLAGS = -O3 -g -fmessage-length=0 -Wall -march=native -std=c++11
CXXFLAGS = -std=c++11 -pedantic -Wall -Wno-overloaded-virtual -O3 -flto -march=native

#
# Objects
Expand Down
16 changes: 11 additions & 5 deletions src/cluster/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
TARGET ?= meshclust
VERSION ?= 1.2.0
CXX ?= g++

ifeq ($(shell uname), Darwin)
CXX = xcrun -sdk macosx clang++
else
CXX ?= g++
endif

ifeq ($(debug),yes)
CXXFLAGS += -ggdb -fopenmp
CXXFLAGS += -ggdb
else
CXXFLAGS += -fopenmp -O3 -march=native -g
CXXFLAGS += -O3 -flto -march=native -DNDEBUG=1
endif
CXXFLAGS += -std=c++11 -DVERSION=\"$(VERSION)\"
LDFLAGS += -lm
CXXFLAGS += -std=c++11 -pedantic -Wall -Wno-overloaded-virtual -Wno-unused-variable -DVERSION=\"$(VERSION)\"
LDFLAGS += -flto -lm

SOURCES := $(shell find ./src -name '*.cpp')
OBJECTS = $(SOURCES:%.cpp=bin/%.o)
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/src/ClusterFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
template<class T>
class ClusterFactory {
public:
ClusterFactory(int k_len, int npp=std::numeric_limits<int>::max()) : k(k_len), num_per_partition(npp) {}
ClusterFactory(int k_len, int npp=std::numeric_limits<int>::max()) : num_per_partition(npp), k(k_len) {}
std::vector<Point<T>*> build_points(vector<string> files, std::function<Point<T>*(ChromosomeOneDigit*)> get_point);
Point<T>* get_histogram(ChromosomeOneDigit *chrom);
Point<T>* get_divergence_point(ChromosomeOneDigit *chrom);
Expand Down
32 changes: 1 addition & 31 deletions src/cluster/src/Runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,21 +321,13 @@ void test()
template<class T>
int Runner::do_run()
{
using pvec = vector<Point<T> *>;
using pmap = map<Point<T>*, pvec*>;

ClusterFactory<T> factory(k);
// for (auto f : files) {
// cout << "File: " << f << endl;
// }

auto points = factory.build_points(files, [&](nonltr::ChromosomeOneDigit *p){ return factory.get_divergence_point(p); });
Trainer<T> tr(points, sample_size, largest_count, similarity, pivots, global_mat, global_sigma, global_epsilon, align ? 0 : k);
tr.train();
vector<uint64_t> lengths;
for (Point<T>* p : points) {
// if (!align) {
// p->set_data_str("");
// }
lengths.push_back(p->get_length());
}
// Initializing BVec
Expand All @@ -348,28 +340,6 @@ int Runner::do_run()
bv.insert(p);
}
bv.insert_finalize();
// cout << "bv size: " << bv.report() << endl;
// Point<T>* mid = points[points.size()/2];
// auto rng = bv.get_range(mid->get_length() * 0.99,
// mid->get_length() / 0.99);
// auto begin = bv.iter(rng.first);
// auto end = bv.iter(rng.second);
// size_t before = bv.report();
// for (int i = 0; i < 1; i++) {
// bool is_min = false;
// Point<T>* p = tr.get_close(mid, begin, end, is_min);
// size_t after = bv.report();
// if (is_min) {
// string expr = (after + 1 == before) ? "true" : "false";
// if (expr == "false") {
// throw expr;
// }
// cout << expr << endl;
// cout << "is min" << endl;
// } else {
// cout << "is not min" << endl;
// }
// }
factory.MS(bv, bandwidth, similarity, tr, output, iterations, delta);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/cluster/src/SingleFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ template<class T>
class SingleFeature {
public:
SingleFeature(std::function<double(Point<T>*, Point<T>*)> f, bool is_sim_=true)
: raw(f), is_sim(is_sim_), min_set(false), max_set(false) {}
: raw(f), is_sim(is_sim_), max_set(false), min_set(false) {}
SingleFeature(std::function<double(Point<T>*, Point<T>*, const vector<int>&, const vector<int>&)> f, vector<int> rrv, vector<int> rrc, bool is_sim_=true)
: rraw(f), is_sim(is_sim_), min_set(false), max_set(false), rv(rrv), rc(rrc) {}
: rraw(f), rv(rrv), rc(rrc), is_sim(is_sim_), max_set(false), min_set(false) {}
void normalize(const vector<pair<Point<T>*,Point<T>*> > &pairs);
double operator()(Point<T>*, Point<T>*) const;
double min, max;
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/src/Trainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
template<class T>
class Trainer {
public:
Trainer(std::vector<Point<T>*> v, size_t num_points, int largest_count, double cutoff_, size_t max_pts_from_one_, double (&matrix)[4][4], double sig, double eps, int ksize) : points(v), n_points(num_points), cutoff(cutoff_), max_pts_from_one(max_pts_from_one_), k(ksize) {
Trainer(std::vector<Point<T>*> v, size_t num_points, int largest_count, double cutoff_, size_t max_pts_from_one_, double (&matrix)[4][4], double sig, double eps, int ksize) : points(v), n_points(num_points), max_pts_from_one(max_pts_from_one_), cutoff(cutoff_), k(ksize) {
init(matrix, sig, eps);
uintmax_t size = 1000 * 1000 * 10;
log_table = new double[size];
Expand Down
2 changes: 1 addition & 1 deletion src/nonltr/EnrichmentMarkovView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace nonltr {
*/
template<class I, class V>
EnrichmentMarkovView<I, V>::EnrichmentMarkovView(int k, int order, int m) :
minObs(m), factor(10000.00), KmerHashTable<I, V>(k) {
KmerHashTable<I, V>(k), minObs(m), factor(10000.00) {
initialize(order);
}

Expand Down
10 changes: 1 addition & 9 deletions src/utility/AffineId.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,14 @@ class AffineId {

int len1;
int len2;
//int lenTotal;
int lenCS;
int lenPath;
int * m; // Middle level
//int * l; // Lower level
int * u; // Upper level

// const int MATCH = 4; // Score of a match
// const int MIS = -4; // Score of a mismatch
// const int OPEN = -2; // Score of a gap opening
// const int EXT = -1; // Score of a gap extension

const int MATCH = 1;
const int MIS = -1;
const int OPEN = -2;
const int EXT = -1;

void align();

public:
Expand Down
1 change: 1 addition & 0 deletions src/utility/ILocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace utility {

class ILocation {
public:
inline virtual ~ILocation() {}
virtual int getEnd() const = 0;
virtual int getStart() const = 0;
virtual void setEnd(int) = 0;
Expand Down