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

Cython tidying #1774

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow hash functions to accept string derivitives
camillescott committed Sep 6, 2017
commit 17c6bab4f6ce105ff42a8e3ea43c0ed82ae16032
10 changes: 5 additions & 5 deletions khmer/_oxli/hashing.pxd
Original file line number Diff line number Diff line change
@@ -68,19 +68,19 @@ cdef class Kmer:
cdef Kmer wrap(CpKmer * cpkmer, WordLength K)


cpdef HashIntoType forward_hash(str kmer, unsigned int K)
cpdef HashIntoType forward_hash(object kmer, unsigned int K)


cpdef HashIntoType forward_hash_no_rc(str kmer, WordLength K)
cpdef HashIntoType forward_hash_no_rc(object kmer, WordLength K)


cpdef str reverse_hash(object h, int K)


cpdef str reverse_complement(str sequence)
cpdef str reverse_complement(object sequence)


cpdef hash_murmur3(str s)
cpdef hash_murmur3(object s)


cpdef hash_no_rc_murmur3(str s)
cpdef hash_no_rc_murmur3(object s)
10 changes: 5 additions & 5 deletions khmer/_oxli/hashing.pyx
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ cdef class Kmer:
return kmer


cpdef HashIntoType forward_hash(str kmer, unsigned int K):
cpdef HashIntoType forward_hash(object kmer, unsigned int K):
'''Run the 2-bit hash algorithm on the given K-mer.'''

if K > 32:
@@ -78,7 +78,7 @@ cpdef HashIntoType forward_hash(str kmer, unsigned int K):
return _hash(_bstring(kmer), K)


cpdef HashIntoType forward_hash_no_rc(str kmer, WordLength K):
cpdef HashIntoType forward_hash_no_rc(object kmer, WordLength K):
'''Run the 2-bit hash function in only the given
sequence orientation.'''

@@ -98,16 +98,16 @@ cpdef str reverse_hash(object h, int K):
return _revhash(_h, K)


cpdef str reverse_complement(str sequence):
cpdef str reverse_complement(object sequence):
cdef string s = _revcomp(_bstring(sequence))
return s


cpdef hash_murmur3(str s):
cpdef hash_murmur3(object s):
cdef HashIntoType h = _hash_murmur(_bstring(s), len(s))
return h


cpdef hash_no_rc_murmur3(str s):
cpdef hash_no_rc_murmur3(object s):
cdef HashIntoType h = _hash_murmur_forward(_bstring(s), len(s))
return h