Skip to content

Commit da3fdbc

Browse files
committed
added libbz2 build; merged mix-merge childonpath fix
1 parent 5b79f6f commit da3fdbc

3 files changed

Lines changed: 61 additions & 21 deletions

File tree

Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
HTSLIB := ./htslib
33
#--
44
LIBDEFLATE := ${HTSLIB}/xlibs/lib/libdeflate.a
5+
LIBBZ2 := ${HTSLIB}/xlibs/lib/libbz2.a
56
LIBLZMA := ${HTSLIB}/xlibs/lib/liblzma.a
67

78
GDIR := ./gclib
@@ -30,7 +31,7 @@ LDFLAGS := $(if $(LDFLAGS),$(LDFLAGS),-g)
3031

3132
# LDFLAGS += -L${BAM}
3233

33-
LIBS := ${HTSLIB}/libhts.a ${LIBLZMA} ${LIBDEFLATE} -lbz2 -lz -lm
34+
LIBS := ${HTSLIB}/libhts.a ${LIBBZ2} ${LIBLZMA} ${LIBDEFLATE} -lz -lm
3435

3536
ifneq (,$(filter %nothreads %prof %profile, $(MAKECMDGOALS)))
3637
NOTHREADS=1
@@ -74,7 +75,7 @@ endif
7475

7576
DMACH := $(shell ${CXX} -dumpmachine)
7677

77-
ifneq (,$(filter %release %static, $(MAKECMDGOALS)))
78+
ifneq (,$(filter %release %static %static-cpp, $(MAKECMDGOALS)))
7879
# -- release build
7980
RELEASE_BUILD=1
8081
CXXFLAGS := $(if $(CXXFLAGS),$(CXXFLAGS),-g -O3)
@@ -122,15 +123,18 @@ else
122123
endif
123124

124125
ifdef RELEASE_BUILD
125-
ifneq (,$(findstring static, $(MAKECMDGOALS)))
126-
STATIC_CLIB=1
126+
ifneq ($(findstring static,$(MAKECMDGOALS)),)
127+
# static or static-cpp found
128+
ifneq ($(findstring static-cpp,$(MAKECMDGOALS)),)
129+
#not a full static build, only c/c++ libs
130+
LDFLAGS := -static-libgcc -static-libstdc++ ${LDFLAGS}
131+
else
132+
#full static build
133+
LDFLAGS := -static -static-libgcc -static-libstdc++ ${LDFLAGS}
134+
endif
127135
endif
128136
endif
129137

130-
ifdef STATIC_CLIB
131-
LDFLAGS += -static-libgcc -static-libstdc++
132-
endif
133-
134138
ifdef DEBUG_BUILD
135139
#$(warning Building DEBUG version of stringtie.. )
136140
DBG_WARN=@echo
@@ -154,7 +158,7 @@ endif
154158

155159
OBJS += rlink.o tablemaker.o tmerge.o
156160

157-
all release static debug: stringtie${EXE}
161+
all release static static-cpp debug: stringtie${EXE}
158162
memcheck memdebug tsan tcheck thrcheck: stringtie${EXE}
159163
memuse memusage memtrace: stringtie${EXE}
160164
prof profile: stringtie${EXE}

htslib/build_lib.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ if [[ "$1" == "clean" ]]; then
55
make clean
66
/bin/rm -f config.h
77
/bin/rm -rf xlibs
8-
/bin/rm -rf lzma
9-
/bin/rm -rf libdeflate
8+
/bin/rm -rf lzma bzip2 libdeflate
109
/bin/rm -f *.tar.gz
1110
exit
1211
fi
@@ -20,9 +19,11 @@ mkdir -p $libdir
2019

2120
# -- prepare libdeflate
2221
if [[ ! -d libdeflate ]]; then
23-
git clone https://github.com/ebiggers/libdeflate
22+
git clone https://github.com/ebiggers/libdeflate
23+
cd libdeflate
24+
git checkout '9b565afd996d8b798fc7b94cddcc7cfa49293050'
25+
cd ..
2426
fi
25-
2627
if [[ ! -f $libdir/libdeflate.a ]]; then
2728
cd libdeflate
2829
MINGW=''
@@ -36,11 +37,30 @@ if [[ ! -f $libdir/libdeflate.a ]]; then
3637
cp libdeflate.h $incdir/
3738
cd ..
3839
fi
40+
41+
42+
bzip="bzip2-1.0.8"
43+
if [[ ! -d bzip2 ]]; then
44+
curl -sLO https://sourceware.org/pub/bzip2/$bzip.tar.gz
45+
tar -xzf $bzip.tar.gz
46+
/bin/rm -f $bzip.tar.gz
47+
mv $bzip bzip2
48+
fi
49+
if [[ ! -f $libdir/libbz2.a ]]; then
50+
cd bzip2
51+
make -j 4 libbz2.a
52+
cp bzlib.h $incdir/
53+
cp libbz2.a $libdir/
54+
cd ..
55+
fi
56+
3957
# -- prepare liblzma
40-
xz=xz-5.2.5
58+
xz="xz-5.2.5"
59+
4160
if [[ ! -d lzma ]]; then
4261
curl -sLO https://tukaani.org/xz/$xz.tar.gz
4362
tar -xzf $xz.tar.gz
63+
/bin/rm -f $xz.tar.gz
4464
mv $xz lzma
4565
fi
4666
if [[ ! -f $libdir/liblzma.a ]]; then
@@ -51,5 +71,5 @@ if [[ ! -f $libdir/liblzma.a ]]; then
5171
make install
5272
cd ..
5373
fi
54-
## now build static library for linking with stringtie, htsqc etc.
74+
5575
make -j 4 lib-static

rlink.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7110,6 +7110,9 @@ bool fwd_to_sink_fast_long(int i,GVec<int>& path,int& minpath,int& maxpath,GBitV
71107110
}
71117111
else {
71127112
for(int c=0;c<nchildren;c++) {
7113+
7114+
bool childonpath=false;
7115+
if(pathpat[inode->child[c]]) childonpath=true;
71137116
// check if child is already on the path
71147117
int *pos=gpos[edge(i,inode->child[c],gno)];
71157118
if(pos && pathpat[*pos]) {
@@ -7203,9 +7206,10 @@ bool fwd_to_sink_fast_long(int i,GVec<int>& path,int& minpath,int& maxpath,GBitV
72037206
}
72047207
}
72057208

7206-
7207-
pathpat[inode->child[c]]=0;
72087209
if(pos) pathpat[*pos]=0;
7210+
if(childonpath) break;
7211+
pathpat[inode->child[c]]=0;
7212+
72097213

72107214
}
72117215
}
@@ -7276,7 +7280,6 @@ bool fwd_to_sink_fast_long(int i,GVec<int>& path,int& minpath,int& maxpath,GBitV
72767280
if(transfrag[tmax]->nodes.Last()>maxpath) maxpath=transfrag[tmax]->nodes.Last();
72777281
}
72787282

7279-
72807283
return fwd_to_sink_fast_long(maxc,path,minpath,maxpath,pathpat,transfrag,no2gnode,nodecov,gno,gpos);
72817284
}
72827285

@@ -7326,6 +7329,10 @@ bool back_to_source_fast_long(int i,GVec<int>& path,int& minpath,int& maxpath,GB
73267329
//int maxparent=inode->parent[0];
73277330
//float maxparentcov=-1;
73287331
for(int p=0;p<nparents;p++) {
7332+
7333+
bool parentonpath=false;
7334+
if(pathpat[inode->parent[p]]) parentonpath=true;
7335+
73297336
// check if parent is already on the path
73307337
int *pos=gpos[edge(inode->parent[p],i,gno)];
73317338
if(pos && pathpat[*pos]) { // this is next child on the path
@@ -7421,8 +7428,9 @@ bool back_to_source_fast_long(int i,GVec<int>& path,int& minpath,int& maxpath,GB
74217428
}
74227429
}
74237430

7424-
pathpat[inode->parent[p]]=0;
74257431
if(pos) pathpat[*pos]=0;
7432+
if(parentonpath) break;
7433+
pathpat[inode->parent[p]]=0;
74267434

74277435
}
74287436
}
@@ -8073,7 +8081,7 @@ float long_max_flow(int gno,GVec<int>& path,GBitVec& istranscript,GPVec<CTransfr
80738081
/*
80748082
{ // DEBUG ONLY
80758083
printTime(stderr);
8076-
fprintf(stderr,"Start max flow algorithm for path ");
8084+
fprintf(stderr,"Start max flow algorithm for gno=%d and path ",gno);
80778085
printBitVec(pathpat);
80788086
fprintf(stderr," :");
80798087
for(int i=0;i<n;i++) fprintf(stderr," %d:%d",i,path[i]);
@@ -10798,7 +10806,15 @@ void get_trf_long(int gno,int edgeno, GIntHash<int> &gpos,GPVec<CGraphnode>& no2
1079810806
/*
1079910807
{ // DEBUG ONLY
1080010808
fprintf(stderr,"\n\n***Start get_trf_long with maxi=%d minp=%d maxp=%d and transcript:",maxi,minp,maxp);
10801-
for(int i=0;i<transfrag[t]->nodes.Count();i++) fprintf(stderr," %d",transfrag[t]->nodes[i]);
10809+
for(int i=0;i<transfrag[t]->nodes.Count();i++) {
10810+
if(i) {
10811+
pos=gpos[edge(transfrag[t]->nodes[i-1],transfrag[t]->nodes[i],gno)];
10812+
if(pos && pathpat[*pos])
10813+
fprintf(stderr,"-");
10814+
}
10815+
fprintf(stderr," %d",transfrag[t]->nodes[i]);
10816+
10817+
}
1080210818
fprintf(stderr," pathpat=");
1080310819
//printBitVec(pathpat);
1080410820
fprintf(stderr,"\n");

0 commit comments

Comments
 (0)