Commit bca2a083 authored by Sean Solari's avatar Sean Solari
Browse files

Colour clades based on raw node counts, not cumulative node counts.

parent 1628cc14
......@@ -2,6 +2,12 @@
EXPAM_PUBLIC_DIR=../expam-public/
if ! [[ -d "$EXPAM_PUBLIC_DIR" ]]
then
echo "No public directory found!"
exit 1
fi
rsync -vaP docs src/expam test .gitignore .readthedocs.yaml .pyirc LICENSE MANIFEST.in pyproject.toml README.md setup.cfg setup.py buildandtwine.sh $EXPAM_PUBLIC_DIR
echo "\nbuildandtwine.sh" >> $EXPAM_PUBLIC_DIR/.gitignore
......
......@@ -825,6 +825,11 @@ def main():
'add:-\t\tAdd sequence to the database.\n'
'remove:-\tRemove sequence from database (only impacts future db builds).\n'
'set:-\t\tSet database build parameters.\n'
'to_taxonomy:-\t\tConvert results to taxonomic setting.\n'
'phylotree:-\t\tDraw results on phylotree.\n'
'draw_tree:-\t\tDraw the reference tree.\n'
'download_taxonomy:-\t\tDownload taxonomic information for reference seqeunces.\n'
'cutoff:-\t\tApply cutoff to some set of already processed classifications. THIS WILL OVERWRITE OLD RESULTS!\n'
'mashtree:-\tCreate mashtree from current sequences and add to database.\n'
'quickrun:-\tInitialise, set parameters and start building db (assumes\n'
'\t\t\tsequences all lie in the same folder).\n'
......@@ -1142,6 +1147,48 @@ def main():
circle_scale=circle_scale
)
results.to_taxonomy(name_to_lineage, taxon_to_rank, tax_results_path)
#
# Draw classification results.
#
elif command == "phylotree":
if out_dir is None:
die("Require output directory (-o, --out_dir)!")
else:
validate_results_path(out_dir)
from expam.classification import TAXID_LINEAGE_MAP_NAME, PHY_RESULTS, \
load_taxonomy_map, name_to_id, ClassificationResults
map_url = os.path.join(DB_DIR, TAXID_LINEAGE_MAP_NAME)
if not os.path.exists(map_url):
die("Run command `download_taxonomy` first to collect taxa for your genomes!")
config = load_configuration_file(DB_DIR, return_config=True)
phylogeny_path = config["phylogeny_path"]
phylogeny_path = make_path_absolute(phylogeny_path, DB_DIR)
index, phylogenyIndex = name_to_id(phylogeny_path)
name_to_lineage, taxon_to_rank = load_taxonomy_map(DB_DIR)
# Load phylogenetic results.
phy_results_url = os.path.join(out_dir, PHY_RESULTS)
results = ClassificationResults(
index=index,
phylogeny_index=phylogenyIndex,
in_dir=phy_results_url,
out_dir=out_dir,
groups=groups,
keep_zeros=keep_zeros,
cutoff=cutoff,
cpm=cpm,
use_node_names=use_node_names,
phyla=plot_phyla,
name_taxa=name_to_lineage,
colour_list=colour_list,
circle_scale=circle_scale
)
results.draw_results()
#
......
......@@ -778,7 +778,7 @@ class Index:
use_phyla=False, keep_zeros=True, use_node_names=True):
try:
import ete3.coretype.tree
from ete3 import AttrFace, CircleFace, faces, Tree, TreeStyle, NodeStyle, TextFace
from ete3 import AttrFace, faces, Tree, TreeStyle, NodeStyle, TextFace
except ModuleNotFoundError as e:
print("Could not import ete3 plotting modules! Error raised:")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment