Method: Ms::Sequest::Srf::Out::Peptide.update_deltacns_from_xcorr

Defined in:
lib/ms/sequest/srf.rb

.update_deltacns_from_xcorr(ar) ⇒ Object

(assumes sorted) recalculates deltacn from xcorrs and sets deltacn_orig_updated and deltacn



639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/ms/sequest/srf.rb', line 639

def self.update_deltacns_from_xcorr(ar)
  if ar.size > 0
    top_score = ar.first[4]
    other_scores = (1...(ar.size)).to_a.map do |i|
      1.0 - (ar[i][4]/top_score)
    end
    ar.first[21] = 0.0
    (0...(ar.size-1)).each do |i|
      ar[i][20] = other_scores[i]    # deltacn
      ar[i+1][21] = other_scores[i]  # deltacn_orig_updated
    end
    ar.last[20] = 1.1
  end
end