Your all-inclusive package for aggregating and visualizing metagenomic BLAST results.
Project description
metagenompy
Your all-inclusive package for aggregating and visualizing metagenomic BLAST results.
Installation
$ pip install metagenompy
Usage
NCBI taxonomy as NetworkX object
The core of metagenompy
is a taxonomy as a networkX object.
This means that all your favorite algorithms work right out of the box.
import metagenompy
import networkx as nx
# load taxonomy
graph = metagenompy.generate_taxonomy_network()
# print path from human to pineapple
for node in nx.shortest_path(graph.to_undirected(as_view=True), '9606', '4615'):
print(node, graph.nodes[node])
## 9606 {'rank': 'species', 'scientific_name': 'Homo sapiens', 'common_name': 'human'}
## 9605 {'rank': 'genus', 'scientific_name': 'Homo'}
## [..]
## 4614 {'rank': 'genus', 'scientific_name': 'Ananas'}
## 4615 {'rank': 'species', 'scientific_name': 'Ananas comosus', 'common_name': 'pineapple'}
Easy transformation and visualization of taxonomy
metagenompy
, e.g., allows you to quickly extract taxonomic entities of interest and visualize their relations.
import metagenompy
import matplotlib.pyplot as plt
# load and condense taxonomy to relevant ranks
graph = metagenompy.generate_taxonomy_network()
metagenompy.condense_taxonomy(graph)
# highlight interesting nodes
graph_zoom = metagenompy.highlight_nodes(graph, [
'9606', # human
'9685', # cat
'9615', # dog
'4615', # pineapple
'3747', # strawberry
'4113', # potato
])
# visualize result
fig, ax = plt.subplots(figsize=(10, 10))
metagenompy.plot_taxonomy(graph_zoom, ax=ax, labels_kws=dict(font_size=10))
fig.tight_layout()
fig.savefig('taxonomy.pdf')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
metagenompy-0.1.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for metagenompy-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c5c754c0f3d77870530fe69e0ef204f9a1f31167f496f6efb254cbbdf97c0ba |
|
MD5 | ca95a5114b8641edc423ac5ddf9ac4b5 |
|
BLAKE2b-256 | 144174552c3b3b963e5dce1d7c462abaa57419fe08b7435d1425e3535f207e32 |