From 48913d138568c797913845cc45854b6c8a96b730 Mon Sep 17 00:00:00 2001 From: Felipe Almeida Date: Sat, 28 Oct 2023 12:54:23 -0300 Subject: [PATCH 1/4] updated help --- docs/align2subsetgbk_help.txt | 50 ++++++++++++++++++++++++++++++----- docs/help_message.txt | 31 +++++++++++++++++----- docs/splitgbk_help.txt | 44 +++++++++++++++++++++++++----- docs/tsv2markdown_help.txt | 46 +++++++++++++++++++++++++++----- 4 files changed, 147 insertions(+), 24 deletions(-) diff --git a/docs/align2subsetgbk_help.txt b/docs/align2subsetgbk_help.txt index 087e990..769c2b2 100644 --- a/docs/align2subsetgbk_help.txt +++ b/docs/align2subsetgbk_help.txt @@ -1,6 +1,44 @@ -Traceback (most recent call last): - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida-py-runner.py", line 18, in - from falmeida_py.__main__ import main - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida_py/__main__.py", line 47, in - from docopt import docopt -ModuleNotFoundError: No module named 'docopt' +A script meant to subset a genbank annotation file based on alignments against a query (Nucleotide) FASTA file + +--- +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +Usage: + falmeida-py align2subsetgbk [ -h|--help ] + falmeida-py align2subsetgbk [ --gbk --fasta --out --minid --mincov --culling_limit --extension ] + +Options: + -h --help Show this screen. + -g --gbk= Gbk file for subset + -f --fasta= FASTA (nucl) file for querying the gbk + -o --out= Gbk filtered output file [Default: out.gbk]. + --extension= Base pair length to extend the flank regions in the alignment [Default: 0]. + --minid= Min. Identity percentage for gene annotation [Default: 80]. + --mincov= Min. Covereage for gene annotation [Default: 80]. + --culling_limit= Blast culling_limit for best hit only [Default: 1]. +falmeida-py: a package to the simple distribution of my custom scripts. + +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py [ -h|--help ] [ -v|--version ] [ --license ] + falmeida-py [ -h|--help ] [ ... ] + +options: + -h --help Show this screen + -v --version Show version information + --license Show LEGAL LICENSE information + +commands: + tsv2markdown Command for rapid convertion of tsv or csv to markdown tables. + splitgbk Command to split multisequence genbank files into individual files. + align2subsetgbk Command to subset genbank files based on alignments to a FASTA file. + gbk2fasta Command to convert genbank files to fasta files. + blasts Command to execute automatized blast commands. + replace_fasta_seq Command to replace strings in a FASTA using defitinitions from a BED file + mpgap2csv Command to summarize main mpgap multiqc assembly statistics into a CSV file + bacannot2json Command to summarize main bacannot annotation results into JSON file + +Use: `falmeida-py -h` to get more help and see examples. diff --git a/docs/help_message.txt b/docs/help_message.txt index 087e990..6ed5318 100644 --- a/docs/help_message.txt +++ b/docs/help_message.txt @@ -1,6 +1,25 @@ -Traceback (most recent call last): - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida-py-runner.py", line 18, in - from falmeida_py.__main__ import main - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida_py/__main__.py", line 47, in - from docopt import docopt -ModuleNotFoundError: No module named 'docopt' +falmeida-py: a package to the simple distribution of my custom scripts. + +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py [ -h|--help ] [ -v|--version ] [ --license ] + falmeida-py [ -h|--help ] [ ... ] + +options: + -h --help Show this screen + -v --version Show version information + --license Show LEGAL LICENSE information + +commands: + tsv2markdown Command for rapid convertion of tsv or csv to markdown tables. + splitgbk Command to split multisequence genbank files into individual files. + align2subsetgbk Command to subset genbank files based on alignments to a FASTA file. + gbk2fasta Command to convert genbank files to fasta files. + blasts Command to execute automatized blast commands. + replace_fasta_seq Command to replace strings in a FASTA using defitinitions from a BED file + mpgap2csv Command to summarize main mpgap multiqc assembly statistics into a CSV file + bacannot2json Command to summarize main bacannot annotation results into JSON file + +Use: `falmeida-py -h` to get more help and see examples. diff --git a/docs/splitgbk_help.txt b/docs/splitgbk_help.txt index 087e990..f139033 100644 --- a/docs/splitgbk_help.txt +++ b/docs/splitgbk_help.txt @@ -1,6 +1,38 @@ -Traceback (most recent call last): - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida-py-runner.py", line 18, in - from falmeida_py.__main__ import main - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida_py/__main__.py", line 47, in - from docopt import docopt -ModuleNotFoundError: No module named 'docopt' +A very simple script to split multisequence genbank files into separate files +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py splitgbk + falmeida-py splitgbk [ -h|--help ] + falmeida-py splitgbk [ --gbk ] [ --outdir ] + +options: + -h --help Show this screen. + -g --gbk= Input genbank file to split into multiple individual files. + -o --outdir= Directory (must already exist) in which to write the splitted files [Default: ./]. +falmeida-py: a package to the simple distribution of my custom scripts. + +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py [ -h|--help ] [ -v|--version ] [ --license ] + falmeida-py [ -h|--help ] [ ... ] + +options: + -h --help Show this screen + -v --version Show version information + --license Show LEGAL LICENSE information + +commands: + tsv2markdown Command for rapid convertion of tsv or csv to markdown tables. + splitgbk Command to split multisequence genbank files into individual files. + align2subsetgbk Command to subset genbank files based on alignments to a FASTA file. + gbk2fasta Command to convert genbank files to fasta files. + blasts Command to execute automatized blast commands. + replace_fasta_seq Command to replace strings in a FASTA using defitinitions from a BED file + mpgap2csv Command to summarize main mpgap multiqc assembly statistics into a CSV file + bacannot2json Command to summarize main bacannot annotation results into JSON file + +Use: `falmeida-py -h` to get more help and see examples. diff --git a/docs/tsv2markdown_help.txt b/docs/tsv2markdown_help.txt index 087e990..0b2b685 100644 --- a/docs/tsv2markdown_help.txt +++ b/docs/tsv2markdown_help.txt @@ -1,6 +1,40 @@ -Traceback (most recent call last): - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida-py-runner.py", line 18, in - from falmeida_py.__main__ import main - File "/home/falmeida/Documents/GitHub/pythonScripts/falmeida_py/__main__.py", line 47, in - from docopt import docopt -ModuleNotFoundError: No module named 'docopt' +A simple script to convert tsv (or csv) files to markdown tables using tabulate! +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py tsv2markdown + falmeida-py tsv2markdown [ -h|--help ] + falmeida-py tsv2markdown [ --tsv --csv --header ] + +options: + -h --help Show this screen. + --tsv= Input tsv file to print as markdown table + --csv= Input csv file to print as markdown table + --header= If file does not have a header, set a + custom header. E.g. --header "Planet,R (km),mass (x 10^29 kg)". +falmeida-py: a package to the simple distribution of my custom scripts. + +Copyright (C) 2020 Felipe Marques de Almeida (almeidafmarques@gmail.com) +License: Public Domain + +usage: + falmeida-py [ -h|--help ] [ -v|--version ] [ --license ] + falmeida-py [ -h|--help ] [ ... ] + +options: + -h --help Show this screen + -v --version Show version information + --license Show LEGAL LICENSE information + +commands: + tsv2markdown Command for rapid convertion of tsv or csv to markdown tables. + splitgbk Command to split multisequence genbank files into individual files. + align2subsetgbk Command to subset genbank files based on alignments to a FASTA file. + gbk2fasta Command to convert genbank files to fasta files. + blasts Command to execute automatized blast commands. + replace_fasta_seq Command to replace strings in a FASTA using defitinitions from a BED file + mpgap2csv Command to summarize main mpgap multiqc assembly statistics into a CSV file + bacannot2json Command to summarize main bacannot annotation results into JSON file + +Use: `falmeida-py -h` to get more help and see examples. From 705250f2e0b0c20a5ec1094de84979aad07290f8 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Fri, 3 Nov 2023 13:53:34 -0400 Subject: [PATCH 2/4] Update resistance_function.py --- falmeida_py/resistance_function.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/falmeida_py/resistance_function.py b/falmeida_py/resistance_function.py index 3e1649e..4b92adb 100644 --- a/falmeida_py/resistance_function.py +++ b/falmeida_py/resistance_function.py @@ -130,10 +130,13 @@ def resistance_stats(bacannot_summary): # # check for rgi orthologies # - if gene in bacannot_summary[sample]['resistance']['rgi']: - bacannot_summary[sample]['resistance']['amrfinderplus'][gene]['card_aro'] = bacannot_summary[sample]['resistance']['rgi'][gene]['card_aro'] - else: - bacannot_summary[sample]['resistance']['amrfinderplus'][gene]['card_aro'] = None + try: + if gene in bacannot_summary[sample]['resistance']['rgi']: + bacannot_summary[sample]['resistance']['amrfinderplus'][gene]['card_aro'] = bacannot_summary[sample]['resistance']['rgi'][gene]['card_aro'] + else: + bacannot_summary[sample]['resistance']['amrfinderplus'][gene]['card_aro'] = None + except: + bacannot_summary[sample]['resistance']['amrfinderplus'][gene]['card_aro'] = None ################# ### resfinder ### From c03b9f0753d51c0c698fec125822a72a9c0766da Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Fri, 3 Nov 2023 13:56:22 -0400 Subject: [PATCH 3/4] Update resistance_function.py --- falmeida_py/resistance_function.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/falmeida_py/resistance_function.py b/falmeida_py/resistance_function.py index 4b92adb..7f7ff01 100644 --- a/falmeida_py/resistance_function.py +++ b/falmeida_py/resistance_function.py @@ -180,7 +180,10 @@ def resistance_stats(bacannot_summary): # # check for rgi orthologies # - if gene in bacannot_summary[sample]['resistance']['rgi']: - bacannot_summary[sample]['resistance']['resfinder'][gene]['card_aro'] = bacannot_summary[sample]['resistance']['rgi'][gene]['card_aro'] - else: - bacannot_summary[sample]['resistance']['resfinder'][gene]['card_aro'] = None + try: + if gene in bacannot_summary[sample]['resistance']['rgi']: + bacannot_summary[sample]['resistance']['resfinder'][gene]['card_aro'] = bacannot_summary[sample]['resistance']['rgi'][gene]['card_aro'] + else: + bacannot_summary[sample]['resistance']['resfinder'][gene]['card_aro'] = None + except: + bacannot_summary[sample]['resistance']['resfinder'][gene]['card_aro'] = None From 183693638254cb81c2865b202d76c31e83144fc2 Mon Sep 17 00:00:00 2001 From: Felipe Almeida Date: Tue, 7 Nov 2023 13:05:40 -0300 Subject: [PATCH 4/4] Fix help message --- falmeida_py/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/falmeida_py/__main__.py b/falmeida_py/__main__.py index 85208f7..4b94bba 100644 --- a/falmeida_py/__main__.py +++ b/falmeida_py/__main__.py @@ -241,8 +241,8 @@ def main(): ####################################### ### Without commands nor parameters ### ####################################### - else: - print(usage.strip()) + elif not arguments['']: + print(usage.strip()) ## Calling main if __name__ == '__main__':