-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
192 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
from ._minhash import _HashFunctions as HashFunctions | ||
from enum import Enum | ||
|
||
from ._lowlevel import lib | ||
|
||
|
||
class HashFunctions(Enum): | ||
murmur64_DNA = lib.HASH_FUNCTIONS_MURMUR64_DNA | ||
murmur64_protein = lib.HASH_FUNCTIONS_MURMUR64_PROTEIN | ||
murmur64_dayhoff = lib.HASH_FUNCTIONS_MURMUR64_DAYHOFF | ||
|
||
@classmethod | ||
def from_string(cls, hash_str): | ||
if hash_str == "0.murmur64_DNA": | ||
return cls.murmur64_DNA | ||
elif hash_str == "0.murmur64_protein": | ||
return cls.murmur64_protein | ||
elif hash_str == "0.murmur64_dayhoff": | ||
return cls.murmur64_dayhoff | ||
else: | ||
raise Exception("unknown molecule type: {}".format(hash_str)) | ||
|
||
|
||
def hashfunction_from_string(hash_str): | ||
if hash_str == "0.murmur64_DNA": | ||
return HashFunctions.murmur64_DNA | ||
elif hash_str == "0.murmur64_protein": | ||
return HashFunctions.murmur64_protein | ||
elif hash_str == "0.murmur64_dayhoff": | ||
return HashFunctions.murmur64_dayhoff | ||
else: | ||
raise Exception("unknown molecule type: {}".format(hash_str)) | ||
return HashFunctions.from_string(hash_str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.