Skip to content

add interface for MotifCluster #80

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 4 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
8 changes: 8 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ ifeq ($(UNAME), Linux)
CXXFLAGS += -fPIC -D__STDC_LIMIT_MACROS -DSW_SNAPPY -fopenmp
LDFLAGS += -shared -fopenmp
MANIFEST = MANIFEST.nx
ifneq (, $(strip $(shell ldconfig -p | grep libarpack)))
CXXFLAGS += -DF77_POST
LIBS += -larpack
endif
else ifeq ($(UNAME), Darwin)
# OS X flags
SWIGFLAGS += -D_CMPWARN -D__stdcall -DSW_SNAPPY -DNONUMPY
Expand All @@ -26,6 +30,10 @@ else ifeq ($(UNAME), Darwin)
CXXOPENMP =
endif
MANIFEST = MANIFEST.mac
ifneq (, $(strip $(shell ld -larpack 2>&1 | grep symbol)))
CXXFLAGS += -DF77_POST
LIBS += -larpack
endif
else ifeq ($(shell uname -o), Cygwin)
# Cygwin flags
SWIGFLAGS += -D_CMPWARN -D__stdcall -DSW_SNAPPY -DNONUMPY
Expand Down
35 changes: 12 additions & 23 deletions swig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Build instructions for Mac OS X and Linux:
# make
# make dist
#
#
# Build instructions for Windows:
# - run swig in Cygwin to generate snap_wrap.cxx and snap.py
# make swig-win
Expand Down Expand Up @@ -38,32 +38,21 @@ snap_wrap.cxx: snap.i snap_types.i tvec.i pneanet.i tmodenet.i tcrossnet.i pungr
snap_wrap.o: snap_wrap.cxx
g++ $(CXXFLAGS) -c snap_wrap.cxx -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR) -I/usr/include/python2.6 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include

Snap.o:
Snap.o:
$(CC) $(CXXFLAGS) -c $(SNAPDIR)/Snap.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

cliques.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/cliques.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

agm.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/agm.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

agmfast.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/agmfast.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

agmfit.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/agmfit.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

biasedrandomwalk.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/biasedrandomwalk.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

word2vec.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/word2vec.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)
OBJS = $(addsuffix .o, cliques agm agmfast agmfit biasedrandomwalk motifcluster word2vec n2v)

n2v.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/n2v.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)
$(OBJS): %.o:
$(CC) $(CXXFLAGS) -c $(SNAPADVDIR)/$*.cpp -I$(SNAPDIR) -I$(SNAPADVDIR) -I$(GLIBDIR)

_snap.so: snap_wrap.o Snap.o cliques.o agm.o agmfast.o agmfit.o biasedrandomwalk.o word2vec.o n2v.o
g++ $(LDFLAGS) -o _snap.so snap_wrap.o Snap.o cliques.o agm.o agmfast.o agmfit.o biasedrandomwalk.o word2vec.o n2v.o $(LIBS)
ifeq (, $(findstring -larpack, $(LIBS)))
_snap.so: $(filter-out motifcluster.o, $(OBJS))
else
_snap.so: $(OBJS)
endif
_snap.so: snap_wrap.o Snap.o
g++ $(LDFLAGS) -o _snap.so $^ $(LIBS)

snap.py: snap_wrap.cxx

Expand Down
10 changes: 9 additions & 1 deletion swig/snap.i
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ Version = "3.0.2"
#include "agm.h"
#include "agmfast.h"
#include "agmfit.h"
#include "motifcluster.h"
#include "n2v.h"

/* #include "Engine.h" */
#include "snapswig.h"

Expand Down Expand Up @@ -108,6 +109,9 @@ Version = "3.0.2"
%ignore TVec< TPair< TStr,TAttrType > >::TVec(TSIn &);
//%ignore Schema::Load;

%ignore TVec<TIntH>::GetPrimHashCd;
%ignore TVec<TIntH>::GetSecHashCd;

%ignore TVec<PNEANet>::Intrs;
%ignore TVec<PNEANet>::IntrsLen;
%ignore TVec<PNEANet>::AddSorted;
Expand Down Expand Up @@ -225,6 +229,7 @@ Version = "3.0.2"
%include "agm.h"
%include "agmfast.h"
%include "agmfit.h"
%include "motifcluster.h"
%include "n2v.h"

//%template(Schema) TVec< TPair< TStr, TAttrType> >;
Expand Down Expand Up @@ -538,6 +543,9 @@ Version = "3.0.2"
//%template(TStrIntSH) TStrHash<TInt>;
//%template(TStrToIntVSH) TStrHash<TIntV>;

// define vector types
%template(WeightVH) TVec<TIntH>;

// define keydat types
//%template(TChChHI) THashKeyDatI <TCh, TCh>;
//%template(TChTrIntHI) THashKeyDatI <TChTr, TInt>;
Expand Down
6 changes: 5 additions & 1 deletion swig/tvec.i
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ TIntStrStrTrV.__setitem__ = setitem_vec
TIntStrStrTrV.__iter__ = itervec
TIntStrStrTrV.__len__ = len_vec
TIntStrStrTrV.__delitem__ = delitem_vec
WeightVH.__getitem__ = getitem_vec
WeightVH.__setitem__ = setitem_vec
WeightVH.__iter__ = itervec
WeightVH.__len__ = len_vec
WeightVH.__delitem__ = delitem_vec
%}
#endif