aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--sparse.c62
-rw-r--r--sparse.h17
3 files changed, 9 insertions, 90 deletions
diff --git a/Makefile b/Makefile
index 61bde0e..bc90a64 100644
--- a/Makefile
+++ b/Makefile
@@ -4,21 +4,19 @@ CFLAGS = -O3 -s -mtune=native -Wall -Wextra -DVERSION=$(VERSION) -std=c++11
DESTDIR = /usr/local/
-all: libkmer.o libkmer.so kmer_total_count kmer_counts_per_sequence
+all: kmer_utils.o libkmer.so kmer_total_count kmer_counts_per_sequence
-sparse.o: sparse.c
- $(CC) -c sparse.c -o sparse.o $(CFLAGS)
-libkmer.o: kmer_utils.c
- $(CC) -c kmer_utils.c -o libkmer.o $(CFLAGS) -fPIC
-libkmer.so: libkmer.o
+kmer_utils.o: kmer_utils.c
+ $(CC) -c kmer_utils.c -o kmer_utils.o $(CFLAGS) -fPIC
+libkmer.so: kmer_utils.o
$(CC) kmer_utils.c -o libkmer.so $(CFLAGS) -shared -fPIC
-kmer_total_count: kmer_utils.c kmer_total_count.c kmer_utils.h
- $(CC) kmer_utils.c kmer_total_count.c -o kmer_total_count $(CLIBS) $(CFLAGS)
-kmer_counts_per_sequence: libkmer.o kmer_counts_per_sequence.c kmer_utils.h
- $(CC) libkmer.o kmer_counts_per_sequence.c -o kmer_counts_per_sequence $(CLIBS) $(CFLAGS)
+kmer_total_count: kmer_utils.o kmer_total_count.c kmer_utils.h
+ $(CC) kmer_utils.o kmer_total_count.c -o kmer_total_count $(CLIBS) $(CFLAGS)
+kmer_counts_per_sequence: kmer_utils.o kmer_counts_per_sequence.c kmer_utils.h
+ $(CC) kmer_utils.o kmer_counts_per_sequence.c -o kmer_counts_per_sequence $(CLIBS) $(CFLAGS)
clean:
- rm -vf kmer_total_count kmer_counts_per_sequence libkmer.so libkmer.o
+ rm -vf kmer_total_count kmer_counts_per_sequence kmer_utils.o libkmer.so
debug: CFLAGS = -ggdb -Wall -Wextra -DVERSION=$(VERSION)\"-debug\"
debug: all
diff --git a/sparse.c b/sparse.c
deleted file mode 100644
index 30ce2b1..0000000
--- a/sparse.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-
-struct bin_tree {
- size_t index;
- unsigned long long value;
- struct bin_tree *right;
- struct bin_tree *left;
-};
-
-typedef struct bin_tree node;
-
-void insert(node ** tree, size_t index) {
- node *temp = NULL;
- if(!(*tree)) {
- temp = (node *)malloc(sizeof(node));
- temp->left = temp->right = NULL;
- temp->index = index;
- temp->value = 1;
- *tree = temp;
- return;
- }
-
- if(index < (*tree)->index)
- insert(&(*tree)->left, index);
- else if(index > (*tree)->index)
- insert(&(*tree)->right, index);
-
-}
-
-void deltree(node * tree) {
- if (tree) {
- deltree(tree->left);
- deltree(tree->right);
- free(tree);
- }
-}
-
-node* search(node ** tree, size_t index) {
- if(!(*tree))
- return NULL;
-
- if(index < (*tree)->index)
- search(&((*tree)->left), index);
-
- else if(index > (*tree)->index)
- search(&((*tree)->right), index);
-
- else if(index == (*tree)->index)
- return *tree;
-}
-
-unsigned long long *lookup(node **tree, size_t index) {
- node *ret = search(tree, index);
- if(ret)
- return ret->value;
- else
- return 0;
-}
diff --git a/sparse.h b/sparse.h
deleted file mode 100644
index 2ffbabd..0000000
--- a/sparse.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdbool.h>
-
-struct b_tree {
- size_t index;
- unsigned long long value;
- struct b_tree *right;
- struct b_tree *left;
-};
-
-typedef struct b_tree node;
-
-node* search(node **tree, size_t index);
-void insert(node **tree, size_t index);
-void deltree(node *tree);
-unsigned long long lookup(node **tree, size_t index);
-
-void print_sparse(node *tree, bool label, bool nonzero, unsigned int kmer);