diff --git a/ChangeLog b/ChangeLog index 2a3f75c418..7941d65310 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-02-19 Daniel Standage <daniel.standage@gmail.com> + + * Makefile: add a new Makefile target `help` to list and describe all + common targets. + * khmer/utils.py, tests/test_functions.py: minor style fixes. + 2015-02-16 Titus Brown <titus@idyll.org> * khmer/utils.py: added 'check_is_pair', 'broken_paired_reader', and diff --git a/Makefile b/Makefile index f53690fb0f..9ad0329303 100644 --- a/Makefile +++ b/Makefile @@ -18,11 +18,23 @@ CPPCHECK=ls lib/*.cc khmer/_khmermodule.cc | grep -v test | cppcheck -DNDEBUG \ --quiet -Ilib -Ithird-party/bzip2 -Ithird-party/zlib \ -Ithird-party/smhasher -all: khmer/_khmermodule.so + +## all : default task; compile C++ code, build shared object library +all: sharedobj + +## help : print this help message and exit +help: Makefile + @sed -n 's/^##//p' $< + +## install-dep : install most of the development dependencies via pip +install-dep: install-dependencies install-dependencies: pip2 install --upgrade $(DEVPKGS) || pip install --upgrade $(DEVPKGS) +## sharedobj : build khmer shared object file +sharedobj: khmer/_khmermodule.so + khmer/_khmermodule.so: $(CPPSOURCES) ./setup.py build_ext --inplace @@ -31,14 +43,17 @@ coverage-debug: $(CPPSOURCES) build_ext --debug --inplace --libraries gcov touch coverage-debug +## install : install the khmer module and scripts install: FORCE ./setup.py build install +## dist : create a module package for distribution dist: dist/khmer-$(VERSION).tar.gz dist/khmer-$(VERSION).tar.gz: $(SOURCES) ./setup.py sdist +## clean : clean up all temporary / machine-generated files clean: FORCE cd lib && ${MAKE} clean || true cd tests && rm -rf khmertest_* || true @@ -52,6 +67,7 @@ debug: FORCE export CFLAGS="-pg -fprofile-arcs"; python setup.py build_ext --debug \ --inplace +## doc : render documentation in HTML doc: build/sphinx/html/index.html build/sphinx/html/index.html: $(SOURCES) $(wildcard doc/*.txt) doc/conf.py all @@ -60,6 +76,7 @@ build/sphinx/html/index.html: $(SOURCES) $(wildcard doc/*.txt) doc/conf.py all @echo '--> docs in build/sphinx/html <--' @echo '' +## pdf : render documentation as a PDF file pdf: build/sphinx/latex/khmer.pdf build/sphinx/latex/khmer.pdf: $(SOURCES) doc/conf.py $(wildcard doc/*.txt) @@ -71,9 +88,11 @@ build/sphinx/latex/khmer.pdf: $(SOURCES) doc/conf.py $(wildcard doc/*.txt) cppcheck-result.xml: $(CPPSOURCES) ${CPPCHECK} --xml-version=2 2> cppcheck-result.xml +## cppcheck : run static analysis on C++ code cppcheck: $(CPPSOURCES) ${CPPCHECK} +## pep8 : check Python code style pep8: $(PYSOURCES) $(wildcard tests/*.py) pep8 --exclude=_version.py setup.py khmer/ scripts/ tests/ || true @@ -84,17 +103,21 @@ pep8_report.txt: $(PYSOURCES) $(wildcard tests/*.py) diff_pep8_report: pep8_report.txt diff-quality --violations=pep8 pep8_report.txt +## astyle : fix most C++ code indentation and formatting astyle: $(CPPSOURCES) astyle -A10 --max-code-length=80 $(CPPSOURCES) +## autopep8 : fix most Python code indentation and formatting autopep8: $(PYSOURCES) $(wildcard tests/*.py) autopep8 --recursive --in-place --exclude _version.py --ignore E309 \ setup.py khmer/*.py scripts/*.py tests/*.py # A command to automatically run astyle and autopep8 on appropriate files +## format : check/fix all code indentation and formatting (runs astyle and autopep8) format: astyle autopep8 # Do nothing +## pylint : run static code analysis on Python code pylint: $(PYSOURCES) $(wildcard tests/*.py) pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ setup.py khmer/[!_]*.py khmer/__init__.py scripts/*.py tests \ @@ -141,6 +164,7 @@ diff-cover.html: coverage-gcovr.xml coverage.xml nosetests.xml: FORCE ./setup.py nosetests --with-xunit +## doxygen : generate documentation of the C++ and Python code doxygen: doc/doxygen/html/index.html doc/doxygen/html/index.html: ${CPPSOURCES} ${PYSOURCES} @@ -153,6 +177,7 @@ lib: cd lib && \ $(MAKE) +## test : run the khmer test suite test: FORCE ./setup.py develop ./setup.py nosetests @@ -161,6 +186,7 @@ sloccount.sc: ${CPPSOURCES} ${PYSOURCES} $(wildcard tests/*.py) Makefile sloccount --duplicates --wide --details lib khmer scripts tests \ setup.py Makefile > sloccount.sc +## sloccount : count lines of code sloccount: sloccount lib khmer scripts tests setup.py Makefile diff --git a/khmer/utils.py b/khmer/utils.py index 20c25be847..d2d6b862da 100644 --- a/khmer/utils.py +++ b/khmer/utils.py @@ -111,8 +111,8 @@ def write_record(record, fileobj): fileobj.write( '@{name}\n{seq}\n' '+\n{qual}\n'.format(name=record.name, - seq=record.sequence, - qual=record.quality)) + seq=record.sequence, + qual=record.quality)) else: fileobj.write( '>{name}\n{seq}\n'.format(name=record.name, diff --git a/tests/test_functions.py b/tests/test_functions.py index 66224693ed..bc2572d879 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -190,11 +190,11 @@ def test_check_is_pair_7(): class Test_BrokenPairedReader(object): - stream = [FakeFastaRead(name='seq1/1', sequence='A'*5), - FakeFastaRead(name='seq1/2', sequence='A'*4), - FakeFastaRead(name='seq2/1', sequence='A'*5), - FakeFastaRead(name='seq3/1', sequence='A'*3), - FakeFastaRead(name='seq3/2', sequence='A'*5)] + stream = [FakeFastaRead(name='seq1/1', sequence='A' * 5), + FakeFastaRead(name='seq1/2', sequence='A' * 4), + FakeFastaRead(name='seq2/1', sequence='A' * 5), + FakeFastaRead(name='seq3/1', sequence='A' * 3), + FakeFastaRead(name='seq3/2', sequence='A' * 5)] def gather(self, **kw): iter = broken_paired_reader(self.stream, **kw)