Skip to content

Commit

Permalink
finally normalization helps
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry-Antipov committed Jul 25, 2024
1 parent d5819b3 commit fbf0efc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/scripts/scaffolding/scaffold_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,20 @@ def getPathPairConnections(self, path_ids, connections, lens):
scores[orientation] *= self.REFERENCE_MULTIPLICATIVE_BONUS
scores[orientation] /= self.INT_NORMALIZATION

#TODO: possibly do not need reordering from "wrong" end and compare with pathLength/2 after reordering removed?
#Only reevaluate short-long connections since short-short are too unreliable
very_short = 0
very_long = 0
for i in range (0, 2):
if self.rukki_paths.getLength(path_ids[i]) < ScaffoldGraph.NEAR_PATH_END and self.rukki_paths.getLength(path_ids[1 - i]) > ScaffoldGraph.NEAR_PATH_END and self.rukki_paths.getLength(path_ids[i]) > ScaffoldGraph.MIN_PATH_TO_SCAFFOLD:
scores[orientation] *= self.NEAR_PATH_END / self.rukki_paths.getLength(path_ids[i])
if self.rukki_paths.getLength(path_ids[i]) > ScaffoldGraph.NEAR_PATH_END:
very_long += 1
#constant tweeeeeing
if self.rukki_paths.getLength(path_ids[i]) < ScaffoldGraph.NEAR_PATH_END/5:
very_short += 1
#TODO: possibly do not need reordering from "wrong" end and compare with pathLength/2 after reordering removed?
#Never want to apply this bonus twice
if very_long <= 1 and very_short == 0:
coeff = self.NEAR_PATH_END / min(self.rukki_paths.getLength(path_ids[0]), self.rukki_paths.getLength(path_ids[1]))
self.logger.debug(f"Normalization is applied to {path_ids} , lens {self.rukki_paths.getLength(path_ids[0])} {self.rukki_paths.getLength(path_ids[1])} coefficent {coeff}")
scores[orientation] *= coeff
return scores

#Do we need it for reruns?
Expand Down

0 comments on commit fbf0efc

Please sign in to comment.