Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yufongpeng committed Jan 4, 2024
1 parent d7659c4 commit 41dcbb6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/quantification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ function transition_matching!(data::MRM, project = nothing; rt_tol = 0.1, mz_tol
data.config[:method] = method
i = 0
for ft in groupview(getproperty(:id), featuretable)
mz1 = mean(getproperty.(ft, :mz1))
mz1 = mean(ft.mz1)
mz2 = data.mz2[first(ft).mz2_id]
id = findfirst(i -> between(mz1, i.mz1, mz_tol) && between(mz2, i.mz2, mz_tol) && between(mean(rt_correction(class(i.analyte), Table(ft; rtx = repeat([i.rt], length(ft)))) .- ft.rt), 0, rt_tol), method.analytetable)
featuretable.match_id[i + 1:i + length(ft)] .= isnothing(id) ? repeat([0.0], length(ft)) : repeat([method.analytetable.id[id]], length(ft))
featuretable.match_score[i + 1:i + length(ft)] .= isnothing(id) ? repeat([0.0], length(ft)) :
begin
mz1 = method.analytetable.mz1[id]
mz2 = method.analytetable.mz2[id]
rty = rt_correction(class(method.analytetable.analyte[id]), Table(ft; rtx = repeat([method.analytetable.rt[id]], length(ft))))
@. (ft.mz1 / mz1 - 1) ^ 2 + (ft.mz2 / mz2 - 1) ^ 2 + (ft.rt / rty - 1) ^ 2
lmz1 = method.analytetable.mz1[id]
lmz2 = method.analytetable.mz2[id]
lrt = rt_correction(class(method.analytetable.analyte[id]), Table(ft; rtx = repeat([method.analytetable.rt[id]], length(ft))))
@. (ft.mz1 / lmz1 - 1) ^ 2 + (mz2 / lmz2 - 1) ^ 2 + (ft.rt / lrt - 1) ^ 2
end
i += length(ft)
end
Expand Down

0 comments on commit 41dcbb6

Please sign in to comment.