Skip to content

Commit

Permalink
MI Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JKlesmith committed Sep 7, 2018
1 parent 591df02 commit 49a49bf
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions pact/pact/sequencing/multiple_freq_mi.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,18 @@ def mutual_information(self, dict_nparray_sel):
list_freq2.append(nparr_single_freq2[np.where(nparr_single_freq2[:,0] == combo[1])][0][1])

#Add to our lists
#Replace with a numpy solution in the future
for i in range(0, nparr_dbl_combos.shape[0]):
list_combinations.append([
mapping[0],
mapping[1],
nparr_dbl_combos[i][0],
nparr_dbl_combos[i][1],
list_freq1[i],
list_freq2[i],
nparr_dbl_counts.reshape((nparr_dbl_combos.shape[0], 1))[i][0],
dict_nparray_sel[design_key].shape[0]
])
list_combinations.append(np.hstack((
np.full((nparr_dbl_combos.shape[0], 1), mapping[0]), #Site 1
np.full((nparr_dbl_combos.shape[0], 1), mapping[1]), #Site 2
nparr_dbl_combos, #Aminos
np.array(list_freq1).reshape((nparr_dbl_combos.shape[0], 1)), #Site 1 Freq
np.array(list_freq2).reshape((nparr_dbl_combos.shape[0], 1)), #Site 2 Freq
nparr_dbl_counts.reshape((nparr_dbl_combos.shape[0], 1)), #Counts of pairing
np.full((nparr_dbl_combos.shape[0], 1), dict_nparray_sel[design_key].shape[0]) #Total read counts
)).tolist())

#Convert to numpy array
nparr_combinations = np.array(list_combinations)
nparr_combinations = np.array(list_combinations[0])

#Extract the frequency and counts, reshape to 2D, and type
freq_one = np.asarray(nparr_combinations.T[4].reshape((nparr_combinations.shape[0], 1))).astype(float)
Expand Down

0 comments on commit 49a49bf

Please sign in to comment.