Added untested partial matching
This commit is contained in:
parent
f20a656f45
commit
e634647774
@ -4,7 +4,7 @@ import datetime
|
|||||||
from os import path
|
from os import path
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from automlst.cli import info, type
|
from automlst.cli import info, st
|
||||||
from automlst.cli.meta import get_module_base_name
|
from automlst.cli.meta import get_module_base_name
|
||||||
from automlst.engine.data.genomics import NamedString
|
from automlst.engine.data.genomics import NamedString
|
||||||
from automlst.engine.local.abif import read_abif
|
from automlst.engine.local.abif import read_abif
|
||||||
@ -16,7 +16,7 @@ root_parser = argparse.ArgumentParser()
|
|||||||
subparsers = root_parser.add_subparsers(required=True)
|
subparsers = root_parser.add_subparsers(required=True)
|
||||||
|
|
||||||
info.setup_parser(subparsers.add_parser(get_module_base_name(info.__name__)))
|
info.setup_parser(subparsers.add_parser(get_module_base_name(info.__name__)))
|
||||||
type.setup_parser(subparsers.add_parser(get_module_base_name(type.__name__)))
|
st.setup_parser(subparsers.add_parser(get_module_base_name(st.__name__)))
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
@ -38,17 +38,27 @@ def setup_parser(parser: ArgumentParser):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--exact", "-ex",
|
"--exact", "-ex",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
dest="exact",
|
||||||
required=False,
|
required=False,
|
||||||
default=False,
|
default=False,
|
||||||
help="Should run exact matching rather than returning all similar ones"
|
help="Should run exact matching rather than returning all similar ones"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--stop-on-fail", "-sof",
|
||||||
|
action="store_true",
|
||||||
|
dest="stop_on_fail",
|
||||||
|
required=False,
|
||||||
|
default=False,
|
||||||
|
help="Should the algorithm stop in the case there are no matches (or partial matches when expecting exact matches)."
|
||||||
|
)
|
||||||
parser.set_defaults(func=run_asynchronously)
|
parser.set_defaults(func=run_asynchronously)
|
||||||
|
|
||||||
async def run(args):
|
async def run(args):
|
||||||
async with BIGSdbIndex() as bigsdb_index:
|
async with BIGSdbIndex() as bigsdb_index:
|
||||||
gen_strings = read_multiple_fastas(args.fastas)
|
gen_strings = read_multiple_fastas(args.fastas)
|
||||||
async with await bigsdb_index.build_profiler_from_seqdefdb(args.seqdefdb, args.schema) as mlst_profiler:
|
async with await bigsdb_index.build_profiler_from_seqdefdb(args.seqdefdb, args.schema) as mlst_profiler:
|
||||||
mlst_profiles = mlst_profiler.profile_multiple_strings(gen_strings)
|
mlst_profiles = mlst_profiler.profile_multiple_strings(gen_strings, exact=args.exact)
|
||||||
failed = await write_mlst_profiles_as_csv(mlst_profiles, args.out)
|
failed = await write_mlst_profiles_as_csv(mlst_profiles, args.out)
|
||||||
if len(failed) > 0:
|
if len(failed) > 0:
|
||||||
print(f"A total of {len(failed)} IDs failed:\n{"\n".join(failed)}")
|
print(f"A total of {len(failed)} IDs failed:\n{"\n".join(failed)}")
|
Loading…
x
Reference in New Issue
Block a user