From fe35cfbfe1ef71c0c91768707815c259fe78cb55 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:11:45 +0100 Subject: [PATCH 01/11] Update test_checkm.py Fix indentation --- test/scripts/test_checkm.py | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/test/scripts/test_checkm.py b/test/scripts/test_checkm.py index 37706f1..25541a1 100755 --- a/test/scripts/test_checkm.py +++ b/test/scripts/test_checkm.py @@ -7,45 +7,43 @@ import errno if len(sys.argv) == 1: - print "Please provide a filename" - sys.exit() + print "Please provide a filename" + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['checkm'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['checkm'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - checkm = p1.communicate() - output = checkm[0] - error = checkm[1] + # Run the command + checkm = p1.communicate() + output = checkm[0] + error = checkm[1] except OSError as o: - f.write('OSError: make sure checkM is installed properly' + '\n') - f.close() - sys.exit() + f.write('OSError: make sure checkM is installed properly' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run checkM' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run checkM' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error == '': - f.write('CheckM ran without problems' + '\n') -else : - f.write('CheckM ran with some errors: ' + error + '\n') + f.write('CheckM ran without problems' + '\n') +else: + f.write('CheckM ran with some errors: ' + error + '\n') f.close() - - From 1aac9e0d22ab81f8f60c1630e06b071b4272dcb1 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:13:56 +0100 Subject: [PATCH 02/11] Update test_checkm_plus.py Fix indentation --- test/scripts/test_checkm_plus.py | 45 +++++++++++++++----------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/test/scripts/test_checkm_plus.py b/test/scripts/test_checkm_plus.py index ef2520f..3ad0288 100755 --- a/test/scripts/test_checkm_plus.py +++ b/test/scripts/test_checkm_plus.py @@ -7,46 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run add_tax.py try: - p1 = subprocess.Popen(['scripts/add_tax.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['scripts/add_tax.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - addtax = p1.communicate() - output = addtax[0] - error = addtax[1] + # Run the command + addtax = p1.communicate() + output = addtax[0] + error = addtax[1] except OSError as o: - f.write('OSError: is scripts/add_tax.py in your PATH?' + '\n') - f.close() - sys.exit() + f.write('OSError: is scripts/add_tax.py in your PATH?' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run scripts/add_tax.py' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run scripts/add_tax.py' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding) == '': - f.write('scripts/add_tax.py ran without problems' + '\n') + f.write('scripts/add_tax.py ran without problems' + '\n') else: - f.write('scripts/add_tax.py ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') + f.write('scripts/add_tax.py ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - f.close() - - From a5dcd6676dbb2a82fee6bdf865cade0883f8105b Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:17:09 +0100 Subject: [PATCH 03/11] Update test_diamond.py Fix indentation --- test/scripts/test_diamond.py | 47 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/test/scripts/test_diamond.py b/test/scripts/test_diamond.py index aef7a6e..ddf480a 100755 --- a/test/scripts/test_diamond.py +++ b/test/scripts/test_diamond.py @@ -7,46 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['diamond','help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['diamond','help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: make sure DIAMOND is installed properly' + '\n') - f.close() - sys.exit() + f.write('OSError: make sure DIAMOND is installed properly' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run DIAMOND' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run DIAMOND' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding) == '': - f.write('DIAMOND ran without problems' + '\n') -else : - f.write('DIAMOND ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') + f.write('DIAMOND ran without problems' + '\n') +else: + f.write('DIAMOND ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - f.close() - - From 0e10ece494507b221012a4a75de128a43d6c3951 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:17:51 +0100 Subject: [PATCH 04/11] Update test_checkm.py Fix wrong indentation for raise --- test/scripts/test_checkm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scripts/test_checkm.py b/test/scripts/test_checkm.py index 25541a1..1831b6c 100755 --- a/test/scripts/test_checkm.py +++ b/test/scripts/test_checkm.py @@ -19,7 +19,7 @@ os.makedirs(os.path.dirname(outfile)) except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIST: - raise + raise f = open(outfile, 'w+') From dd3c24c5cf669401028d7d0ed437c33c01048566 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:18:29 +0100 Subject: [PATCH 05/11] Update test_checkm_plus.py Fix wrong indentation for raise --- test/scripts/test_checkm_plus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scripts/test_checkm_plus.py b/test/scripts/test_checkm_plus.py index 3ad0288..574c8a8 100755 --- a/test/scripts/test_checkm_plus.py +++ b/test/scripts/test_checkm_plus.py @@ -19,7 +19,7 @@ os.makedirs(os.path.dirname(outfile)) except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIST: - raise + raise f = open(outfile, 'w+') From 242c685e460dd14f4227d029fddd9d0804571428 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:20:03 +0100 Subject: [PATCH 06/11] Update test_diamond_bin_summary_plus.py Fix indentation --- test/scripts/test_diamond_bin_summary_plus.py | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/test/scripts/test_diamond_bin_summary_plus.py b/test/scripts/test_diamond_bin_summary_plus.py index 54d9306..fdabeaf 100755 --- a/test/scripts/test_diamond_bin_summary_plus.py +++ b/test/scripts/test_diamond_bin_summary_plus.py @@ -7,45 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['scripts/add_tax_diamond.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['scripts/add_tax_diamond.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: is scripts/add_tax_diamond.py in your PATH?' + '\n') - f.close() - sys.exit() + f.write('OSError: is scripts/add_tax_diamond.py in your PATH?' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run scripts/add_tax_diamond.py' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run scripts/add_tax_diamond.py' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding) == '': - f.write('scripts/add_tax_diamond.py ran without problems' + '\n') -else : - f.write('scripts/add_tax_diamond.py ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') + f.write('scripts/add_tax_diamond.py ran without problems' + '\n') +else: + f.write('scripts/add_tax_diamond.py ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') f.close() - - From c2871138acbe7e86e563d96a5c2ba001ccdd237b Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:21:46 +0100 Subject: [PATCH 07/11] Update test_diamond_report.py --- test/scripts/test_diamond_report.py | 48 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/test/scripts/test_diamond_report.py b/test/scripts/test_diamond_report.py index c00afcb..f2dc9f2 100755 --- a/test/scripts/test_diamond_report.py +++ b/test/scripts/test_diamond_report.py @@ -7,45 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['scripts/diamond_report.pl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['scripts/diamond_report.pl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: is scripts/diamond_report.pl in your PATH?' + '\n') - f.close() - sys.exit() + f.write('OSError: is scripts/diamond_report.pl in your PATH?' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run scripts/diamond_report.pl - is BioPerl installed?' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run scripts/diamond_report.pl - is BioPerl installed?' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding) == '': - f.write('scripts/diamond_report.pl ran without problems' + '\n') -else : - f.write('scripts/diamond_report.pl ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - -f.close() - + f.write('scripts/diamond_report.pl ran without problems' + '\n') +else: + f.write('scripts/diamond_report.pl ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') +f.close() From a78932d530a940f10b55645c2a6a10364975c23c Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:23:43 +0100 Subject: [PATCH 08/11] Update test_pfam_scan.py Fix indentation --- test/scripts/test_pfam_scan.py | 48 ++++++++++++++++------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/test/scripts/test_pfam_scan.py b/test/scripts/test_pfam_scan.py index 10173b6..2520c5c 100755 --- a/test/scripts/test_pfam_scan.py +++ b/test/scripts/test_pfam_scan.py @@ -7,47 +7,45 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['pfam_scan.pl', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['pfam_scan.pl', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: is pfam_scan.pl installed and in your PATH?' + '\n') - f.close() - sys.exit() + f.write('OSError: is pfam_scan.pl installed and in your PATH?' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run pfam_scan.pl' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run pfam_scan.pl' + '\n') + f.close() + sys.exit() teststr = error.decode(sys.stdout.encoding) # if we're still here, check error and print if teststr[1:29] == 'pfam_scan.pl: search a FASTA': - f.write('pfam_scan.pl ran without problems' + '\n') -else : - f.write('pfam_scan.pl ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - -f.close() - + f.write('pfam_scan.pl ran without problems' + '\n') +else: + f.write('pfam_scan.pl ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') +f.close() From 78251518a97075ca6cefe225b662caaf4d44b832 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:25:30 +0100 Subject: [PATCH 09/11] Update test_phylophlan.py Fix indentation --- test/scripts/test_phylophlan.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/scripts/test_phylophlan.py b/test/scripts/test_phylophlan.py index 81308b2..36b78e8 100755 --- a/test/scripts/test_phylophlan.py +++ b/test/scripts/test_phylophlan.py @@ -7,8 +7,8 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] @@ -44,10 +44,7 @@ # if we're still here, check error and print if error == '': f.write('phylophlan ran without problems' + '\n') -else : +else: f.write('phylophlan ran with some errors: ' + str(error) + '\n') - f.close() - - From 8888372e94560515970b0a305f66602c916552f5 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:26:45 +0100 Subject: [PATCH 10/11] Update test_prodigal.py Fix indentation --- test/scripts/test_prodigal.py | 47 ++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/test/scripts/test_prodigal.py b/test/scripts/test_prodigal.py index 42f565e..e1c78b3 100755 --- a/test/scripts/test_prodigal.py +++ b/test/scripts/test_prodigal.py @@ -7,46 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['prodigal','-v'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['prodigal','-v'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: make sure prodigal is installed properly' + '\n') - f.close() - sys.exit() + f.write('OSError: make sure prodigal is installed properly' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run prodigal' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run prodigal' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding)[1:16] == 'Prodigal V2.6.3': - f.write('prodigal ran without problems' + '\n') -else : - f.write('prodigal ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - + f.write('prodigal ran without problems' + '\n') +else: + f.write('prodigal ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') f.close() - - From 238d12869e762c13c427979ebb6c27f094239268 Mon Sep 17 00:00:00 2001 From: Cezar Pendarovski Date: Fri, 18 Jun 2021 16:27:55 +0100 Subject: [PATCH 11/11] Update test_sourmash.py Fix indentation --- test/scripts/test_sourmash.py | 47 ++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/test/scripts/test_sourmash.py b/test/scripts/test_sourmash.py index 6f8bc75..598dbf7 100755 --- a/test/scripts/test_sourmash.py +++ b/test/scripts/test_sourmash.py @@ -7,46 +7,43 @@ import errno if len(sys.argv) == 1: - print("Please provide a filename") - sys.exit() + print("Please provide a filename") + sys.exit() # output file outfile = sys.argv[1] if not os.path.dirname(outfile) == '': - if not os.path.exists(os.path.dirname(outfile)): - try: - os.makedirs(os.path.dirname(outfile)) - except OSError as exc: # Guard against race condition - if exc.errno != errno.EEXIST: - raise + if not os.path.exists(os.path.dirname(outfile)): + try: + os.makedirs(os.path.dirname(outfile)) + except OSError as exc: # Guard against race condition + if exc.errno != errno.EEXIST: + raise f = open(outfile, 'w+') # try to run checkM try: - p1 = subprocess.Popen(['sourmash','-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p1 = subprocess.Popen(['sourmash','-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Run the command - allout = p1.communicate() - output = allout[0] - error = allout[1] + # Run the command + allout = p1.communicate() + output = allout[0] + error = allout[1] except OSError as o: - f.write('OSError: make sure sourmash is installed properly' + '\n') - f.close() - sys.exit() + f.write('OSError: make sure sourmash is installed properly' + '\n') + f.close() + sys.exit() except: - f.write('Unexpected error: unable to run sourmash' + '\n') - f.close() - sys.exit() + f.write('Unexpected error: unable to run sourmash' + '\n') + f.close() + sys.exit() # if we're still here, check error and print if error.decode(sys.stdout.encoding) == '== This is sourmash version 4.1.1. ==': - f.write('Sourmash ran without problems' + '\n') -else : - f.write('Sourmash ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') - + f.write('Sourmash ran without problems' + '\n') +else: + f.write('Sourmash ran with some errors: ' + error.decode(sys.stdout.encoding) + '\n') f.close() - -