Skip to content
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

Plotting output #40

Open
mbhall88 opened this issue Aug 18, 2020 · 2 comments
Open

Plotting output #40

mbhall88 opened this issue Aug 18, 2020 · 2 comments

Comments

@mbhall88
Copy link

Hey @tseemann

I've created a (python) script for plotting the matrix output from this tool as an interactive heatmap which others might find useful.

Feel free to link to it from the README if you like, or I guess people can just find it here in the issues too.

Usage

$ python plot_distance_matrix.py --help
Usage: plot_distance_matrix.py [OPTIONS]

  This script generates an interactive heatmap (HTML) for a distance matrix.

Options:
  -h, --help                      Show this message and exit.
  -i, --matrix FILE               Distance matrix to plot.  [default: -]
  -o, --output FILE               Path to save HTML plot to.  [default:
                                  heatmap.html]
  -d, --delim TEXT                Delimiter used in the matrix. [ default:
                                  '\t']
  -p, --palette [YlGn|YlGnBu|GnBu|BuGn|PuBuGn|PuBu|BuPu|RdPu|PuRd|OrRd|YlOrRd|YlOrBr|Purples|Blues|Greens|Oranges|Reds|Greys|PuOr|BrBG|PRGn|PiYG|RdBu|RdGy|RdYlBu|Spectral|RdYlGn|Accent|Dark2|Paired|Pastel1|Pastel2|Set1|Set2|Set3]
                                  ColorBrewer palette to use for heatmap.
                                  [default: RdBu]
  -t, --title TEXT                Title for the heatmap.  [default: Pairwise
                                  distance matrix]
  --width INTEGER                 Plot width in pixels  [default: 900]
  --height INTEGER                Plot height in pixels  [default: 900]

Static example

heatmap

Interactive example

heatmap.html.gz

@guillemmasfiol
Copy link

Very nice script @mbhall88, thank you!

Perhaps it would be really useful to add a functionality to cluster the sequences according to their SNP distance. There are already R packages to treat such heatmaps; one of them allows to include use a precomputed phylogeny to cluster the heatmap (https://rdrr.io/cran/phytools/man/phylo.heatmap.html)

@mbhall88
Copy link
Author

I would welcome a PR to add that functionality @guillemmasfiol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants