diff --git a/PanACoTA/subcommands/annotate.py b/PanACoTA/subcommands/annotate.py index ad4ed1470688c5474d7aaed14ebb1ff4bc3ea71c..c7d2c549a62e843ee5b3d3e5ceeed1b96135f7b9 100755 --- a/PanACoTA/subcommands/annotate.py +++ b/PanACoTA/subcommands/annotate.py @@ -611,19 +611,20 @@ def check_args(parser, args): parser.error("If you provide a list of genomes with their calculated L90 and number of " "contigs, PanACoTA will use the given sequences as is. It will not cut " "them. So, you cannot use both --cutn and --info.") - if args.l90 != 100 and args.from_info: - parser.error("If you provide a list of genomes with their calculated L90 and number of " - "contigs, PanACoTA will use this information, and not re-calculate it. " - "So, you cannot use both --info and --l90") - if args.nbcont != 999 and args.from_info: - parser.error("If you provide a list of genomes with their calculated L90 and number of " - "contigs, PanACoTA will use this information, and not re-calculate it. " - "So, you cannot use both --info and --nbcont") + # Give a lst_file or an info file, not nothing if not args.from_info and not args.list_file: parser.error("You must provide a list of genomes to annotate. Either raw genomes " "(see -l option), or genomes with quality information (see --info option).") + # Choose between infofile or LSTINFO + if args.from_info and args.list_file: + parser.error("Either you want to annotate raw sequences (name of files in '-l infofile') " + "which will first go through the QC process, " + "OR you already did QC on your sequences and just want to annotate them " + "(information on those sequences in '--info LSTINFO-file'). " + "Please choose one of these 2 possibilities.") + # If no info file nor db_path, ask for 1 of them if not args.db_path and not args.from_info: parser.error("You must provide a path to your database genome sequences (-d <db_path>). " @@ -632,8 +633,8 @@ def check_args(parser, args): # If given LSTINFO, already contains paths to genome to annotate. db_path must not be provided if args.from_info and args.db_path: - parser.error("If you run from your LSTINFO file, this one already contains the path of genomes " - "to annotate. Remove -d <db_path> option.") + parser.error("If you run from your LSTINFO file, this one already contains the " + "path of genomes to annotate. Remove -d <db_path> option.") # WARNINGS # If user wants to cut genomes, warn him to check that it is on purpose (because default is cut at each 5'N') diff --git a/test/test_functional/test_annote-parser.py b/test/test_functional/test_annote-parser.py index 5b8d00244a84ab7475a1cacada1f75b7efbeec64..a1f5bb13ca63d1132cf4f5a0a4599b46a5ab2d3f 100755 --- a/test/test_functional/test_annote-parser.py +++ b/test/test_functional/test_annote-parser.py @@ -301,36 +301,20 @@ def test_parser_info_cutn(capsys): "PanACoTA will use the given sequences as is. It will not cut them. So, you cannot " "use both --cutn and --info.") in err - -def test_parser_info_l90(capsys): - """ - Test that when run with --info and --l90 x : error message - If we run from info file, will not touch the sequences. - """ - parser = argparse.ArgumentParser(description="Annotate all genomes", add_help=False) - annot.build_parser(parser) - with pytest.raises(SystemExit): - annot.parse(parser, "-l list_file -d dbpath -r respath -n name " - "--info infofile --l90 20".split()) - _, err = capsys.readouterr() - assert ("If you provide a list of genomes with their calculated L90 and number of contigs, " - "PanACoTA will use this information, and not re-calculate it. So, you cannot use " - "both --info and --l90") in err - -def test_parser_info_nbcont(capsys): +def test_info_and_lstfile(capsys): """ - Test that when run with --info and --nbcont x : error message - If we run from info file, will not touch the sequences. + Test that there is an error message if user gives both -l infofile and --info LSTINFO """ parser = argparse.ArgumentParser(description="Annotate all genomes", add_help=False) annot.build_parser(parser) with pytest.raises(SystemExit): - annot.parse(parser, "-l list_file -d dbpath -r respath -n name " - "--info infofile --nbcont 20".split()) + annot.parse(parser, "-d dbpath -r respath -n name --nbcont 20 -l toto --info info".split()) _, err = capsys.readouterr() - assert ("If you provide a list of genomes with their calculated L90 and number of contigs, " - "PanACoTA will use this information, and not re-calculate it. So, you cannot use " - "both --info and --nbcont") in err + assert ("Either you want to annotate raw sequences (name of files in '-l infofile') " + "which will first go through the QC process, " + "OR you already did QC on your sequences and just want to annotate them " + "(information on those sequences in '--info LSTINFO-file'). " + "Please choose one of these 2 possibilities.") in err def test_parser_noinfo_nolist(capsys):