Skip to content

Commit

Permalink
Update markov_for_dinuc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
annachernysheva179 authored Jun 21, 2023
1 parent cce34b3 commit 2173fb6
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions models/baseline/markov_for_dinuc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,6 @@ def __init__(self, kmercount, dinucdist):
self.kmer_counts_dict = kmercount.kmer_counts_dict
self.markov_matrix = dinucdist

def compile_from_counts(self):
for k in range(1,self.max_k+1):
for kmer in self.kmer_dict[k]:
state = [self.kmer_dict[k-1][kmer[:k-1]]]
next_nt = [self.kmer_dict[1][kmer[k-1]]]
counts = self.kmer_counts_dict[k][self.kmer_dict[k][kmer]]
self.markov_matrix[k-1, state, next_nt] = counts
# normalize rows
if k == 1:
self.markov_matrix[k-1,:,:] = self.markov_matrix[k-1,:,:]/np.sum(self.markov_matrix[k-1,:,:])
else:
self.markov_matrix[k-1,:,:] = self.markov_matrix[k-1,:,:]/np.sum(self.markov_matrix[k-1,:,:],axis=1)[:,np.newaxis]

def impute_for_seq(self, seq, order=None):
probs = []
if not order and not order == 0:
Expand Down

0 comments on commit 2173fb6

Please sign in to comment.