Skip to content

Commit

Permalink
Update to namespace-aware meryl-utility.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Sep 28, 2022
1 parent d88ea50 commit 7f5cd3d
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 100 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ endef
# USE WITH EVAL
#
define ADD_OBJECT_RULE
${1}/%.o: ${2} utility/src/utility/version.H
${1}/%.o: ${2} utility/src/version.H
${3}
endef

Expand Down Expand Up @@ -688,7 +688,7 @@ $(foreach TGT,${ALL_TGTS},\
# Makefile processed. Regenerate the version number file, make some
# directories, and report that we're starting the build.
$(eval $(shell ../scripts/version_update.pl meryl utility/src/utility/version.H))
$(eval $(shell ../scripts/version_update.pl meryl utility/src/version.H))
$(shell mkdir -p ${TARGET_DIR}/bin)
Expand Down
90 changes: 58 additions & 32 deletions src/main.mk
Original file line number Diff line number Diff line change
@@ -1,43 +1,69 @@
MODULE := meryl
TARGET := libmeryl.a
SOURCES := utility/src/utility/edlib.C \
SOURCES := utility/src/align/align-ksw2-driver.C \
utility/src/align/align-ksw2-extz.C \
utility/src/align/align-ksw2-extz2-sse.C \
utility/src/align/align-parasail-driver.C \
utility/src/align/align-ssw-driver.C \
utility/src/align/align-ssw.C \
utility/src/align/edlib.C \
\
utility/src/utility/files.C \
utility/src/utility/files-buffered.C \
utility/src/utility/files-compressed.C \
utility/src/utility/files-fasta-fastq.C \
utility/src/utility/files-memoryMapped.C \
utility/src/bits/fibonacci-v1.C \
utility/src/bits/hexDump-v1.C \
utility/src/bits/stuffedBits-v1-binary.C \
utility/src/bits/stuffedBits-v1-bits.C \
utility/src/bits/stuffedBits-v1-delta.C \
utility/src/bits/stuffedBits-v1-gamma.C \
utility/src/bits/stuffedBits-v1-golomb.C \
utility/src/bits/stuffedBits-v1-omega.C \
utility/src/bits/stuffedBits-v1-unary.C \
utility/src/bits/stuffedBits-v1-zeckendorf.C \
utility/src/bits/stuffedBits-v1.C \
utility/src/bits/wordArray-v1.C \
\
utility/src/utility/logging.C \
utility/src/datastructures/keyAndValue-v1.C \
utility/src/datastructures/splitToWords-v1.C \
utility/src/datastructures/stringList-v1.C \
utility/src/datastructures/strings-v1.C \
utility/src/datastructures/types-v1.C \
\
utility/src/utility/strings.C \
utility/src/files/accessing-v1.C \
utility/src/files/buffered-v1-reading.C \
utility/src/files/buffered-v1-writing.C \
utility/src/files/compressed-v1-reading.C \
utility/src/files/compressed-v1-writing.C \
utility/src/files/compressed-v1.C \
utility/src/files/fasta-fastq-v1.C \
utility/src/files/files-v1.C \
utility/src/files/memoryMapped-v1.C \
utility/src/files/readLine-v0.C \
utility/src/files/readLine-v1.C \
utility/src/files/reading-v1.C \
utility/src/files/writing-v1.C \
\
utility/src/utility/system.C \
utility/src/utility/system-stackTrace.C \
utility/src/kmers-v1/kmers-exact.C \
utility/src/kmers-v1/kmers-files.C \
utility/src/kmers-v1/kmers-histogram.C \
utility/src/kmers-v1/kmers-reader.C \
utility/src/kmers-v1/kmers-writer-block.C \
utility/src/kmers-v1/kmers-writer-stream.C \
utility/src/kmers-v1/kmers-writer.C \
utility/src/kmers-v1/kmers.C \
\
utility/src/utility/sequence.C \
utility/src/math/md5-v1.C \
utility/src/math/mt19937ar-v1.C \
utility/src/math/sampledDistribution-v1.C \
\
utility/src/utility/types.C \
utility/src/sequence/dnaSeq-v1.C \
utility/src/sequence/dnaSeqFile-v1.C \
utility/src/sequence/sequence-v1.C \
\
utility/src/utility/kmers-exact.C \
utility/src/utility/kmers-files.C \
utility/src/utility/kmers-histogram.C \
utility/src/utility/kmers-reader.C \
utility/src/utility/kmers-writer-block.C \
utility/src/utility/kmers-writer-stream.C \
utility/src/utility/kmers-writer.C \
utility/src/utility/kmers.C \
\
utility/src/utility/bits.C \
utility/src/utility/bits-wordArray.C \
\
utility/src/utility/hexDump.C \
utility/src/utility/md5.C \
utility/src/utility/mt19937ar.C \
utility/src/utility/speedCounter.C \
utility/src/utility/sweatShop.C \
\
utility/src/utility/runtime.C
utility/src/system/logging-v1.C \
utility/src/system/runtime-v1.C \
utility/src/system/speedCounter-v1.C \
utility/src/system/sweatShop-v1.C \
utility/src/system/system-stackTrace-v1.C \
utility/src/system/system-v1.C

ifeq (${BUILDSTACKTRACE}, 1)
SOURCES += utility/src/utility/libbacktrace/atomic.c \
Expand All @@ -57,7 +83,7 @@ endif

SRC_INCDIRS := . \
meryl \
utility
utility/src

SUBMAKEFILES := meryl/meryl.mk \
meryl-analyze/meryl-analyze.mk \
Expand Down
6 changes: 3 additions & 3 deletions src/meryl-analyze/meryl-analyze.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* contains full conditions and disclaimers.
*/

#include "runtime.H"

#include "kmers.H"
#include "sequence.H"
#include "bits.H"

using namespace merylutil;

#define OP_NONE 0
#define OP_GA 1
#define OP_GC 2
Expand Down Expand Up @@ -136,7 +136,7 @@ private:

void
printHist(char* outName, sparseHistogram<uint64,uint32> hist[]) {
FILE *F = AS_UTL_openOutputFile(outName);
FILE *F = merylutil::openOutputFile(outName);

for (uint32 ll=0; ll<=kmer::merSize(); ll++) {
if (hist[ll].minValue() <= hist[ll].maxValue()) {
Expand Down
4 changes: 2 additions & 2 deletions src/meryl-analyze/meryl-analyze.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET := meryl-analyze
SOURCES := meryl-analyze.C \
SOURCES := meryl-analyze.C

SRC_INCDIRS := . ../utility/src/utility
SRC_INCDIRS := . ../utility/src

TGT_LDFLAGS := -L${TARGET_DIR}/lib
TGT_LDLIBS := -l${MODULE}
Expand Down
7 changes: 3 additions & 4 deletions src/meryl-import/meryl-import.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
* contains full conditions and disclaimers.
*/

#include "runtime.H"

#include "kmers.H"
#include "sequence.H"
#include "strings.H"
#include "bits.H"

#include "merylCountArray.H"

using namespace merylutil;

int
main(int argc, char **argv) {
Expand Down Expand Up @@ -148,7 +147,7 @@ main(int argc, char **argv) {

// Open the input kmer file, allocate space for reading kmer lines.

FILE *K = AS_UTL_openInputFile(inputName);
FILE *K = merylutil::openInputFile(inputName);
uint32 Llen = 0;
uint32 Lmax = 1023;
char *L = new char [Lmax + 1];
Expand All @@ -174,7 +173,7 @@ main(int argc, char **argv) {

uint64 persistentValue = 1;

while (AS_UTL_readLine(L, Llen, Lmax, K) == true) {
while (merylutil::readLine(L, Llen, Lmax, K) == true) {
W.split(L);

if (W.numWords() == 0)
Expand Down
6 changes: 3 additions & 3 deletions src/meryl-import/meryl-import.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ SRC_INCDIRS := . ../meryl
# meryl-utility. Otherwise, don't.
ifneq ($(wildcard stores/sqStore.H), )
SRC_CXXFLAGS := -DCANU
SRC_INCDIRS += ../../../utility/src/utility ../../../stores
SRC_INCDIRS += ../../../utility/src ../../../stores

# If we're part of something else, include the something else's
# utility directory.
else ifneq ($(wildcard meryl/src/meryl/meryl.C), )
SRC_INCDIRS += ../../../utility/src/utility
SRC_INCDIRS += ../../../utility/src

# Otherwise, we're building directly in the meryl repo.
else
SRC_INCDIRS += ../utility/src/utility
SRC_INCDIRS += ../utility/src

endif

Expand Down
3 changes: 2 additions & 1 deletion src/meryl-lookup/dump.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
*/

#include "meryl-lookup.H"
#include "sweatShop.H"

#include "system.H"


class dumpInput {
Expand Down
3 changes: 2 additions & 1 deletion src/meryl-lookup/existence.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
*/

#include "meryl-lookup.H"
#include "sweatShop.H"

#include "system.H"



Expand Down
3 changes: 2 additions & 1 deletion src/meryl-lookup/include-exclude.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
*/

#include "meryl-lookup.H"
#include "sweatShop.H"

#include "system.H"



Expand Down
5 changes: 2 additions & 3 deletions src/meryl-lookup/meryl-lookup.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
* contains full conditions and disclaimers.
*/

#include "runtime.H"

#include "sequence.H"
#include "kmers.H"
#include "sequence.H"

using namespace merylutil;

enum class lookupOp {
opNone,
Expand Down
6 changes: 3 additions & 3 deletions src/meryl-lookup/meryl-lookup.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ SRC_INCDIRS := .
# meryl-utility. Otherwise, don't.
ifneq ($(wildcard stores/sqStore.H), )
SRC_CXXFLAGS := -DCANU
SRC_INCDIRS += ../../../utility/src/utility ../../../stores
SRC_INCDIRS += ../../../utility/src ../../../stores

# If we're part of something else, include the something else's
# utility directory.
else ifneq ($(wildcard meryl/src/meryl/meryl.C), )
SRC_INCDIRS += ../../../utility/src/utility
SRC_INCDIRS += ../../../utility/src

# Otherwise, we're building directly in the meryl repo.
else
SRC_INCDIRS += ../utility/src/utility
SRC_INCDIRS += ../utility/src

endif

Expand Down
6 changes: 4 additions & 2 deletions src/meryl-lookup/position-lookup.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
* contains full conditions and disclaimers.
*/

#include "meryl-lookup.H"
#include <algorithm>

#include "sweatShop.H"
#include "meryl-lookup.H"
#include "system.H"

using namespace merylutil;

class hit_s {
public:
Expand Down
6 changes: 3 additions & 3 deletions src/meryl-lookup/position-lookup.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ SRC_INCDIRS := .
# meryl-utility. Otherwise, don't.
ifneq ($(wildcard stores/sqStore.H), )
SRC_CXXFLAGS := -DCANU
SRC_INCDIRS += ../../../utility/src/utility ../../../stores
SRC_INCDIRS += ../../../utility/src ../../../stores

# If we're part of something else, include the something else's
# utility directory.
else ifneq ($(wildcard meryl/src/meryl/meryl.C), )
SRC_INCDIRS += ../../../utility/src/utility
SRC_INCDIRS += ../../../utility/src

# Otherwise, we're building directly in the meryl repo.
else
SRC_INCDIRS += ../utility/src/utility
SRC_INCDIRS += ../utility/src

endif

Expand Down
19 changes: 9 additions & 10 deletions src/meryl-simple/meryl-simple.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
* contains full conditions and disclaimers.
*/

#include "runtime.H"
#include "sequence.H"
#include "kmers.H"
//#include "strings.H"
//#include "system.H"
#include <algorithm>

#include "kmers.H"
#include "sequence.H"

using namespace merylutil;

int
main(int argc, char **argv) {
Expand Down Expand Up @@ -166,8 +165,8 @@ main(int argc, char **argv) {
for (uint32 ii=0; ii<histMax; ii++)
hist[ii] = 0;

//LE *M = AS_UTL_openOutputFile(mOutput);
FILE *D = AS_UTL_openOutputFile(dOutput);
//LE *M = merylutil::openOutputFile(mOutput);
FILE *D = merylutil::openOutputFile(dOutput);

fprintf(stderr, "-- Output.\n");

Expand All @@ -194,17 +193,17 @@ main(int argc, char **argv) {
jj = jj + 1;
}

AS_UTL_closeFile(D);
merylutil::closeFile(D);


if (hOutput) {
FILE *H = AS_UTL_openOutputFile(hOutput);
FILE *H = merylutil::openOutputFile(hOutput);

for (uint32 ii=0; ii<=histLen; ii++)
if (hist[ii] > 0)
fprintf(H, "%u\t%u\n", ii, hist[ii]);

AS_UTL_closeFile(H);
merylutil::closeFile(H);
}

// Cleanup.
Expand Down
6 changes: 3 additions & 3 deletions src/meryl-simple/meryl-simple.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ SRC_INCDIRS := .
# meryl-utility. Otherwise, don't.
ifneq ($(wildcard stores/sqStore.H), )
SRC_CXXFLAGS := -DCANU
SRC_INCDIRS := ../../../utility/src/utility ../../../stores
SRC_INCDIRS := ../../../utility/src ../../../stores

# If we're part of something else, include the something else's
# utility directory.
else ifneq ($(wildcard meryl/src/meryl/meryl.C), )
SRC_INCDIRS := ../../../utility/src/utility
SRC_INCDIRS := ../../../utility/src

# Otherwise, we're building directly in the meryl repo.
else
SRC_INCDIRS := ../utility/src/utility
SRC_INCDIRS := ../utility/src

endif

Expand Down
6 changes: 1 addition & 5 deletions src/meryl/meryl.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

#include "meryl.H"

#include "runtime.H"
#include "strings.H"
#include "system.H"


using namespace merylutil;

int
main(int argc, char **argv) {
Expand Down
Loading

0 comments on commit 7f5cd3d

Please sign in to comment.