matsengrp / antigen

Simulating virus evolution and epidemiology
http://bedford.io/projects/antigen/
1 stars 0 forks source link

Implement a new function of Cross-Immunity #3

Closed thienktran closed 2 years ago

thienktran commented 2 years ago

Description

We want to implement a new function of Cross-Immunity.

Possible Solution

Use the cross-immunity model from L&L paper image

The main difference between L&L and jhudd's paper is

This difference exists because each strain only appears in one timepoint in the L&L method and its frequency is calculated in a single time bin.

matsen commented 2 years ago

All we need to do is to have a function that maps the number of mismatches between the sequences to a number between 0 and 1, which will be the risk of infection given an immune history.

Proposal:

What is f(x, h_i)?

Two options:

The details don't matter much but we need to be able to allow a few functional forms, and each one should have some coefficients associated with it.

thienktran commented 2 years ago

Linear:

Map input numbers in the range [0, dMax] to output range [0, 1] where dMax = the length of the sequence

int input = this.distance(h_i); // hamming distance of x and h_i

int input_start = 0 // The lowest number of the range input. 
int input_end = Parameters.sequence.length(); // The largest number of the range input. 

int output_start = 0; // The lowest number of the range output. 
int output_end = 1; // The largest number of the range output. 

double slope = (double) (output_end - output_start) / (input_end - input_start) 
double output = output_start + Math.round(slope * (input - input_start))

a: output_start b: (input - input_start) x: slope

Since all sequences are the same length, slope only needs to be calculated once.

Exponential:

Something similar to what I wrote above, but using this equation instead?

image

Ideas to allow a few functional forms in riskOfInfection()

@matsen