Skip to content

Commit a736bd7

Browse files
committed
adjusted Makefile; more -v logging info per bundle
1 parent 2584c14 commit a736bd7

4 files changed

Lines changed: 76 additions & 65 deletions

File tree

Makefile

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ BAM := ./samtools-0.1.18
22
#path to the directory where the samtools package was built (in place)
33
#so libbam.a and *.h files MUST be in here
44

5-
GDIR :=./gclib
5+
GDIR :=./gclib
66

7-
INCDIRS := -I. -I${GDIR} -I${BAM}
7+
INCDIRS := -I. -I${GDIR} -I${BAM}
88

9-
CC := g++
9+
CC := g++
10+
11+
BASEFLAGS := -Wall -Wextra ${INCDIRS} -fsigned-char -D_FILE_OFFSET_BITS=64 \
12+
-D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-exceptions -fno-rtti
13+
14+
LINKER := g++
15+
16+
LDFLAGS := -g -L${BAM} $(LDFLAGS)
17+
18+
LIBS := -lbam -lz
1019

1120
ifneq (,$(findstring nothreads,$(MAKECMDGOALS)))
1221
NOTHREADS=1
@@ -17,37 +26,27 @@ ifneq (,$(findstring mingw,$(shell ${CC} -dumpmachine)))
1726
WINDOWS=1
1827
endif
1928

20-
LFLAGS =
2129
# MinGW32 GCC 4.5 link problem fix
2230
#ifdef WINDOWS
2331
ifneq (,$(findstring 4.5.,$(shell g++ -dumpversion)))
24-
LFLAGS += -static-libstdc++ -static-libgcc
32+
STATIC_CLIB=1
2533
endif
2634
#endif
2735

2836
# Misc. system commands
29-
#ifdef WINDOWS
30-
RM = del /Q
31-
#else
32-
RM = rm -f
33-
#endif
37+
ifdef WINDOWS
38+
RM = del /Q
39+
else
40+
RM = rm -f
41+
endif
3442

3543
# File endings
3644
ifdef WINDOWS
37-
EXE = .exe
45+
EXE = .exe
3846
else
39-
EXE =
47+
EXE =
4048
endif
4149

42-
BASEFLAGS := -Wall -Wextra ${INCDIRS} -fsigned-char -D_FILE_OFFSET_BITS=64 \
43-
-D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-exceptions -fno-rtti
44-
45-
# C/C++ linker
46-
47-
LINKER := g++
48-
49-
LIBS := -lbam -lz
50-
5150
# Non-windows systems need pthread
5251
ifndef WINDOWS
5352
ifndef NOTHREADS
@@ -59,19 +58,16 @@ ifdef NOTHREADS
5958
BASEFLAGS += -DNOTHREADS
6059
endif
6160

62-
###----- generic build rule
63-
6461
#ifneq (,$(findstring release,$(MAKECMDGOALS)))
62+
6563
ifneq (,$(filter %release %static, $(MAKECMDGOALS)))
6664
# -- release build
67-
CFLAGS := -O3 -DNDEBUG -g $(BASEFLAGS)
68-
LDFLAGS := -g -L${BAM} ${LFLAGS}
69-
ifneq (,$(findstring static,$(MAKECMDGOALS)))
70-
LDFLAGS += -static-libstdc++ -static-libgcc
71-
endif
65+
RELEASE_BUILD=1
66+
CFLAGS := -DNDEBUG -g $(BASEFLAGS) $(CFLAGS) -O3
7267
else
7368
ifneq (,$(filter %memcheck %memdebug, $(MAKECMDGOALS)))
74-
#make memcheck : use the statically linked address sanitizer in gcc 4.9.x
69+
#use sanitizer in gcc 4.9+
70+
MEMCHECK_BUILD=1
7571
GCCVER49 := $(shell expr `g++ -dumpversion | cut -f1,2 -d.` \>= 4.9)
7672
ifeq "$(GCCVER49)" "0"
7773
$(error gcc version 4.9 or greater is required for this build target)
@@ -84,35 +80,52 @@ else
8480
#CFLAGS += -fcheck-pointer-bounds -mmpx
8581
endif
8682
CFLAGS := -g -DDEBUG -D_DEBUG -DGDEBUG -fno-common -fstack-protector $(CFLAGS)
87-
LDFLAGS := -g -L${BAM}
8883
LIBS := -lasan -lubsan -ldl $(LIBS)
8984
else
90-
ifneq (,$(filter %memtrace %memusage %memuse, $(MAKECMDGOALS)))
91-
BASEFLAGS += -DGMEMTRACE
92-
GMEMTRACE=1
93-
endif
94-
#just plain debug build
95-
CFLAGS := -g -DDEBUG -D_DEBUG -DGDEBUG $(BASEFLAGS)
96-
LDFLAGS := -g -L${BAM}
85+
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
86+
#just plain debug build
87+
DEBUG_BUILD=1
88+
CFLAGS := -g -DDEBUG -D_DEBUG -DGDEBUG $(BASEFLAGS)
89+
endif
9790
endif
9891
endif
9992

100-
%.o : %.cpp
101-
${CC} ${CFLAGS} -c $< -o $@
93+
ifdef RELEASE_BUILD
94+
ifneq (,$(findstring static, $(MAKECMDGOALS)))
95+
STATIC_CLIB=1
96+
endif
97+
endif
98+
99+
ifdef STATIC_CLIB
100+
LDFLAGS += -static-libstdc++ -static-libgcc
101+
endif
102+
103+
ifdef DEBUG_BUILD
104+
$(warning Building DEBUG version [much slower], use 'make release' for a fast, optimized program.)
105+
DBG_WARN=@echo
106+
DBG_WARN+='WARNING: built DEBUG version [much slower], use "make release" for a fast, optimized program.'
107+
endif
108+
102109

103110
OBJS := ${GDIR}/GBase.o ${GDIR}/GArgs.o ${GDIR}/GStr.o ${GDIR}/GBam.o \
104111
${GDIR}/gdna.o ${GDIR}/codons.o ${GDIR}/GFaSeqGet.o ${GDIR}/gff.o
105112

106-
ifdef GMEMTRACE
107-
OBJS += ${GDIR}/proc_mem.o
113+
114+
ifneq (,$(filter %memtrace %memusage %memuse, $(MAKECMDGOALS)))
115+
CFLAGS += -DGMEMTRACE
116+
OBJS += ${GDIR}/proc_mem.o
108117
endif
109118

110119
ifndef NOTHREADS
111120
OBJS += ${GDIR}/GThreads.o
112121
endif
113122

123+
124+
%.o : %.cpp
125+
${CC} ${CFLAGS} -c $< -o $@
126+
114127
OBJS += rlink.o tablemaker.o tmerge.o
115-
128+
116129
all release static debug: stringtie${EXE}
117130
memcheck memdebug: stringtie${EXE}
118131
memuse memusage memtrace: stringtie${EXE}
@@ -127,6 +140,8 @@ ${BAM}/libbam.a:
127140
cd ${BAM} && make lib
128141
stringtie: ${BAM}/libbam.a $(OBJS) stringtie.o
129142
${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LIBS}
143+
@echo
144+
${DBG_WARN}
130145

131146
.PHONY : clean cleanall cleanAll allclean
132147

rlink.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ void processRead(int currentstart, int currentend, BundleData& bdata,
196196
int hi=alndata.hi;
197197
int readstart=brec.start;
198198
CReadAln* readaln=NULL; // readaln is initialized with NULL
199-
//bool covSaturated=false; // coverage is set to not saturated
200199

201200
bool match=false; // true if current read matches a previous read
202201
int n=readlist.Count()-1;
@@ -217,7 +216,7 @@ void processRead(int currentstart, int currentend, BundleData& bdata,
217216
bdata.start=currentstart;
218217
bdata.end=currentend;
219218
}
220-
bdata.numreads++; // number of reads gets increased no matter what
219+
bdata.numreads++; // number of reads (alignments) actually considered
221220
//bdata.wnumreads+=float(1)/nh;
222221

223222
if (!match) { // if this is a new read I am seeing I need to set it up

rlink.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ struct BundleData {
473473
int start;
474474
int end;
475475
//bool covSaturated;
476-
unsigned long numreads; // number of reads in bundles
476+
unsigned long numreads; // number of read alignments found in this bundle
477477
/*
478478
float wnumreads; // NEW: weighted numreads; a multi-mapped read mapped in 2 places will contribute only 0.5
479479
double sumreads; // sum of all reads' lengths in bundle
@@ -491,14 +491,13 @@ struct BundleData {
491491

492492
GStr refseq;
493493
GList<CReadAln> readlist;
494-
GVec<float> bpcov[3]; // this needs to be changed to a more inteligent way of storing the data
494+
GVec<float> bpcov[3];
495495
GList<CJunction> junction;
496496
GPVec<GffObj> keepguides;
497497
GPVec<CTCov> covguides;
498498
GList<CPrediction> pred;
499499
RC_BundleData* rc_data;
500500
BundleData():status(BUNDLE_STATUS_CLEAR), idx(0), start(0), end(0),
501-
//covSaturated(false),
502501
numreads(0),
503502
num_fragments(0), frag_len(0),sum_cov(0),covflags(0),
504503
refseq(), readlist(false,true), //bpcov(1024),
@@ -553,7 +552,6 @@ struct BundleData {
553552
start=0;
554553
end=0;
555554
status=BUNDLE_STATUS_CLEAR;
556-
//covSaturated=false;
557555
numreads=0;
558556
num_fragments=0;
559557
frag_len=0;
@@ -570,7 +568,6 @@ struct BundleData {
570568

571569
void processRead(int currentstart, int currentend, BundleData& bdata,
572570
GHash<int>& hashread, GReadAlnData& alndata);
573-
//GBamRecord& brec, char strand, int nh, int hi);
574571

575572
void countFragment(BundleData& bdata, GBamRecord& brec, int hi,int nh);
576573

stringtie.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "proc_mem.h"
1212
#endif
1313

14-
#define VERSION "1.3.4c"
14+
#define VERSION "1.3.4d"
1515

1616
//#define DEBUGPRINT 1
1717

@@ -1197,22 +1197,22 @@ void noMoreBundles() {
11971197
void processBundle(BundleData* bundle) {
11981198
if (verbose) {
11991199
#ifndef NOTHREADS
1200-
GLockGuard<GFastMutex> lock(logMutex);
1200+
GLockGuard<GFastMutex> lock(logMutex);
12011201
#endif
12021202
printTime(stderr);
1203-
GMessage(">bundle %s:%d-%d(%lu) (%d guides) loaded, begins processing...\n",
1204-
bundle->refseq.chars(), bundle->start, bundle->end, bundle->numreads,
1203+
GMessage(">bundle %s:%d-%d [%lu alignments (%d distinct), %d junctions, %d guides] begins processing...\n",
1204+
bundle->refseq.chars(), bundle->start, bundle->end, bundle->numreads, bundle->readlist.Count(), bundle->junction.Count(),
12051205
bundle->keepguides.Count());
1206-
#ifdef GMEMTRACE
1207-
double vm,rsm;
1208-
get_mem_usage(vm, rsm);
1209-
GMessage("\t\tstart memory usage: %6.1fMB\n",rsm/1024);
1210-
if (rsm>maxMemRS) {
1211-
maxMemRS=rsm;
1212-
maxMemVM=vm;
1213-
maxMemBundle.format("%s:%d-%d(%d)", bundle->refseq.chars(), bundle->start, bundle->end, bundle->readlist.Count());
1214-
}
1215-
#endif
1206+
#ifdef GMEMTRACE
1207+
double vm,rsm;
1208+
get_mem_usage(vm, rsm);
1209+
GMessage("\t\tstart memory usage: %6.1fMB\n",rsm/1024);
1210+
if (rsm>maxMemRS) {
1211+
maxMemRS=rsm;
1212+
maxMemVM=vm;
1213+
maxMemBundle.format("%s:%d-%d(%d)", bundle->refseq.chars(), bundle->start, bundle->end, bundle->readlist.Count());
1214+
}
1215+
#endif
12161216
}
12171217
#ifdef B_DEBUG
12181218
for (int i=0;i<bundle->keepguides.Count();++i) {
@@ -1278,8 +1278,8 @@ void processBundle(BundleData* bundle) {
12781278
fprintf(stderr,"Number of fragments in bundle: %g with sum %g\n",bundle->num_fragments,bundle->frag_len);
12791279
*/
12801280
printTime(stderr);
1281-
GMessage("^bundle %s:%d-%d(%d) done (%d processed potential transcripts).\n",bundle->refseq.chars(),
1282-
bundle->start, bundle->end, bundle->readlist.Count(), bundle->pred.Count());
1281+
GMessage("^bundle %s:%d-%d done (%d processed potential transcripts).\n",bundle->refseq.chars(),
1282+
bundle->start, bundle->end, bundle->pred.Count());
12831283
#ifdef GMEMTRACE
12841284
double vm,rsm;
12851285
get_mem_usage(vm, rsm);

0 commit comments

Comments
 (0)