Comments (2)
Good question.
I've not really settled on a best way, yet. I think one of the weak points at the moment is the customisability of colours - especially for the class markers at the leaves of the trees.
For now, the defaults are set in pyani_config.py
, so are only modifiable before module installation, or by manually changing the module, post-install (not a great thing). Some of the colours are matplotlib
or R
builtins, others are custom colour schemes defined in the config file, or in pyani_graphics.py
. It's a bit messy.
So far as the script average_nucleotide_identity.py
is concerned, it will only use the defaults, unless you edit it directly.
It is possible to use the module interactively, or to write your own wrapper script - I'm in the process of writing the relevant documentation in the docs
branch. It's very rudimentary, and the only available file is still incomplete: https://github.com/widdowquinn/pyani/blob/docs/docs/using_pyani_as_a_module.ipynb
Briefly, the heatmap rendering is done with either heatmap_mpl()
for matplotlib
output, or heatmap_r()
for the R
output. The function prototypes are not quite the same: heatmap_mpl()
takes a pandas
DataFrame
, where heatmap_r()
currently takes a tab-separated data file (which can be trivially generated from a pandas
DataFrame
); matplotlib
uses the output filename to determine output format, but this is specified for the R
function. Otherwise, they are both quite similar:
def heatmap_mpl(df, outfilename=None, title=None, cmap=None,
vmin=None, vmax=None, labels=None, classes=None):
"""Returns matplotlib heatmap with cluster dendrograms.
- df - pandas DataFrame with relevant data
- outfilename - path to output file (indicates output format)
- cmap - colourmap option
- vmin - float, minimum value on the heatmap scale
- vmax - float, maximum value on the heatmap scale
- labels - dictionary of alternative labels, keyed by default sequence
labels
- classes - dictionary of sequence classes, keyed by default sequence
labels
"""
def heatmap_r(infilename, outfilename, title=None, cmap="bluered",
vmin=None, vmax=None, gformat=None, labels=None, classes=None):
"""Uses R to draw heatmap, and returns R code used for rendering.
- infilename - path to tab-separated table with data
- outfilename - path to output file
- cmap - colourmap option
- vmin - float, minimum value on the heatmap scale
- vmax - float, maximum value on the heatmap scale
- gformat - string indicating graphics output format
- labels - dictionary of alternative labels, keyed by default sequence
labels
- classes - dictionary of sequence classes, keyed by default sequence
labels
"""
The cmap
argument only controls the heatmap colours, but this can be set when calling the function.
The class colours are hardcoded in the R
function to be rainbow(n)
for n classes. In matplotlib
the colours are currently hardcoded in pyani_config.MPL_CBAR
. Making this something changeable in the function prototype/a separate config file is definitely an enhancement worth making, IMO.
from pyani.
TODO: using .env
, pydotenv
, a proper config.py
Config
class and/or other methods, implement colour palette definitions and other parameterisation.
from pyani.
Related Issues (20)
- Untested code in `fastani.py` HOT 1
- pyani: command not found HOT 1
- Use of `unittest.TestCase` assertion methods provides more informative error messages than `assert` HOT 1
- pyani command not found HOT 1
- `pyani` command not found HOT 1
- Cannot run anim in pyani 0.3.0-alpha using provided data, on macosx 12.6, nucmer fails. HOT 4
- Error "Cannot update because the update target is missing these hooks" when trying to use autoupdate on my repo HOT 1
- sending some love for this script: " genbank_get_genomes_by_taxon.py" HOT 2
- ERROR: This has possibly been a NUCmer run failure, please investigate ERROR: NoneType: None HOT 3
- Type strain vs X of genomes HOT 1
- ValueError in pyani plot using pyani 0.3.0-alpha
- Pyani not installing through conda HOT 5
- Inquiry on Analysis Duration with ANIb and ANIm for Streptomyces Genomes HOT 4
- Fix alignment coverage >1.0 and aniM symmetrical behaviour HOT 8
- Add separate columns for subject and query alignment lengths in `--run_results` HOT 23
- numpy: No module named 'version' HOT 4
- add `pyani dnadiff` subcommand HOT 5
- Running --graphics after analysis HOT 1
- ZeroDivisionError: float division by zero HOT 3
- Installation issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyani.