Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mittinatten committed Sep 27, 2015
2 parents 554983c + c548cbb commit 92d66ab
Show file tree
Hide file tree
Showing 40 changed files with 2,478 additions and 18,157 deletions.
27 changes: 15 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
*.o
*.so
*.a
freesasa
example
test
.DS_Store
*~
a.out
*.dvi
*.aux
*.log
*.pdf
*.ps
doc/fig/lnr_*.eps
doc/doxygen
doc/Doxyfile
doc/doxyfile.stamp
*.svg
*.gcda
*.gcno
*.out
*.gcov
*.trs
*.tar.gz
freesasa
example
test
.DS_Store
*~
a.out
*Makefile.in
*Makefile
*.deps
Expand All @@ -30,7 +28,6 @@ config.status
configure.scan
configure
stamp-h1
*.tar.gz
missing
install-sh
depcomp
Expand All @@ -39,6 +36,12 @@ test-driver
autom4te.cache
aclocal.m4
tmp*
doc/doxygen
bindings/python/*.c
doc/doxygen
doc/html/
doc/fig/lnr_*.eps
doc/doxygen
doc/Doxyfile
doc/doxyfile.stamp
doc/manual.xml
doc/LaTeXML.cache
2 changes: 1 addition & 1 deletion bindings/python/cfreesasa.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cdef extern from "freesasa.h":
freesasa_algorithm alg
double probe_radius
int shrake_rupley_n_points
double lee_richards_delta
int lee_richards_n_slices
int n_threads

ctypedef struct freesasa_result:
Expand Down
35 changes: 17 additions & 18 deletions bindings/python/freesasa.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A minimal program would be something like
See documentation of the classes and functions for how to customize behavior
The private methods _assign_ptr allow access to the C structs that
The private methods _get_address allow access to the C structs that
these classes are wrapping, which are necessary in the functions
calc() and classifyResults(). They are not intended to be used outside
of this module.
Expand Down Expand Up @@ -44,8 +44,8 @@ defaultParameters = {'algorithm' : ShrakeRupley, #freesasa_default_parameters.al
'probe-radius' : freesasa_default_parameters.probe_radius,
'n-points' :
freesasa_default_parameters.shrake_rupley_n_points,
'delta' :
freesasa_default_parameters.lee_richards_delta,
'n-slices' :
freesasa_default_parameters.lee_richards_n_slices,
'n-threads' : freesasa_default_parameters.n_threads }
"""The default values for calculation parameters"""

Expand All @@ -72,7 +72,7 @@ cdef class Parameters:
if 'algorithm' in param: self.setAlgorithm(param['algorithm'])
if 'probe-radius' in param: self.setProbeRadius(param['probe-radius'])
if 'n-points' in param: self.setNPoints(param['n-points'])
if 'delta' in param: self.setDelta(param['delta'])
if 'n-slices' in param: self.setNSlices(param['n-slices'])
if 'n-threads' in param: self.setNThreads(param['n-threads'])

def setAlgorithm(self,alg):
Expand Down Expand Up @@ -130,12 +130,11 @@ cdef class Parameters:
Set number of test points in Shrake & Rupley algorithm.
Args:
n (int): Number of points. Must be one of 20, 50, 100, 200,
500, 1000, 2000 or 5000.
n (int): Number of points (> 0).
Raises:
AssertionError: n invalid.
AssertionError: n <= 0.
"""
assert(n in [20,50,100,200,500,1000,2000,5000])
assert(n > 0)
self._c_param.shrake_rupley_n_points = n

def nPoints(self):
Expand All @@ -147,26 +146,26 @@ cdef class Parameters:
"""
return self._c_param.shrake_rupley_n_points

def setDelta(self,delta):
def setNSlices(self,n):
"""
Set the value of delta in Lee & Richards algorithm.
Set the number of slices per atom in Lee & Richards algorithm.
Args:
delta: Value of delta
n: Number of slices (> 0)
Raises:
AssertionError: delta must be > 0
AssertionError: n <= 0
"""
assert(delta > 0)
self._c_param.lee_richards_delta = delta
assert(n> 0)
self._c_param.lee_richards_n_slices = n

def delta(self):
def nSlices(self):
"""
Get the value of delta in Lee & Richards algorithm.
Get the number of slices per atom in Lee & Richards algorithm.
Returns:
Value of delta.
Number of slices.
"""
return self._c_param.lee_richards_delta
return self._c_param.lee_richards_n_slices

def setNThreads(self,n):
"""
Expand Down
32 changes: 16 additions & 16 deletions bindings/python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def testParameters(self):
self.assertTrue(p.algorithm() == d['algorithm'])
self.assertTrue(p.probeRadius() == d['probe-radius'])
self.assertTrue(p.nPoints() == d['n-points'])
self.assertTrue(p.delta() == d['delta'])
self.assertTrue(p.nSlices() == d['n-slices'])
self.assertTrue(p.nThreads() == d['n-threads'])

p.setAlgorithm(ShrakeRupley)
Expand All @@ -38,11 +38,11 @@ def testParameters(self):

p.setNPoints(20)
self.assertTrue(p.nPoints() == 20)
self.assertRaises(AssertionError,lambda: p.setNPoints(21))
self.assertRaises(AssertionError,lambda: p.setNPoints(0))

p.setDelta(0.5)
self.assertTrue(p.delta() == 0.5)
self.assertRaises(AssertionError,lambda: p.setDelta(-0.5))
p.setNSlices(10)
self.assertTrue(p.nSlices() == 10)
self.assertRaises(AssertionError,lambda: p.setNSlices(0))

p.setNThreads(2)
self.assertTrue(p.nThreads() == 2)
Expand Down Expand Up @@ -184,7 +184,7 @@ def testStructureArray(self):
self.assertTrue(len(ss) == 1)
self.assertTrue(ss[0].nAtoms() == 602)
result = calc(ss[0])
self.assertTrue(math.fabs(result.totalArea() - 4759.86096) < 1e-5)
self.assertTrue(math.fabs(result.totalArea() - 4779.5109924) < 1e-5)

# Test exceptions
setVerbosity(silent)
Expand All @@ -197,31 +197,31 @@ def testCalc(self):
# test default settings
structure = Structure("data/1ubq.pdb")
result = calc(structure)
self.assertTrue(math.fabs(result.totalArea() - 4759.86096) < 1e-5)
self.assertTrue(math.fabs(result.totalArea() - 4779.5109924) < 1e-5)
sasa_classes = classifyResults(result,structure)
self.assertTrue(math.fabs(sasa_classes['Polar'] - 2232.23039) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Apolar'] - 2527.63057) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Polar'] - 2236.9298941) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Apolar'] - 2542.5810983) < 1e-5)

# test L&R
result = calc(structure,Parameters({'algorithm' : LeeRichards, 'delta' : 0.25}))
sasa_classes = classifyResults(result,structure)
self.assertTrue(math.fabs(result.totalArea() - 4728.26159) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Polar'] - 2211.41649) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Apolar'] - 2516.84510) < 1e-5)
self.assertTrue(math.fabs(result.totalArea() - 4759.46651) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Polar'] - 2226.83182) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['Apolar'] - 2532.63469) < 1e-5)

# test extending Classifier with derived class
sasa_classes = classifyResults(result,structure,DerivedClassifier())
self.assertTrue(math.fabs(sasa_classes['bla'] - 4728.26159) < 1e-5)
self.assertTrue(math.fabs(sasa_classes['bla'] - 4759.46651) < 1e-5)

## test calculating with user-defined classifier ##
classifier = Classifier("data/naccess.config")
# classifier passed to assign user-defined radii, could also have used setRadiiWithClassifier()
structure = Structure("data/1ubq.pdb",classifier)
result = calc(structure)
self.assertTrue(math.fabs(result.totalArea() - 4777.39) < 0.1)
self.assertTrue(math.fabs(result.totalArea() - 4823.29) < 0.1)
sasa_classes = classifyResults(result,structure,classifier) # classifier passed to get user-classes
self.assertTrue(math.fabs(sasa_classes['polar'] - 2361.92) < 0.1)
self.assertTrue(math.fabs(sasa_classes['apolar'] - 2415.47) < 0.1)
self.assertTrue(math.fabs(sasa_classes['polar'] - 2360.52) < 0.1)
self.assertTrue(math.fabs(sasa_classes['apolar'] - 2462.77) < 0.1)


if __name__ == '__main__':
Expand Down
25 changes: 14 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([FreeSASA], [0.4.1])
AC_INIT([FreeSASA], [0.5.0])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/freesasa.c])
AC_CONFIG_HEADERS([config.h])
Expand Down Expand Up @@ -60,29 +60,35 @@ fi
# Enable LaTeX
AC_ARG_ENABLE([latex],
[AS_HELP_STRING([--enable-latex],
[build documentation from latex sources])],
[enable_latex=yes], [enable_latex=no])
[build documentation from latex sources])])

if test x$enable_latex = xyes ; then
AC_CHECK_PROG(LATEX, latex, latex)
AC_CHECK_PROG(DVIPS, dvips, dvips)
AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex)
AC_CHECK_PROG(EPSTOPDF, epstopdf, epstopdf)
AC_CHECK_PROG(PDFTOCAIRO, pdftocairo, pdftocairo)
AC_CHECK_PROG(LATEXML,latexml,latexml)
AC_CHECK_PROG(LATEXMLPOST,latexmlpost,latexmlpost)
AM_CONDITIONAL([HAVE_LATEX], [test -n "$LATEX" && test -n "$DVIPS" \
&& test -n "$EPSTOPDF" && test -n "$PDFLATEX"])
AM_CONDITIONAL([HAVE_CAIRO], [test -n "$LATEX" && test -n "$DVIPS"])
AM_CONDITIONAL([BUILD_HTML_MANUAL], [test -n "$LATEXML" && test -n "$LATEXMLPOST" && test -n "$PDFTOCAIRO"])
AM_COND_IF([HAVE_LATEX],[],
[echo "LaTeX not available, option '--enable-latex' ignored"])
AM_COND_IF([HAVE_LATEX],[build_doc=yes])
AM_COND_IF([BUILD_HTML_MANUAL],[],[echo "pdftocairo and/or latexml not available, HTML version of manual will not be built"])
else
AM_CONDITIONAL([HAVE_LATEX],FALSE)
AM_CONDITIONAL([HAVE_CAIRO],FALSE)
AM_CONDITIONAL([BUILD_HTML_MANUAL],FALSE)
fi

# Enable Doxygen
AC_ARG_ENABLE([doxygen],
[AS_HELP_STRING([--enable-doxygen],
[build doxygen html-documentation])],
[enable_doxygen=yes],
[enable_doxygen=no])
[build doxygen html-documentation])])

if test x$enable_doxygen = xyes ; then
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
AM_CONDITIONAL([HAVE_DOXYGEN],[test -n "$DOXYGEN"])
Expand All @@ -103,9 +109,7 @@ AM_CONDITIONAL([BUILD_DOC],[test -n "$build_doc"])
# Enable testing
AC_ARG_ENABLE([check],
[AS_HELP_STRING([--enable-check],
[enable the Check unit testing framework])],
[enable_check=yes],
[enable_check=no])
[enable the Check unit testing framework])])

if test x$enable_check = xyes ; then
AC_CHECK_LIB([check],[suite_create],
Expand All @@ -119,8 +123,7 @@ fi
# Enable gcov
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[compile with Gcov to measure coverage])],
[enable_gcov=yes],[enable_gcov=no])
[compile with Gcov to measure coverage])])
AM_CONDITIONAL([COND_GCOV],[test "x$enable_gcov" = xyes])

# Disable test for CLI
Expand Down
1 change: 1 addition & 0 deletions doc/HOWTO_BUILD_WEBPAGES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The makefile in this directory writes to the directory html, if that directory in turn has a clone of the branch 'gh-pages', the automatically generated HTML from doxygen and the manual will be put in the right place and can be committed in the gh-pages branch.
38 changes: 32 additions & 6 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
SUBDIRS = fig
manual = manual.tex
fig_eps = fig/lnr_circles.eps fig/lnr_slice.eps fig/scaling.eps fig/precision.eps fig/threads.eps
fig_eps = fig/lnr_circles.eps fig/lnr_slice.eps fig/precision.eps fig/threads.eps
fig_pdf = $(subst .eps,.pdf,$(fig_eps))

CLEANFILES =
ALLFILES =

EXTRA_DIST = $(manual) doxy_main.md GPL.md README.md doxygen-footer.html doxygen-header.html
EXTRA_DIST = $(manual) doxy_main.md GPL.md README.md \
doxygen-footer.html doxygen-header.html \
prepareHTML.pl HOWTO_BUILD_WEBPAGES

if HAVE_LATEX

Expand Down Expand Up @@ -40,18 +42,41 @@ ps-local: manual.ps
pdf-local: manual.pdf
ALLFILES += manual.dvi manual.ps manual.pdf

else
if BUILD_HTML_MANUAL

manual.xml: $(srcdir)/$(manual) $(fig_eps)
latexml --quiet $< > manual.xml

html/manual.html: manual.xml
cd html; latexmlpost ../manual.xml --format=html5 --destination=tmp.html --nodefaultresources --navigationtoc=context
perl prepareHTML.pl html/tmp.html > $@
rm html/tmp.html html/LaTeXML.*

html-local: html/manual.html

ALLFILES += html/manual.html
CLEANFILES += manual.xml

else # BUILD_HTML_MANUAL

html-local:
@echo latexml not available, html manual will not be built.

endif # BUILD_HTML_MANUAL

else # HAVE_LATEX
nolatex:
@echo LaTex disabled, run configure script with option --enable-latex to enable
@echo LaTeX disabled, run configure script with option --enable-latex to enable
dvi-local: nolatex
ps-local: nolatex
pdf-local: nolatex

endif

endif # HAVE_LATEX

if HAVE_DOXYGEN

doxyfile.stamp: $(top_srcdir)/src/*.h doxy_main.md $(top_srcdir)/README.md Doxyfile \
doxyfile.stamp: $(top_srcdir)/src/freesasa.h doxy_main.md $(top_srcdir)/README.md Doxyfile \
doxygen-footer.html doxygen-header.html
@if [ ! -d "html/" ]; then mkdir html; fi
$(DOXYGEN) Doxyfile
Expand All @@ -75,4 +100,5 @@ endif
clean-local:
rm -f *.ps *.dvi *.aux *.log *.pdf *.toc *~
rm -rf html/doxygen
rm -rf html/fig

Loading

0 comments on commit 92d66ab

Please sign in to comment.