gravelLab / tracts

A set of tools for modelling ancestry patterns along the genome.
GNU General Public License v2.0
22 stars 14 forks source link

Adjust style to conform to Python standards and implement good-looking plots in Python #2

Closed tsani closed 9 years ago

tsani commented 9 years ago

Most of the code in the tracts project was not conformant to the style guide advocated in the Python standard library, namely PEP-8, https://www.python.org/dev/peps/pep-0008. Using the tool autopep8 for most of the code produced pretty good results, although a lot of it was also done by hand. I've tested the resulting code against the examples included in the repository, and they work as expected.

This pull request does include a minor change to the API which breaks it. The tractlengths attribute in the chrom class was renamed to tract_lengths. The example scripts included were updated to reflect this, although other driver scripts that exist will also need to be updated to reflect this change. Perhaps the version number of tracts should be bumped up to reflec this change in API.

This pull request also fixes a few bugs that seemed to be present in the original program or examples. For instance, calling len on a generator object.

Also, the changes by @DomNelson are included. They include a cleanup of local variables, removing unused ones, and some minor renaming in local scopes to avoid confusion with identifiers defined in the global scope.

tsani commented 9 years ago

The API-breaking change has been reverted, so the pull request now includes only fixups.

tsani commented 9 years ago

The Python module fancyplotting.py subsumes the functionality of the Mathematica notebook fancyplotting.nb, and includes a documented command line interface.