Skip to content

Commit

Permalink
Merge pull request #134 from labgem/bugfix-sept-23
Browse files Browse the repository at this point in the history
Bugfix sept 23
  • Loading branch information
jpjarnoux authored Oct 16, 2023
2 parents b82dc7b + 436c6af commit 6fcaa9e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.193
1.2.193
5 changes: 4 additions & 1 deletion ppanggolin/figures/draw_spot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion ppanggolin/figures/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
13 changes: 13 additions & 0 deletions ppanggolin/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6fcaa9e

Please sign in to comment.