Module: ViralSeq::Recency

Defined in:
lib/viral_seq/recency.rb

Overview

recency prediction function based on HIV MPID-NGS

Class Method Summary collapse

Class Method Details

.define(tcs_RT: nil, tcs_V1V3: nil, pi_RT: nil, dist20_RT: nil, pi_V1V3: nil, dist20_V1V3: nil) ⇒ String

Returns determination of the recency.

Returns:

  • (String)

    determination of the recency



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/viral_seq/recency.rb', line 16

def self.define(tcs_RT: nil,
                 tcs_V1V3: nil,
                 pi_RT: nil,
                 dist20_RT: nil,
                 pi_V1V3: nil,
                 dist20_V1V3: nil)
  tcs_RT ||= 0
  tcs_V1V3 ||= 0
  if (tcs_RT >= 3 && pi_RT) and (tcs_V1V3 >= 3 && pi_V1V3)
    if (pi_RT + pi_V1V3) < 0.0103
        recency = "recent"
    elsif (pi_RT + pi_V1V3) >= 0.0103 and (dist20_RT + dist20_V1V3) >= 0.006
        recency = "chronic"
    else
        recency = "indeterminant"
    end
  elsif (tcs_RT >= 3 && pi_RT) and tcs_V1V3 < 3
    if pi_RT < 0.0021
      recency = "recent"
    elsif pi_RT >= 0.0021 and dist20_RT >= 0.001
      recency = "chronic"
    else
      recency = "indeterminant"
    end
  elsif (tcs_V1V3 >= 3 && pi_V1V3)
    if pi_V1V3 >= 0.0103 and dist20_V1V3 >= 0.006
      recency = "chronic"
    else
      recency = "insufficient data"
    end
  else
    recency = "insufficient data"
  end
  return recency
end