diff --git a/VERSION b/VERSION index e805773e..87f488b0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.193 +1.2.193 \ No newline at end of file diff --git a/ppanggolin/figures/draw_spot.py b/ppanggolin/figures/draw_spot.py index 1c926682..f675682b 100644 --- a/ppanggolin/figures/draw_spot.py +++ b/ppanggolin/figures/draw_spot.py @@ -647,7 +647,10 @@ def draw_spots(pangenome: Pangenome, output: Path, spot_list: str, disable_bar: need_rgp=True, need_spots=True, need_modules=need_mod, disable_bar=disable_bar) if spot_list == 'all' or any(x == 'all' for x in spot_list): - logging.getLogger("PPanGGOLiN").debug("all is found in spot list, all spot are drawn.") + logging.getLogger("PPanGGOLiN").debug(f"'all' value is found in spot list, all spots are drawn.") + selected_spots = list(pangenome.spots) + elif spot_list == "synteny" or any(x == 'synteny' for x in spot_list): + logging.getLogger().debug(f"'synteny' value is found in spot list, all spots with more than 1 conserved synteny are drawn.") selected_spots = [s for s in pangenome.spots if len(s.get_uniq_ordered_set()) > 1] else: curated_spot_list = {'spot_' + str(s) if not s.startswith("spot_") else str(s) for s in spot_list} diff --git a/ppanggolin/figures/drawing.py b/ppanggolin/figures/drawing.py index bd03d21b..2e09674f 100644 --- a/ppanggolin/figures/drawing.py +++ b/ppanggolin/figures/drawing.py @@ -91,7 +91,7 @@ def parser_draw(parser: argparse.ArgumentParser): optional.add_argument("--draw_spots", required=False, default=False, action="store_true", help="draw plots for spots of the pangenome") optional.add_argument("--spots", required=False, default='all', nargs='+', - help="a comma-separated list of spots to draw (or 'all' to draw all spots).") + help="a comma-separated list of spots to draw (or 'all' to draw all spots, or 'synteny' to draw spots with different RGP syntenies).") if __name__ == '__main__': diff --git a/ppanggolin/region.py b/ppanggolin/region.py index 6365e408..17ccfff3 100644 --- a/ppanggolin/region.py +++ b/ppanggolin/region.py @@ -51,6 +51,7 @@ def __init__(self, name: str): self.starter = None self.stopper = None self.ID = Region.id_counter + self.spot = None Region.id_counter += 1 def __str__(self): @@ -133,6 +134,18 @@ def __getitem__(self, position: int) -> Gene: except KeyError: raise KeyError(f"There is no gene at position {position} in RGP {self.name}") + def add_spot(self, spot: Spot): + """Sets the spot of the RGP + + :param spot: spot to which the RGP is added + + :raise TypeError: if the given spot is not a Spot. + """ + if isinstance(spot, Spot): + self.spot = spot#only 1 spot possible + else: + raise TypeError(f"Unexpected class / type for {type(spot)} when adding it to a RGP") + def __delitem__(self, position): """Remove the gene at the given position