Skip to content

Commit

Permalink
remove error for short sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Jun 6, 2016
1 parent 5f899db commit 494cc9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sourmash_lib/kmer_min_hash.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public:
}
void add_sequence(const char * sequence, bool force=false) {
if (strlen(sequence) < ksize) {
throw minhash_exception("sequence is shorter than ksize");
return;
}
const std::string seq = _checkdna(sequence, force);
if (!is_protein) {
Expand Down
8 changes: 3 additions & 5 deletions sourmash_lib/test__minhash.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,9 @@ def test_mh_concat_diff_ksize():

def test_short_sequence():
a = MinHash(20, 5)
try:
a.add_sequence('GGGG')
assert 0, "adding too short a sequence should trigger ValueError"
except ValueError:
pass
a.add_sequence('GGGG')
# adding a short sequence should fail silently
assert len(a.get_mins()) == 0


def test_murmur():
Expand Down

0 comments on commit 494cc9d

Please sign in to comment.