Skip to content

Commit

Permalink
fix bug that ignored more than one ksize in sourmash compute
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Jun 23, 2016
1 parent ef66845 commit d512bd0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sourmash
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Commands can be:

# convert into a signature
siglist = [ sig.SourmashSignature(args.email, E,
filename=filename) ]
filename=filename) for E in Elist ]

# save!
with open(sigfile, 'w') as fp:
Expand Down
30 changes: 30 additions & 0 deletions sourmash_lib/test_sourmash.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,41 @@
import matplotlib
matplotlib.use('Agg')

from sourmash_lib import signature

def test_run_sourmash():
status, out, err = utils.runscript('sourmash', [], fail_ok=True)
assert status != 0 # no args provided, ok ;)


def test_do_sourmash_compute():
with utils.TempDirectory() as location:
testdata1 = utils.get_test_data('short.fa')
status, out, err = utils.runscript('sourmash',
['compute', testdata1],
in_directory=location)
assert os.path.exists(os.path.join(location, 'short.fa.sig'))


def test_do_sourmash_compute_multik():
with utils.TempDirectory() as location:
testdata1 = utils.get_test_data('short.fa')
status, out, err = utils.runscript('sourmash',
['compute', '-k', '21,31',
testdata1],
in_directory=location)
outfile = os.path.join(location, 'short.fa.sig')
assert os.path.exists(outfile)

with open(outfile, 'rt') as fp:
sigdata = fp.read()
siglist = signature.load_signatures(sigdata)
assert len(siglist) == 2
ksizes = set([ x.estimator.ksize for x in siglist ])
assert 21 in ksizes
assert 31 in ksizes


def test_do_plot_comparison():
with utils.TempDirectory() as location:
testdata1 = utils.get_test_data('short.fa')
Expand Down

0 comments on commit d512bd0

Please sign in to comment.