def test_vsearch_derep_exec(): """VSEARCH dereplicates test data""" mode = '--derep_fulllength' vsearch_exe = vsearch.Vsearch("vsearch") result = vsearch_exe.run(mode, INFILE_DEREP, OUTFILE_DEREP) with open(TARGET_DEREP, 'r') as target_fh: with open(result.outfilename, 'r') as test_fh: assert_equal(target_fh.read(), test_fh.read())
def test_vsearch_cluster_exec(): """VSEARCH clusters test data""" mode = '--usearch_global' vsearch_exe = vsearch.Vsearch("vsearch") result = vsearch_exe.run(mode, INFILE_CLUSTER, OUTFILE_CLUSTER_UC, CLUSTER_PARAMS) compare_sorted_lines(TARGET_CLUSTER_UC, result.outfile_uc) compare_sorted_lines(TARGET_CLUSTER_B6, result.outfile_b6)
def test_vsearch_notexec(): """Error thrown if vsearch not executable""" try: vsearch_exe = vsearch.Vsearch("LICENSE") except NotExecutableError: return True else: return False
def test_vsearch_exec_notexist(): """error thrown if vsearch executable does not exist""" try: vsearch_exe = vsearch.Vsearch(os.path.join(".", "vsearch")) except NotExecutableError: return True else: return False
def test_vsearch_cluster_exec(): """VSEARCH cluster_fast clusters test data""" mode = '--cluster_fast' vsearch_exe = vsearch.Vsearch("vsearch") result = vsearch_exe.run(mode, INFILE_CLUSTER, OUTFILE_CLUSTER_FAST_UC, CLUSTER_FAST_PARAMS) compare_sorted_lines(TARGET_CLUSTER_FAST_UC, result.outfile_uc) compare_sorted_lines(TARGET_CLUSTER_FAST_B6, result.outfile_b6) compare_sorted_fasta(TARGET_CLUSTER_FAST_MSA, result.outfile_msa)
def test_vsearch_derep_cmd(): """VSEARCH wrapper returns correct dereplication cmd-line""" mode = '--derep_fulllength' target = ' '.join([ 'vsearch', mode, INFILE_DEREP, '--output', OUTFILE_DEREP, '--sizeout' ]) vsearch_exe = vsearch.Vsearch("vsearch") result = vsearch_exe.run(mode, INFILE_DEREP, OUTFILE_DEREP, dry_run=True) assert_equal(result.command, target)
def test_vsearch_cluster_cmd(): """VSEARCH wrapper returns correct clustering cmd-line""" mode = '--usearch_global' target = ' '.join([ 'vsearch', mode, INFILE_CLUSTER, '--uc', OUTFILE_CLUSTER_UC, ' '.join([ "{0} {1}".format(k, v) for k, v in sorted(CLUSTER_PARAMS.items()) ]) ]) vsearch_exe = vsearch.Vsearch("vsearch") result = vsearch_exe.run(mode, INFILE_CLUSTER, OUTFILE_CLUSTER_UC, CLUSTER_PARAMS, dry_run=True) assert_equal(result.command, target)
def test_vsearch_path(): """vsearch is in $PATH""" vsearch_exe = vsearch.Vsearch("vsearch")