From 0bf0538a9634e39b15cfd4cbbc2d4eb91cb46c49 Mon Sep 17 00:00:00 2001 From: Finlay Maguire Date: Fri, 25 Sep 2020 15:10:50 -0300 Subject: [PATCH] Add generic hamronize.py CLI parser that can parse any tool - Reorganise the repo to make it pip installable directly from git/conda - Gets rid of now redundant parsers - Updates test.sh to new parser format --- README.md | 6 ++ .../{hAMRonization => }/AbricateIO.py | 0 .../{hAMRonization => }/AmrFinderPlusIO.py | 0 .../{hAMRonization => }/AmrPlusPlusIO.py | 0 hAMRonization/{hAMRonization => }/AribaIO.py | 0 hAMRonization/{hAMRonization => }/CSStarIO.py | 0 .../{hAMRonization => }/DeepArgIO.py | 0 hAMRonization/{hAMRonization => }/GrootIO.py | 0 .../{hAMRonization => }/Interfaces.py | 71 ++++++++++++++++--- .../{hAMRonization => }/KmerResistanceIO.py | 0 hAMRonization/README.md | 0 .../{hAMRonization => }/ResFamsIO.py | 0 .../{hAMRonization => }/ResFinderIO.py | 0 hAMRonization/{hAMRonization => }/RgiIO.py | 0 hAMRonization/{hAMRonization => }/SraxIO.py | 0 hAMRonization/{hAMRonization => }/Srst2IO.py | 0 .../{hAMRonization => }/StarAmrIO.py | 0 hAMRonization/{hAMRonization => }/__init__.py | 20 ++++++ .../{hAMRonization => }/hAMRonizedResult.py | 0 hamronize.py | 8 +++ parsers/abricate_report_parser.py | 7 -- parsers/amrfinderplus_report_parser.py | 7 -- parsers/amrplusplus_report_parser.py | 7 -- parsers/ariba_report_parser.py | 7 -- parsers/csstar_report_parser.py | 7 -- parsers/deeparg_report_parser.py | 7 -- parsers/groot_report_parser.py | 7 -- parsers/hAMRonized_parser.py | 16 ----- parsers/kmerresistance_report_parser.py | 7 -- parsers/resfams_report_parser.py | 7 -- parsers/resfinder_report_parser.py | 7 -- parsers/rgi_report_parser.py | 7 -- parsers/srax_report_parser.py | 7 -- parsers/srst2_report_parser.py | 7 -- parsers/staramr_report_parser.py | 7 -- parsers/test.sh | 56 --------------- .../requirements.txt => requirements.txt | 0 hAMRonization/setup.py => setup.py | 0 test.sh | 48 +++++++++++++ 39 files changed, 143 insertions(+), 180 deletions(-) rename hAMRonization/{hAMRonization => }/AbricateIO.py (100%) rename hAMRonization/{hAMRonization => }/AmrFinderPlusIO.py (100%) rename hAMRonization/{hAMRonization => }/AmrPlusPlusIO.py (100%) rename hAMRonization/{hAMRonization => }/AribaIO.py (100%) rename hAMRonization/{hAMRonization => }/CSStarIO.py (100%) rename hAMRonization/{hAMRonization => }/DeepArgIO.py (100%) rename hAMRonization/{hAMRonization => }/GrootIO.py (100%) rename hAMRonization/{hAMRonization => }/Interfaces.py (67%) rename hAMRonization/{hAMRonization => }/KmerResistanceIO.py (100%) delete mode 100644 hAMRonization/README.md rename hAMRonization/{hAMRonization => }/ResFamsIO.py (100%) rename hAMRonization/{hAMRonization => }/ResFinderIO.py (100%) rename hAMRonization/{hAMRonization => }/RgiIO.py (100%) rename hAMRonization/{hAMRonization => }/SraxIO.py (100%) rename hAMRonization/{hAMRonization => }/Srst2IO.py (100%) rename hAMRonization/{hAMRonization => }/StarAmrIO.py (100%) rename hAMRonization/{hAMRonization => }/__init__.py (86%) rename hAMRonization/{hAMRonization => }/hAMRonizedResult.py (100%) create mode 100755 hamronize.py delete mode 100755 parsers/abricate_report_parser.py delete mode 100755 parsers/amrfinderplus_report_parser.py delete mode 100755 parsers/amrplusplus_report_parser.py delete mode 100755 parsers/ariba_report_parser.py delete mode 100755 parsers/csstar_report_parser.py delete mode 100755 parsers/deeparg_report_parser.py delete mode 100755 parsers/groot_report_parser.py delete mode 100755 parsers/hAMRonized_parser.py delete mode 100755 parsers/kmerresistance_report_parser.py delete mode 100755 parsers/resfams_report_parser.py delete mode 100755 parsers/resfinder_report_parser.py delete mode 100755 parsers/rgi_report_parser.py delete mode 100755 parsers/srax_report_parser.py delete mode 100755 parsers/srst2_report_parser.py delete mode 100755 parsers/staramr_report_parser.py delete mode 100644 parsers/test.sh rename hAMRonization/requirements.txt => requirements.txt (100%) rename hAMRonization/setup.py => setup.py (100%) create mode 100644 test.sh diff --git a/README.md b/README.md index 9587986..1df4d5d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ cd hAMRonization pip install -e . ``` +## Usage + +``` +python hamronize.py abricate ../test/data/raw_outputs/abricate/report.tsv --reference_database_version db_v_1 --analysis_software_version tool_v_1 --format json +``` + ## Parsers Parsers needing tested (both automated and just sanity checking output), see [test.sh](parsers/test.sh) for example invocations. diff --git a/hAMRonization/hAMRonization/AbricateIO.py b/hAMRonization/AbricateIO.py similarity index 100% rename from hAMRonization/hAMRonization/AbricateIO.py rename to hAMRonization/AbricateIO.py diff --git a/hAMRonization/hAMRonization/AmrFinderPlusIO.py b/hAMRonization/AmrFinderPlusIO.py similarity index 100% rename from hAMRonization/hAMRonization/AmrFinderPlusIO.py rename to hAMRonization/AmrFinderPlusIO.py diff --git a/hAMRonization/hAMRonization/AmrPlusPlusIO.py b/hAMRonization/AmrPlusPlusIO.py similarity index 100% rename from hAMRonization/hAMRonization/AmrPlusPlusIO.py rename to hAMRonization/AmrPlusPlusIO.py diff --git a/hAMRonization/hAMRonization/AribaIO.py b/hAMRonization/AribaIO.py similarity index 100% rename from hAMRonization/hAMRonization/AribaIO.py rename to hAMRonization/AribaIO.py diff --git a/hAMRonization/hAMRonization/CSStarIO.py b/hAMRonization/CSStarIO.py similarity index 100% rename from hAMRonization/hAMRonization/CSStarIO.py rename to hAMRonization/CSStarIO.py diff --git a/hAMRonization/hAMRonization/DeepArgIO.py b/hAMRonization/DeepArgIO.py similarity index 100% rename from hAMRonization/hAMRonization/DeepArgIO.py rename to hAMRonization/DeepArgIO.py diff --git a/hAMRonization/hAMRonization/GrootIO.py b/hAMRonization/GrootIO.py similarity index 100% rename from hAMRonization/hAMRonization/GrootIO.py rename to hAMRonization/GrootIO.py diff --git a/hAMRonization/hAMRonization/Interfaces.py b/hAMRonization/Interfaces.py similarity index 67% rename from hAMRonization/hAMRonization/Interfaces.py rename to hAMRonization/Interfaces.py index 8a85dde..0568fcb 100644 --- a/hAMRonization/hAMRonization/Interfaces.py +++ b/hAMRonization/Interfaces.py @@ -131,22 +131,73 @@ def write(self, output_location=None, output_format='tsv'): def cli_parser(analysis_tool): - parser = argparse.ArgumentParser(description=f"hAMRonization parser for {analysis_tool}") - parser.add_argument("report", help="Path to tool report") - parser.add_argument("--format", default="tsv", help="Output format (tsv or json)") - parser.add_argument("--output", default=None, help="Output location") + """ + Generate a command line hAMRonization tool for a specific tool + """ + parser = generic_parser(analysis_tool) + args = parser.parse_args() + metadata = {field: getattr(args, field) for field in required_mandatory_metadata} + + # parse report and write to specified + parsed_report = hAMRonization.parse(args.report, metadata, analysis_tool) + parsed_report.write(output_location=args.output, + output_format=args.format) + +def generate_tool_subparser(subparser, analysis_tool): + """ + Build the argument parser for a specific tool (used to generate a tool-specific + cli-parser and a generic tool parser) + """ + report_file = hAMRonization._ReportFileToUse[analysis_tool] + tool_parser = subparser.add_parser(analysis_tool, + description=f"Applies hAMRonization specification to output from {analysis_tool} ({report_file})", + usage=f"hamronize.py {analysis_tool} ", + help=f"hAMRonize {analysis_tool}'s output report i.e., {report_file}") + + tool_parser.add_argument("report", help="Path to tool report") + tool_parser.add_argument("--format", default="tsv", help="Output format (tsv or json)") + tool_parser.add_argument("--output", default=None, help="Output location") # any missing mandatory fields need supplied as CLI argument required_mandatory_metadata = hAMRonization._RequiredToolMetadata[analysis_tool] for field in required_mandatory_metadata: - parser.add_argument(f"--{field}", required=True, + tool_parser.add_argument(f"--{field}", required=True, help="Input string containing the " f"{field} " f"for {analysis_tool}") + return subparser + + +def generic_cli_interface(): + """ + Generate a generic tool report parser that passes to the tool specific + parser + """ + parser = argparse.ArgumentParser(description="Convert AMR gene detection tool output to hAMRonization specification format", + prog='hamronize', + usage='hamronize.py ') + + parser.add_argument('-v', '--version', action='version', + version=f"%(prog)s {hAMRonization.__version__}") + + + subparser = parser.add_subparsers(title="Tools with hAMRonizable reports", + help='', dest='analysis_tool') + + for analysis_tool in hAMRonization._RequiredToolMetadata.keys(): + subparser = generate_tool_subparser(subparser, analysis_tool) + args = parser.parse_args() - metadata = {field: getattr(args, field) for field in required_mandatory_metadata} - # parse report and write to specified - parsed_report = hAMRonization.parse(args.report, metadata, analysis_tool) - parsed_report.write(output_location=args.output, - output_format=args.format) + if args.analysis_tool: + required_mandatory_metadata = hAMRonization._RequiredToolMetadata[args.analysis_tool] + metadata = {field: getattr(args, field) for field in required_mandatory_metadata} + + # parse report and write to specified + parsed_report = hAMRonization.parse(args.report, metadata, args.analysis_tool) + parsed_report.write(output_location=args.output, + output_format=args.format) + else: + parser.print_help() + exit(1) + diff --git a/hAMRonization/hAMRonization/KmerResistanceIO.py b/hAMRonization/KmerResistanceIO.py similarity index 100% rename from hAMRonization/hAMRonization/KmerResistanceIO.py rename to hAMRonization/KmerResistanceIO.py diff --git a/hAMRonization/README.md b/hAMRonization/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/hAMRonization/hAMRonization/ResFamsIO.py b/hAMRonization/ResFamsIO.py similarity index 100% rename from hAMRonization/hAMRonization/ResFamsIO.py rename to hAMRonization/ResFamsIO.py diff --git a/hAMRonization/hAMRonization/ResFinderIO.py b/hAMRonization/ResFinderIO.py similarity index 100% rename from hAMRonization/hAMRonization/ResFinderIO.py rename to hAMRonization/ResFinderIO.py diff --git a/hAMRonization/hAMRonization/RgiIO.py b/hAMRonization/RgiIO.py similarity index 100% rename from hAMRonization/hAMRonization/RgiIO.py rename to hAMRonization/RgiIO.py diff --git a/hAMRonization/hAMRonization/SraxIO.py b/hAMRonization/SraxIO.py similarity index 100% rename from hAMRonization/hAMRonization/SraxIO.py rename to hAMRonization/SraxIO.py diff --git a/hAMRonization/hAMRonization/Srst2IO.py b/hAMRonization/Srst2IO.py similarity index 100% rename from hAMRonization/hAMRonization/Srst2IO.py rename to hAMRonization/Srst2IO.py diff --git a/hAMRonization/hAMRonization/StarAmrIO.py b/hAMRonization/StarAmrIO.py similarity index 100% rename from hAMRonization/hAMRonization/StarAmrIO.py rename to hAMRonization/StarAmrIO.py diff --git a/hAMRonization/hAMRonization/__init__.py b/hAMRonization/__init__.py similarity index 86% rename from hAMRonization/hAMRonization/__init__.py rename to hAMRonization/__init__.py index 1134cb7..c100634 100644 --- a/hAMRonization/hAMRonization/__init__.py +++ b/hAMRonization/__init__.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +__version__ = "1.0.0" + from hAMRonization.hAMRonizedResult import hAMRonizedResult from hAMRonization import AbricateIO @@ -35,6 +37,24 @@ "resfams": ResFamsIO.ResFamsIterator } +_ReportFileToUse = { + "abricate": "OUTPUT.tsv", + "amrfinderplus": "OUTPUT.tsv", + "ariba": "OUTDIR/OUTPUT.tsv", + "rgi": "OUTPUT.txt or OUTPUT_bwtoutput.gene_mapping_data.txt", + "resfinder": "data_resfinder.json", + "srax": "sraX_detected_ARGs.tsv", + "deeparg": "OUTDIR/OUTPUT.mapping.ARG", + "kmerresistance": "OUTPUT.KmerRes", + "srst2": "OUTPUT_srst2_report.tsv", + "groot": "OUTPUT.tsv (from `groot report`)", + "staramr": "resfinder.tsv", + "csstar": "OUTPUT.tsv", + "amrplusplus": "gene.tsv", + "resfams": "resfams.tblout" + } + + _RequiredToolMetadata = { "abricate": AbricateIO.required_metadata, "amrfinderplus": AmrFinderPlusIO.required_metadata, diff --git a/hAMRonization/hAMRonization/hAMRonizedResult.py b/hAMRonization/hAMRonizedResult.py similarity index 100% rename from hAMRonization/hAMRonization/hAMRonizedResult.py rename to hAMRonization/hAMRonizedResult.py diff --git a/hamronize.py b/hamronize.py new file mode 100755 index 0000000..8b49217 --- /dev/null +++ b/hamronize.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +import argparse +import hAMRonization + +if __name__ == '__main__': + + hAMRonization.Interfaces.generic_cli_interface() diff --git a/parsers/abricate_report_parser.py b/parsers/abricate_report_parser.py deleted file mode 100755 index 6f181f9..0000000 --- a/parsers/abricate_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('abricate') diff --git a/parsers/amrfinderplus_report_parser.py b/parsers/amrfinderplus_report_parser.py deleted file mode 100755 index 4ab1589..0000000 --- a/parsers/amrfinderplus_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == "__main__": - - Interfaces.cli_parser('amrfinderplus') diff --git a/parsers/amrplusplus_report_parser.py b/parsers/amrplusplus_report_parser.py deleted file mode 100755 index d1f8d75..0000000 --- a/parsers/amrplusplus_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('amrplusplus') diff --git a/parsers/ariba_report_parser.py b/parsers/ariba_report_parser.py deleted file mode 100755 index c4ab323..0000000 --- a/parsers/ariba_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('ariba') diff --git a/parsers/csstar_report_parser.py b/parsers/csstar_report_parser.py deleted file mode 100755 index 77e5686..0000000 --- a/parsers/csstar_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('csstar') diff --git a/parsers/deeparg_report_parser.py b/parsers/deeparg_report_parser.py deleted file mode 100755 index fdf4ffc..0000000 --- a/parsers/deeparg_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('deeparg') diff --git a/parsers/groot_report_parser.py b/parsers/groot_report_parser.py deleted file mode 100755 index 9d96f53..0000000 --- a/parsers/groot_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('groot') diff --git a/parsers/hAMRonized_parser.py b/parsers/hAMRonized_parser.py deleted file mode 100755 index f31a7d3..0000000 --- a/parsers/hAMRonized_parser.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -import argparse -import hAMRonization - -if __name__ == '__main__': - - parser = argparse.ArgumentParser(description="hAMRonization parser for " - "AMR gene detection") - parser.add_argument('tool', - help="AMR gene detection tool being parsed") - args = parser.parse_args() - if args.tool not in hAMRonization._RequiredToolMetadata: - raise ValueError(f"Tool ({args.tool} must in {hAMRonization._RequiredToolMetadata}") - - hAMRonization.Interfaces.cli_parser(args.tool) diff --git a/parsers/kmerresistance_report_parser.py b/parsers/kmerresistance_report_parser.py deleted file mode 100755 index 43b497e..0000000 --- a/parsers/kmerresistance_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('kmerresistance') diff --git a/parsers/resfams_report_parser.py b/parsers/resfams_report_parser.py deleted file mode 100755 index eaeb387..0000000 --- a/parsers/resfams_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('resfams') diff --git a/parsers/resfinder_report_parser.py b/parsers/resfinder_report_parser.py deleted file mode 100755 index 05a8f18..0000000 --- a/parsers/resfinder_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('resfinder') diff --git a/parsers/rgi_report_parser.py b/parsers/rgi_report_parser.py deleted file mode 100755 index f6a4874..0000000 --- a/parsers/rgi_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('rgi') diff --git a/parsers/srax_report_parser.py b/parsers/srax_report_parser.py deleted file mode 100755 index 000cfb4..0000000 --- a/parsers/srax_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('srax') diff --git a/parsers/srst2_report_parser.py b/parsers/srst2_report_parser.py deleted file mode 100755 index fbfbcd4..0000000 --- a/parsers/srst2_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('srst2') diff --git a/parsers/staramr_report_parser.py b/parsers/staramr_report_parser.py deleted file mode 100755 index 16bb791..0000000 --- a/parsers/staramr_report_parser.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -from hAMRonization import Interfaces - -if __name__ == '__main__': - - Interfaces.cli_parser('staramr') diff --git a/parsers/test.sh b/parsers/test.sh deleted file mode 100644 index e3afd1e..0000000 --- a/parsers/test.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -e - -python abricate_report_parser.py ../test/data/raw_outputs/abricate/report.tsv --reference_database_version db_v_1 --analysis_software_version tool_v_1 --format json -python abricate_report_parser.py ../test/data/raw_outputs/abricate/report.tsv --reference_database_version db_v_1 --analysis_software_version tool_v_1 --format tsv - -python ariba_report_parser.py ../test/data/raw_outputs/ariba/report.tsv --reference_database_version db_v_1 --reference_database_id dbname --input_file_name ariba_report --analysis_software_version ariba_v1 --format json -python ariba_report_parser.py ../test/data/raw_outputs/ariba/report.tsv --reference_database_version db_v_1 --reference_database_id dbname --input_file_name ariba_report --analysis_software_version ariba_v1 --format tsv - -python amrfinderplus_report_parser.py --input_file_name amrfinderplus_nucleotide_report --analysis_software_version AFP_nt_v1 --reference_database_version db_v_1 ../test/data/raw_outputs/amrfinder/report_nucleotide.tsv --format json -python amrfinderplus_report_parser.py --input_file_name amrfinderplus_nucleotide_report --analysis_software_version AFP_nt_v1 --reference_database_version db_v_1 ../test/data/raw_outputs/amrfinder/report_nucleotide.tsv --format tsv -python amrfinderplus_report_parser.py --input_file_name amrfinderplus_portein_report --analysis_software_version AFP_aa_v1 --reference_database_version db_v_1 ../test/data/raw_outputs/amrfinder/report_protein.tsv --format json -python amrfinderplus_report_parser.py --input_file_name amrfinderplus_portein_report --analysis_software_version AFP_aa_v1 --reference_database_version db_v_1 ../test/data/raw_outputs/amrfinder/report_protein.tsv --format tsv - -python rgi_report_parser.py --input_file_name rgi_report --analysis_software_version rgi_v1 --reference_database_version card_v1 ../test/data/raw_outputs/rgi/rgi.txt --format json -python rgi_report_parser.py --input_file_name rgi_report --analysis_software_version rgi_v1 --reference_database_version card_v1 ../test/data/raw_outputs/rgi/rgi.txt --format tsv -python rgi_report_parser.py --input_file_name rgi_bwt_report --analysis_software_version rgi_bwt_v1 --reference_database_version card_v1 ../test/data/raw_outputs/rgibwt/Kp11_bwtoutput.gene_mapping_data.txt --format json -python rgi_report_parser.py --input_file_name rgi_bwt_report --analysis_software_version rgi_bwt_v1 --reference_database_version card_v1 ../test/data/raw_outputs/rgibwt/Kp11_bwtoutput.gene_mapping_data.txt --format tsv - - -python resfinder_report_parser.py --analysis_software_version resfinder_v1 --reference_database_version resfinder_db_v1 ../test/data/raw_outputs/resfinder/data_resfinder.json --format json -python resfinder_report_parser.py --analysis_software_version resfinder_v1 --reference_database_version resfinder_db_v1 ../test/data/raw_outputs/resfinder/data_resfinder.json --format tsv - - -python srax_report_parser.py --reference_database_id srax_default --input_file_name srax_report --reference_database_version srax_db_v1 --analysis_software_version srax_v1 --format json ../test/data/raw_outputs/srax/sraX_detected_ARGs.tsv -python srax_report_parser.py --reference_database_id srax_default --input_file_name srax_report --reference_database_version srax_db_v1 --analysis_software_version srax_v1 --format tsv ../test/data/raw_outputs/srax/sraX_detected_ARGs.tsv - -python deeparg_report_parser.py --input_file_name deeparg_report --analysis_software_version deeparg_v1 --reference_database_version deeparg_db_v1 ../test/data/raw_outputs/deeparg/output.mapping.ARG --format json -python deeparg_report_parser.py --input_file_name deeparg_report --analysis_software_version deeparg_v1 --reference_database_version deeparg_db_v1 ../test/data/raw_outputs/deeparg/output.mapping.ARG --format tsv - -python kmerresistance_report_parser.py ../test/data/raw_outputs/kmerresistance/results.res --analysis_software_version kmerresistance_v1 --reference_database_version resfinder_db_v1 --input_file_name kmerresistance_report --format json -python kmerresistance_report_parser.py ../test/data/raw_outputs/kmerresistance/results.res --analysis_software_version kmerresistance_v1 --reference_database_version resfinder_db_v1 --input_file_name kmerresistance_report --format tsv - - -python srst2_report_parser.py ../test/data/SAMN13064234_srst2_report.tsv --input_file_name srst2_report --analysis_software_version srst2_v2 --reference_database_version srst2_db_v1 --reference_database_id argannot --format json -python srst2_report_parser.py ../test/data/SAMN13064234_srst2_report.tsv --input_file_name srst2_report --analysis_software_version srst2_v2 --reference_database_version srst2_db_v1 --reference_database_id argannot --format tsv - -python amrplusplus_report_parser.py --input_file_name amrplusplus_report --analysis_software_version amrplusplus_v1 --reference_database_version megares_v1 ../test/data/raw_outputs/amrplusplus/gene.tsv --format json -python amrplusplus_report_parser.py --input_file_name amrplusplus_report --analysis_software_version amrplusplus_v1 --reference_database_version megares_v1 ../test/data/raw_outputs/amrplusplus/gene.tsv --format tsv - - -python resfams_report_parser.py --input_file_name resfams_report --reference_database_version resfams_db_v1 --analysis_software_version resfams_v1 ../test/data/raw_outputs/resfams/resfams.tblout --format json -python resfams_report_parser.py --input_file_name resfams_report --reference_database_version resfams_db_v1 --analysis_software_version resfams_v1 ../test/data/raw_outputs/resfams/resfams.tblout --format tsv - - -python csstar_report_parser.py --reference_database_version sstar_db_v1 --analysis_software_version csstar_v1 --reference_database_id sstar_db --input_file_name csstar_report ../test/data/raw_outputs/sstar/report.tsv --format json -python csstar_report_parser.py --reference_database_version sstar_db_v1 --analysis_software_version csstar_v1 --reference_database_id sstar_db --input_file_name csstar_report ../test/data/raw_outputs/sstar/report.tsv --format tsv - - -python staramr_report_parser.py --analysis_software_version staramr_v1 --reference_database_version staramr_db_v1 ../test/data/raw_outputs/staramr/resfinder.tsv --format json -python staramr_report_parser.py --analysis_software_version staramr_v1 --reference_database_version staramr_db_v1 ../test/data/raw_outputs/staramr/resfinder.tsv --format tsv - - -python groot_report_parser.py --analysis_software_version groot_v1 --reference_database_id card --reference_database_version card_v1 --input_file_name groot_report ../test/data/raw_outputs/groot/report.tsv --format json -python groot_report_parser.py --analysis_software_version groot_v1 --reference_database_id card --reference_database_version card_v1 --input_file_name groot_report ../test/data/raw_outputs/groot/report.tsv --format tsv - diff --git a/hAMRonization/requirements.txt b/requirements.txt similarity index 100% rename from hAMRonization/requirements.txt rename to requirements.txt diff --git a/hAMRonization/setup.py b/setup.py similarity index 100% rename from hAMRonization/setup.py rename to setup.py diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..40a8ad8 --- /dev/null +++ b/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +python hamronize.py abricate test/data/raw_outputs/abricate/report.tsv --reference_database_version db_v_1 --analysis_software_version tool_v_1 --format json +python hamronize.py abricate test/data/raw_outputs/abricate/report.tsv --reference_database_version db_v_1 --analysis_software_version tool_v_1 --format tsv + +python hamronize.py ariba test/data/raw_outputs/ariba/report.tsv --reference_database_version db_v_1 --reference_database_id dbname --input_file_name ariba_report --analysis_software_version ariba_v1 --format json +python hamronize.py ariba test/data/raw_outputs/ariba/report.tsv --reference_database_version db_v_1 --reference_database_id dbname --input_file_name ariba_report --analysis_software_version ariba_v1 --format tsv + +python hamronize.py amrfinderplus --input_file_name amrfinderplus_nucleotide_report --analysis_software_version AFP_nt_v1 --reference_database_version db_v_1 test/data/raw_outputs/amrfinder/report_nucleotide.tsv --format json +python hamronize.py amrfinderplus --input_file_name amrfinderplus_nucleotide_report --analysis_software_version AFP_nt_v1 --reference_database_version db_v_1 test/data/raw_outputs/amrfinder/report_nucleotide.tsv --format tsv +python hamronize.py amrfinderplus --input_file_name amrfinderplus_portein_report --analysis_software_version AFP_aa_v1 --reference_database_version db_v_1 test/data/raw_outputs/amrfinder/report_protein.tsv --format json +python hamronize.py amrfinderplus --input_file_name amrfinderplus_portein_report --analysis_software_version AFP_aa_v1 --reference_database_version db_v_1 test/data/raw_outputs/amrfinder/report_protein.tsv --format tsv + +python hamronize.py rgi --input_file_name rgi_report --analysis_software_version rgi_v1 --reference_database_version card_v1 test/data/raw_outputs/rgi/rgi.txt --format json +python hamronize.py rgi --input_file_name rgi_report --analysis_software_version rgi_v1 --reference_database_version card_v1 test/data/raw_outputs/rgi/rgi.txt --format tsv +python hamronize.py rgi --input_file_name rgi_bwt_report --analysis_software_version rgi_bwt_v1 --reference_database_version card_v1 test/data/raw_outputs/rgibwt/Kp11_bwtoutput.gene_mapping_data.txt --format json +python hamronize.py rgi --input_file_name rgi_bwt_report --analysis_software_version rgi_bwt_v1 --reference_database_version card_v1 test/data/raw_outputs/rgibwt/Kp11_bwtoutput.gene_mapping_data.txt --format tsv + +python hamronize.py resfinder --analysis_software_version resfinder_v1 --reference_database_version resfinder_db_v1 test/data/raw_outputs/resfinder/data_resfinder.json --format json +python hamronize.py resfinder --analysis_software_version resfinder_v1 --reference_database_version resfinder_db_v1 test/data/raw_outputs/resfinder/data_resfinder.json --format tsv + +python hamronize.py srax --reference_database_id srax_default --input_file_name srax_report --reference_database_version srax_db_v1 --analysis_software_version srax_v1 --format json test/data/raw_outputs/srax/sraX_detected_ARGs.tsv +python hamronize.py srax --reference_database_id srax_default --input_file_name srax_report --reference_database_version srax_db_v1 --analysis_software_version srax_v1 --format tsv test/data/raw_outputs/srax/sraX_detected_ARGs.tsv + +python hamronize.py deeparg --input_file_name deeparg_report --analysis_software_version deeparg_v1 --reference_database_version deeparg_db_v1 test/data/raw_outputs/deeparg/output.mapping.ARG --format json +python hamronize.py deeparg --input_file_name deeparg_report --analysis_software_version deeparg_v1 --reference_database_version deeparg_db_v1 test/data/raw_outputs/deeparg/output.mapping.ARG --format tsv + +python hamronize.py kmerresistance test/data/raw_outputs/kmerresistance/results.res --analysis_software_version kmerresistance_v1 --reference_database_version resfinder_db_v1 --input_file_name kmerresistance_report --format json +python hamronize.py kmerresistance test/data/raw_outputs/kmerresistance/results.res --analysis_software_version kmerresistance_v1 --reference_database_version resfinder_db_v1 --input_file_name kmerresistance_report --format tsv + +python hamronize.py srst2 test/data/SAMN13064234_srst2_report.tsv --input_file_name srst2_report --analysis_software_version srst2_v2 --reference_database_version srst2_db_v1 --reference_database_id argannot --format json +python hamronize.py srst2 test/data/SAMN13064234_srst2_report.tsv --input_file_name srst2_report --analysis_software_version srst2_v2 --reference_database_version srst2_db_v1 --reference_database_id argannot --format tsv + +python hamronize.py amrplusplus --input_file_name amrplusplus_report --analysis_software_version amrplusplus_v1 --reference_database_version megares_v1 test/data/raw_outputs/amrplusplus/gene.tsv --format json +python hamronize.py amrplusplus --input_file_name amrplusplus_report --analysis_software_version amrplusplus_v1 --reference_database_version megares_v1 test/data/raw_outputs/amrplusplus/gene.tsv --format tsv + +python hamronize.py resfams --input_file_name resfams_report --reference_database_version resfams_db_v1 --analysis_software_version resfams_v1 test/data/raw_outputs/resfams/resfams.tblout --format json +python hamronize.py resfams --input_file_name resfams_report --reference_database_version resfams_db_v1 --analysis_software_version resfams_v1 test/data/raw_outputs/resfams/resfams.tblout --format tsv + +python hamronize.py csstar --reference_database_version sstar_db_v1 --analysis_software_version csstar_v1 --reference_database_id sstar_db --input_file_name csstar_report test/data/raw_outputs/sstar/report.tsv --format json +python hamronize.py csstar --reference_database_version sstar_db_v1 --analysis_software_version csstar_v1 --reference_database_id sstar_db --input_file_name csstar_report test/data/raw_outputs/sstar/report.tsv --format tsv + +python hamronize.py staramr --analysis_software_version staramr_v1 --reference_database_version staramr_db_v1 test/data/raw_outputs/staramr/resfinder.tsv --format json +python hamronize.py staramr --analysis_software_version staramr_v1 --reference_database_version staramr_db_v1 test/data/raw_outputs/staramr/resfinder.tsv --format tsv + +python hamronize.py groot --analysis_software_version groot_v1 --reference_database_id card --reference_database_version card_v1 --input_file_name groot_report test/data/raw_outputs/groot/report.tsv --format json +python hamronize.py groot --analysis_software_version groot_v1 --reference_database_id card --reference_database_version card_v1 --input_file_name groot_report test/data/raw_outputs/groot/report.tsv --format tsv