Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Partial) Hamming distance #35

Closed
traversc opened this issue Oct 22, 2020 · 5 comments
Closed

(Partial) Hamming distance #35

traversc opened this issue Oct 22, 2020 · 5 comments

Comments

@traversc
Copy link

I'm looking for a function for partial hamming distance. It looks like it existed in an earlier version but was taken out.

Is it possible to put it back in?

@matthieugomez
Copy link
Owner

matthieugomez commented Oct 22, 2020 via email

@traversc
Copy link
Author

Something simple like:

compare("GACT", "CGATTGCAATGCTA", Partial(Hamming()))

or

 findall(s, itr, Partial(Hamming()), min_score = 0.9)

An example use case would be as a first pass in PCR primer design, where a hamming might be more appropriate than levenshtein or other metric.

@matthieugomez
Copy link
Owner

The issue is that Hamming is already defined in Distances and so defining it on Strings is type piracy.

@traversc
Copy link
Author

I'm a bit new to Julia, but can you simply name the function something else? The name isn't important, only what it does. Something like hammingstr or hamming2 etc.

@matthieugomez
Copy link
Owner

Ok, I now export a Hamming distance that is distinct from the one exported by Distances. Not super satisfied (this requires to do StringDistances.Hamming() when loading both Distances and StringDistances), but that's better than type piracy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants