Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorpetty authored Oct 7, 2021
1 parent c7039e2 commit def3f86
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions rfl/numbaRFL.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def encodeasarray(dna,dtype = 'np.int64'):
else:
raise ValueError("Invalid dtype.")

#this needs to be @njit-ified to be compatible with
#the full function later; I guess because it's called
#within the full function
#this needs to be @njit-ified to be compatible with the full function later
@njit
def arraytoint(intarray):
'''Numba-compatible: turn an array of ints
Expand Down Expand Up @@ -79,32 +77,17 @@ def lsdp_encoded(motif, costs, fwstcost, bwstcost):
dcosts = np.ones(128, dtype=np.float64)
scosts = np.ones((128, 128), dtype=np.float64)

icosts[ord('A')] = costs.loc['','A']
icosts[ord('C')] = costs.loc['','C']
icosts[ord('G')] = costs.loc['','G']
icosts[ord('T')] = costs.loc['','T']

dcosts[ord('A')]= costs.loc['A','']
dcosts[ord('C')]= costs.loc['C','']
dcosts[ord('G')]= costs.loc['G','']
dcosts[ord('T')]= costs.loc['T','']

scosts[ord('A'), ord('C')] = costs.loc['A','C']
scosts[ord('A'), ord('G')] = costs.loc['A','G']
scosts[ord('A'), ord('T')] = costs.loc['A','T']

scosts[ord('C'), ord('A')] = costs.loc['C','A']
scosts[ord('C'), ord('G')] = costs.loc['C','G']
scosts[ord('C'), ord('T')] = costs.loc['C','T']

scosts[ord('G'), ord('A')] = costs.loc['G','A']
scosts[ord('G'), ord('C')] = costs.loc['G','C']
scosts[ord('G'), ord('T')] = costs.loc['G','T']

scosts[ord('T'), ord('A')] = costs.loc['T','A']
scosts[ord('T'), ord('C')] = costs.loc['T','C']
scosts[ord('T'), ord('G')] = costs.loc['T','G']
alphabet = ['A', 'C', 'G', 'T']

for letter in alphabet:

icosts[ord(letter)] = costs.loc['',letter]
dcosts[ord(letter)] = costs.loc[letter,'']

for letter2 in alphabet:
if letter2 != letter:
scosts[ord(letter),ord(letter2)] = costs.loc[letter,letter2]

for i in range(1,2*len(motif)):
for item in itertools.product(alphabet,repeat=i):
sewn = ''.join(item)
Expand Down

0 comments on commit def3f86

Please sign in to comment.