def validate_rdp_version(rdp_jarpath=None): if rdp_jarpath is None: rdp_jarpath = get_rdp_jarpath() if rdp_jarpath is None: raise RuntimeError( "RDP classifier is not installed or not accessible to QIIME. " "See install instructions here: " "http://qiime.org/install/install.html#rdp-install" ) rdp_jarname = os.path.basename(rdp_jarpath) version_match = re.search("\d\.\d", rdp_jarname) if version_match is None: raise RuntimeError( "Unable to detect RDP Classifier version in file %s" % rdp_jarname ) version = float(version_match.group()) if version < 2.1: raise RuntimeError( "RDP Classifier does not look like version 2.2 or greater." "Versions of the software prior to 2.2 have different " "formatting conventions and are no longer supported by QIIME. " "Detected version %s from file %s" % (version, rdp_jarpath) ) return version
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) qiime_config = load_qiime_config() rdp_jarpath = get_rdp_jarpath() if rdp_jarpath == None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] java_version = get_java_version() if java_version is None: java_version = "Not installed." system_info = [ ("Platform", platform), ("Python version",python_version.replace('\n', ' ')), ("Python executable",executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len,v[0],v[1]) version_info = [ ("PyCogent version", pycogent_lib_version), ("NumPy version", numpy_lib_version), ("matplotlib version", matplotlib_lib_version), ("biom-format version", biom_lib_version), ("qcli version", qcli_lib_version), ("QIIME library version", get_qiime_library_version()), ("QIIME script version", __version__), ("PyNAST version (if installed)", pynast_lib_version), ("RDP Classifier version (if installed)", rdp_version), ("Java version (if installed)", java_version), ("Emperor version", emperor_lib_version)] max_len = max([len(e[0]) for e in version_info]) print "\nDependency versions" print "===================" for v in version_info: print "%*s:\t%s" % (max_len,v[0],v[1]) print "\nQIIME config values" print "===================" max_len = max([len(key) for key in qiime_config]) for key,value in qiime_config.items(): print "%*s:\t%s"%(max_len,key,value) #run the Testcase.main function to do the tests # need to mess with the arg string, otherwise TestCase complains if (opts.test): print "\n\nrunning checks:\n" test_main(argv=["","-v"])
def guess_rdp_version(): rdp_jarpath = get_rdp_jarpath() if rdp_jarpath == None: raise ValueError, \ ("RDP classifier is not installed or " "not accessible to QIIME. See install instructions here: " "http://qiime.org/install/install.html#rdp-install") elif "2.2" in rdp_jarpath: return "rdp22" elif "2.0" in rdp_jarpath: return "rdp20" else: raise ValueError,\ ("Can't determine RDP version number. Only versions 2.0, 2.0.1," " and 2.2 are supported by QIIME. RDP jar path is:" " %s" % rdp_jarpath)
def error_on_bad_rdp_version(option_parser,assignment_method): rdp_jarpath = get_rdp_jarpath() if rdp_jarpath == None: option_parser.error("RDP classifier is not installed or " "not accessible to QIIME. See install instructions here: " "http://qiime.org/install/install.html#rdp-install") elif assignment_method == 'rdp': if not check_rdp_version(rdp_jarpath,"2.2"): option_parser.error("Specified RDP version 2.2 (default), " "but that version is not installed. Pass -m rdp20 for RDP " "classifier versions 2.0 and 2.0.1.") elif assignment_method == 'rdp20': if not check_rdp_version(rdp_jarpath,"2.0"): option_parser.error("Specified RDP version 2.0 (default), " "but that version is not installed. Pass -m rdp for RDP " "classifier versions 2.2.") else: # not possible to get here, but don't like if/elif without else raise ValueError,\ "Unknown assignment method: %s" % assignment_method
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.haiku: print "QIIME provides insight\nmicrobial in nature\nto ecology" exit(0) qiime_config = load_qiime_config() test = opts.test qiime_base_install = opts.qiime_base_install rdp_jarpath = get_rdp_jarpath() if rdp_jarpath is None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] java_version = get_java_version() if java_version is None: java_version = "Not installed." system_info = [ ("Platform", platform), ("Python version", python_version.replace('\n', ' ')), ("Python executable", executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len, v[0], v[1]) version_info = [ ("PyCogent version", pycogent_lib_version), ("NumPy version", numpy_lib_version), ("SciPy version", scipy_lib_version), ("matplotlib version", matplotlib_lib_version), ("biom-format version", biom_lib_version), ("qcli version", qcli_lib_version), ("pyqi version", pyqi_lib_version), ("scikit-bio version", skbio_lib_version), ("QIIME library version", get_qiime_library_version()), ("QIIME script version", __version__), ("PyNAST version (if installed)", pynast_lib_version), ("Emperor version", emperor_lib_version)] if not qiime_base_install: version_info += [ ("RDP Classifier version (if installed)", rdp_version), ("Java version (if installed)", java_version)] max_len = max([len(e[0]) for e in version_info]) print "\nDependency versions" print "===================" for v in version_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME config values" print "===================" max_len = max([len(key) for key in qiime_config]) for key, value in qiime_config.items(): print "%*s:\t%s" % (max_len, key, value) if test: if qiime_base_install: suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyBase) else: suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyFull) if opts.verbose: verbosity = 2 else: verbosity = 1 TextTestRunner(stream=stdout, verbosity=verbosity).run(suite)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.haiku: print "QIIME provides insight\nmicrobial in nature\nto ecology" exit(0) qiime_config = load_qiime_config() test = opts.test qiime_full_install = opts.qiime_full_install rdp_jarpath = get_rdp_jarpath() if rdp_jarpath is None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] java_version = get_java_version() if java_version is None: java_version = "Not installed." system_info = [("Platform", platform), ("Python version", python_version.replace('\n', ' ')), ("Python executable", executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME default reference information" print "===================================" print "For details on what files are used as QIIME's default references, see here:" print " https://github.com/biocore/qiime-default-reference/releases/tag/%s" % qdr_lib_version version_info = [("QIIME library version", get_qiime_library_version()), ("QIIME script version", __version__), ("qiime-default-reference version", qdr_lib_version), ("NumPy version", numpy_lib_version), ("SciPy version", scipy_lib_version), ("pandas version", pandas_lib_version), ("matplotlib version", matplotlib_lib_version), ("biom-format version", biom_lib_version), ("h5py version", h5py_lib_version), ("qcli version", qcli_lib_version), ("pyqi version", pyqi_lib_version), ("scikit-bio version", skbio_lib_version), ("PyNAST version", pynast_lib_version), ("Emperor version", emperor_lib_version), ("burrito version", burrito_lib_version), ("burrito-fillings version", bfillings_lib_version), ("sortmerna version", sortmerna_lib_version), ("sumaclust version", sumaclust_lib_version), ("swarm version", swarm_lib_version), ("gdata", gdata_installed)] if qiime_full_install: version_info += [("RDP Classifier version (if installed)", rdp_version), ("Java version (if installed)", java_version)] max_len = max([len(e[0]) for e in version_info]) print "\nDependency versions" print "===================" for v in version_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME config values" print "===================" print "For definitions of these settings and to learn how to configure QIIME, see here:" print " http://qiime.org/install/qiime_config.html" print " http://qiime.org/tutorials/parallel_qiime.html\n" max_len = max([len(key) for key in qiime_config]) for key, value in qiime_config.items(): print "%*s:\t%s" % (max_len, key, value) if test: if qiime_full_install: print "\nQIIME full install test results" print "===============================" suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyFull) else: print "\nQIIME base install test results" print "===============================" suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyBase) if opts.verbose: verbosity = 2 else: verbosity = 1 TextTestRunner(stream=stdout, verbosity=verbosity).run(suite)
test.assertTrue(exists(fp), "%s set to an invalid file path: %s" %\ (variable,fp)) modes = {R_OK:"readable", W_OK:"writable", X_OK:"executable"} #test if file readable test.assertTrue(access(fp, access_var), "%s is not %s: %s" % (variable, modes[access_var], fp)) if __name__ == "__main__": option_parser, opts, args = parse_command_line_parameters(**script_info) qiime_config = load_qiime_config() rdp_jarpath = get_rdp_jarpath() if rdp_jarpath == None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] system_info = [ ("Platform", platform), ("Python version",python_version.replace('\n', ' ')), ("Python executable",executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len,v[0],v[1])
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.haiku: print "QIIME provides insight\nmicrobial in nature\nto ecology" exit(0) qiime_config = load_qiime_config() test = opts.test qiime_base_install = opts.qiime_base_install rdp_jarpath = get_rdp_jarpath() if rdp_jarpath is None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] java_version = get_java_version() if java_version is None: java_version = "Not installed." system_info = [("Platform", platform), ("Python version", python_version.replace('\n', ' ')), ("Python executable", executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len, v[0], v[1]) version_info = [("NumPy version", numpy_lib_version), ("SciPy version", scipy_lib_version), ("matplotlib version", matplotlib_lib_version), ("biom-format version", biom_lib_version), ("qcli version", qcli_lib_version), ("pyqi version", pyqi_lib_version), ("scikit-bio version", skbio_lib_version), ("QIIME library version", get_qiime_library_version()), ("QIIME script version", __version__), ("PyNAST version (if installed)", pynast_lib_version), ("Emperor version", emperor_lib_version)] if not qiime_base_install: version_info += [("RDP Classifier version (if installed)", rdp_version), ("Java version (if installed)", java_version)] max_len = max([len(e[0]) for e in version_info]) print "\nDependency versions" print "===================" for v in version_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME config values" print "===================" max_len = max([len(key) for key in qiime_config]) for key, value in qiime_config.items(): print "%*s:\t%s" % (max_len, key, value) if test: if qiime_base_install: suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyBase) else: suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyFull) if opts.verbose: verbosity = 2 else: verbosity = 1 TextTestRunner(stream=stdout, verbosity=verbosity).run(suite)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.haiku: print "QIIME provides insight\nmicrobial in nature\nto ecology" exit(0) qiime_config = load_qiime_config() test = opts.test qiime_full_install = opts.qiime_full_install rdp_jarpath = get_rdp_jarpath() if rdp_jarpath is None: rdp_version = "Not installed." else: rdp_version = split(rdp_jarpath)[1] java_version = get_java_version() if java_version is None: java_version = "Not installed." system_info = [ ("Platform", platform), ("Python version", python_version.replace('\n', ' ')), ("Python executable", executable)] max_len = max([len(e[0]) for e in system_info]) print "\nSystem information" print "==================" for v in system_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME default reference information" print "===================================" print "For details on what files are used as QIIME's default references, see here:" print " https://github.com/biocore/qiime-default-reference/releases/tag/%s" % qdr_lib_version version_info = [ ("QIIME library version", get_qiime_library_version()), ("QIIME script version", __version__), ("qiime-default-reference version", qdr_lib_version), ("NumPy version", numpy_lib_version), ("SciPy version", scipy_lib_version), ("pandas version", pandas_lib_version), ("matplotlib version", matplotlib_lib_version), ("biom-format version", biom_lib_version), ("h5py version", h5py_lib_version), ("qcli version", qcli_lib_version), ("pyqi version", pyqi_lib_version), ("scikit-bio version", skbio_lib_version), ("PyNAST version", pynast_lib_version), ("Emperor version", emperor_lib_version), ("burrito version", burrito_lib_version), ("burrito-fillings version", bfillings_lib_version), ("sortmerna version", sortmerna_lib_version), ("sumaclust version", sumaclust_lib_version), ("swarm version", swarm_lib_version), ("gdata", gdata_installed) ] if qiime_full_install: version_info += [ ("RDP Classifier version (if installed)", rdp_version), ("Java version (if installed)", java_version)] max_len = max([len(e[0]) for e in version_info]) print "\nDependency versions" print "===================" for v in version_info: print "%*s:\t%s" % (max_len, v[0], v[1]) print "\nQIIME config values" print "===================" print "For definitions of these settings and to learn how to configure QIIME, see here:" print " http://qiime.org/install/qiime_config.html" print " http://qiime.org/tutorials/parallel_qiime.html\n" max_len = max([len(key) for key in qiime_config]) for key, value in qiime_config.items(): print "%*s:\t%s" % (max_len, key, value) if test: if qiime_full_install: print "\nQIIME full install test results" print "===============================" suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyFull) else: print "\nQIIME base install test results" print "===============================" suite = TestLoader().loadTestsFromTestCase(QIIMEDependencyBase) if opts.verbose: verbosity = 2 else: verbosity = 1 TextTestRunner(stream=stdout, verbosity=verbosity).run(suite)