Skip to content

Commit

Permalink
Add infer_singletons to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jpjarnoux committed Jun 6, 2024
1 parent 9e7a5e2 commit ba04fe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ppanggolin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ def check_option_workflow(args):
if not any([args.fasta, args.anno]):
raise Exception("At least one of --fasta or --anno must be given")

if args.infer_singletons and args.clusters is None:
logging.getLogger("PPanGGOLiN").warning("--infer_singleton works only with --clusters given.")


def parse_config_file(yaml_config_file: str) -> dict:
"""
Expand Down
8 changes: 7 additions & 1 deletion ppanggolin/workflow/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def launch_workflow(args: argparse.Namespace, panrgp: bool = True,

start_anno = time.time()
read_annotations(pangenome, args.anno, pseudo=args.annotate.use_pseudo,
cpu=args.annotate.cpu, translation_table=args.annotate.translation_table, disable_bar=args.disable_prog_bar)
cpu=args.annotate.cpu, translation_table=args.annotate.translation_table,
disable_bar=args.disable_prog_bar)
anno_time = time.time() - start_anno

start_writing = time.time()
Expand All @@ -63,6 +64,7 @@ def launch_workflow(args: argparse.Namespace, panrgp: bool = True,

if args.clusters is not None:
start_clust = time.time()
print(args.cluster)
read_clustering(pangenome, args.clusters, disable_bar=args.disable_prog_bar,
infer_singleton=args.cluster.infer_singletons)
else: # args.cluster is None
Expand Down Expand Up @@ -362,6 +364,10 @@ def add_workflow_args(parser: argparse.ArgumentParser):
optional.add_argument("--identity", required=False, type=restricted_float, default=0.8,
help="Minimal identity percent for two proteins to be in the same cluster")

optional.add_argument("--infer_singletons", required=False, action="store_true",
help="When reading a clustering result with --clusters,"
" if a gene is not in the provided file")

optional.add_argument("-K", "--nb_of_partitions", required=False, default=-1, type=int,
help="Number of partitions to use. Must be at least 2. If under 2, "
"it will be detected automatically.")
Expand Down

0 comments on commit ba04fe7

Please sign in to comment.