Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-huber committed Aug 15, 2023
1 parent 466ec7d commit 3426a55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 2 additions & 4 deletions ms2deepscore/data_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,11 @@ def __len__(self):
* int(np.floor(len(self.selected_compound_pairs.scores) / self.settings["batch_size"]))

def _spectrum_pair_generator(self, batch_index: int) -> Iterator[SpectrumPair]:

same_prob_bins = self.settings["same_prob_bins"]
"""Use the provided SelectedCompoundPairs object to pick pairs."""
batch_size = self.settings["batch_size"]

indexes = self.indexes[batch_index * batch_size:(batch_index + 1) * batch_size]
for index in indexes:
inchikey1 = self.selected_compound_pairs._idx_to_inchikey[index]
inchikey1 = self.selected_compound_pairs.idx_to_inchikey[index]
score, inchikey2 = self.selected_compound_pairs.next_pair_for_inchikey(inchikey1)
spectrum1 = self._get_spectrum_with_inchikey(inchikey1)
spectrum2 = self._get_spectrum_with_inchikey(inchikey2)
Expand Down
12 changes: 11 additions & 1 deletion ms2deepscore/spectrum_pair_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def generator(self):
def scores(self):
return self._scores

@property
def idx_to_inchikey(self):
return self._idx_to_inchikey

@property
def inchikey_to_idx(self):
return self._inchikey_to_idx

def __str__(self):
return f"SelectedCompoundPairs with {len(self._scores)} columns."

Expand Down Expand Up @@ -230,8 +238,10 @@ def compute_jaccard_similarity_matrix_cherrypicking(
scores_data.extend(scores_row[idx_selected])
scores_i.extend(len(idx_selected) * [i])
scores_j.extend(list(idx_selected))
# Output biases in scores
print("Counted cases of fewer than max_pairs_per_bin usage:")
max_pairs_global = [x - max_pairs_per_bin for x in max_pairs_global]
print(max_pairs_global)

return scores_data, scores_i, scores_j


Expand Down

0 comments on commit 3426a55

Please sign in to comment.