diff --git a/ppanggolin/formats/write_proksee.py b/ppanggolin/formats/write_proksee.py index b04e6063..2db4c5d3 100644 --- a/ppanggolin/formats/write_proksee.py +++ b/ppanggolin/formats/write_proksee.py @@ -51,7 +51,7 @@ def write_legend_items(features: List[str], module_to_color: Dict[Module, str] = if module_to_color is not None and ("modules" in features or "all" in features): for mod, color in sorted(module_to_color.items(), key=lambda x: x[0].ID): - legend_data["items"].append({"name": f"module_{mod.ID}", + legend_data["items"].append({"name": str(mod), "decoration": "arc", "swatchColor": color, "visible": False}) @@ -324,23 +324,27 @@ def write_modules(organism: Organism, gf2genes: Dict[str, List[Gene]], metadata_ if gf_intersection: # Calculate the completion percentage - completion = round(100 * len(gf_intersection) / len(set(module.families)), 1) - + metadata_for_proksee = {'completion': round(100 * len(gf_intersection) / len(set(module.families)), 1)} + + metadata_for_proksee.update(module.formatted_metadata_dict(metadata_sep)) # Create module data entries for genes within intersecting gene families for gf in gf_intersection: for gene in gf2genes[gf.name]: - modules_data_list.append({ - "name": f"Module_{module.ID}", - "presence": "Module", - "start": gene.start, - "stop": gene.stop, - "contig": gene.contig.name, - "legend": f"module_{module.ID}", - "source": "Module", - "tags": [f'{completion}% complete'], - "meta": module.formatted_metadata_dict(metadata_sep) + for start, stop in gene.coordinates: + modules_data_list.append({ + "name": str(module), + "presence": "Module", + "start": start, + "stop": stop, + "contig": gene.contig.name, + "legend": str(module), + "source": "Module", + "tags": [], + "meta": metadata_for_proksee }) + + return modules_data_list