Skip to content

Commit

Permalink
fix up lutz's score patch
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-combe committed Nov 1, 2023
1 parent 93a3786 commit fb83ae1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions xi2_xiview_loader/xi2_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,16 @@ def get_resultset_search_metadata(cur, uuids, uuid_dict):

def get_matches(cur, uuids, main_score_index):
# small heuristic to see if the score is between 0 and 1
sqlScore = """SELECT MAX(score) FROM (
SELECT scores[121 + array_lower(scores,1)] as score from resultmatch
WHERE resultset_id in %(uuids)s limit 1000) s;"""
cur.execute(sql, {'uuids': tuple(uuids)})
sqlScore = """WITH score_idx AS (SELECT %(score_idx)s id)
SELECT max(score) FROM (
SELECT scores[score_idx.id + array_lower(scores,1)] as score from resultmatch, score_idx
WHERE resultset_id in (%(uuids)s)
AND scores[score_idx.id + array_lower(scores,1)] != 'NaN' limit 1000) s;"""
cur.execute(sqlScore, {'uuids': tuple(uuids), 'score_idx': main_score_index})
max_score = cur.fetchone()
if max_score <1:
if max_score['max'] < 1:
score_factor = 100
else
else:
score_factor = 1

# todo - the join to matchedspectrum for cleavable crosslinker - needs a GROUP BY match_id?'
Expand Down

0 comments on commit fb83ae1

Please sign in to comment.