diff --git a/test/scripts/test_checkm.py b/test/scripts/test_checkm.py index 37706f1..1831b6c 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() - - diff --git a/test/scripts/test_checkm_plus.py b/test/scripts/test_checkm_plus.py index ef2520f..574c8a8 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() - - 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() - - 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() - - 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() 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() 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() - - 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() - - 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() - -