package vsv;
import java.util.List;
import java.util.Vector;
import reaction.Item;
import reaction.Reaction;
import tables.DimensionMap;
public class VSVModelExplicit {
public static String k_TRANSCRIPTION = "k_TRANSCRIPTION", ratio_TRANSCRIPTION_2_REPLICATION = "ratio_TRANSCRIPTION_2_REPLICATION", ratio_GENOME_2_ANTIGENOME = "ratio_GENOME_2_ANTIGENOME", stoich_ERROR = "stoich_ERROR",
k_POL_FORMATION = "k_POL_FORMATION", k_CONDENSATION = "k_CONDENSATION", k_DETECTION = "k_DETECTION";
public Virus virus;
public Cell cell;
public Vector<Reaction> rxns;
double moi = 1;
public VSVModelExplicit()
{
this.initializeVirus();
this.initializeCell();
this.initializeRxns();
}
public void initializeRxns()
{
this.rxns = new Vector<Reaction>();
// this.initializeDegradation();
// this.initializeDetection();
// this.initializePackaging();
// this.initializeProteinInteractions();
// this.initializeReplication();
this.initializeGenomePolymeraseInteraction();
this.initializeTranscription();
this.initializeTranslation();
}
/**
* updates parameter with a DimensionMap containing the values entered in JEX - for future use
*
* @param params
*/
public void setParams(DimensionMap params)
{
// Virus Parameters
this.virus.setParams(params);
this.cell.setParams(params);
this.initializeRxns();
}
/**
* updates parameter with numbers entered in JEX - for future use
*
* @param PARAM_polymeraseOnRate_Transcription
* @param PARAM_transcriptionToReplicationRatio
* @param PARAM_genToAntiGenoRepRatio
* @param PARAM_detectableGenomeStoich
* @param PARAM_PLPol_rate
* @param PARAM_genomeMcondensationRate
* @param PARAM_detectionRateConstant
*/
public void setParams(double PARAM_polymeraseOnRate_Transcription, double PARAM_transcriptionToReplicationRatio, double PARAM_genToAntiGenoRepRatio, double PARAM_detectableGenomeStoich, double PARAM_PLPol_rate, double PARAM_genomeMcondensationRate, double PARAM_detectionRateConstant, double PARAM_polymeraseNtPerSec_Transcription, double PARAM_polymeraseSpacing)
{
// Virus Parameters
DimensionMap params = new DimensionMap();
params.put(VSVModel.k_TRANSCRIPTION, "" + PARAM_polymeraseOnRate_Transcription);
params.put(VSVModel.ratio_TRANSCRIPTION_2_REPLICATION, "" + PARAM_transcriptionToReplicationRatio);
params.put(VSVModel.ratio_GENOME_2_ANTIGENOME, "" + PARAM_genToAntiGenoRepRatio);
params.put(VSVModel.stoich_ERROR, "" + PARAM_detectableGenomeStoich);
params.put(VSVModel.k_POL_FORMATION, "" + PARAM_PLPol_rate);
params.put(VSVModel.k_CONDENSATION, "" + PARAM_genomeMcondensationRate);
// params.put(VSVModel.pol_SPEED, "" + PARAM_polymeraseNtPerSec_Transcription);
// params.put(VSVModel.pol_SPACING, "" + PARAM_polymeraseSpacing);
// Cell Parameters
params.put(VSVModel.k_DETECTION, "" + PARAM_detectionRateConstant);
this.virus.setParams(params);
this.cell.setParams(params);
this.initializeRxns();
}
/**
*
* @return reactions
*/
public Vector<Reaction> getRxns()
{
return this.rxns;
}
/**
* adds a transcription reaction to the reaction vector (rxns) with a cell pool virus genome definition (VSV) virus polymerase PARAM_polymeraseOnRate_Transcription template binding rate polymerase transcription rate on template polymerase spacing
*
*/
private void initializeTranscription()
{
// ////////////////////////////////////////////////////////////////////////////////
// Transcription (you will need a transcription reaction for each
// template)
// ////////////////////////////////////////////////////////////////////////////////
//
// genPolComplex + Pol -> genPol_transcription
// template1 + pol -> transcripts + template + pol, ktranscription
//
this.rxns.add(new ExplicitTranscriptionRxn(this.cell, this.virus.genPolComplex, this.virus.genome, Virus.POLYMERASE, this.virus.PARAM_polymeraseOnRate_Transcription, this.virus.PARAM_polymeraseNtPerSec_Transcription, this.virus.PARAM_polymeraseSpacing));
}
/**
* adds a translation reaction to the reaction vector (rxns) with a cell pool gene ribosome ribosome binding rate ribosome translation rate on template ribosome spacing
*/
private void initializeTranslation()
{
// Translation (Each transcript must have a translation reaction, so use
// a loop to add from each template)
// transcript + ribosome -> protein + transcript + ribosome,
// ktranslation
List<Gene> proteinList = new Vector<Gene>();
for (Gene g : this.virus.genome)
{
// if the protein has not already been added and it encodes a
// protein
if(!proteinList.contains(g) && g.encodesProtein)
{
// add gene to a list of genes to ensure no duplication
proteinList.add(g);
// add reaction to translate this gene
this.rxns.add(new TranslationRxn(this.cell, g, Cell.PROTEIN_RIBOSOME, this.cell.ribosomeOnRate, this.cell.PARAM_ribosomeRate, this.cell.PARAM_ribosomeSpacing));
}
}
}
/**
* adds a first order degradation reaction for transcripts, proteins, genomes and antigenomes
*/
private void initializeDegradation()
{
// ////////////////////////////////////////////////////////////////////////////////
// Degradation of transcripts, proteins, templates
// ////////////////////////////////////////////////////////////////////////////////
//
// item --> 0, kDeg_Item
//
// add things in a loop to be simple
// transcripts
List<Gene> transcriptList = new Vector<Gene>();
for (Gene g : this.virus.genome)
{
// if the transcript has not already been added and it encodes a
// protein
if(!transcriptList.contains(g) && g.encodesTranscript)
{
// add gene to a list of genes to ensure no duplication
transcriptList.add(g);
// add reaction to degrade this gene
this.rxns.add(new FirstOrderDegradationRxn(g.name, this.cell.transcripts, Virus.transcript_degConstant));
}
}
// proteins
List<Gene> proteinList = new Vector<Gene>();
for (Gene g : this.virus.genome)
{
// if the protein has not already been added and it encodes a
// protein
if(!proteinList.contains(g) && g.encodesProtein)
{
// add gene to a list of genes to ensure no duplication
proteinList.add(g);
// add reaction to translate this gene
this.rxns.add(new FirstOrderDegradationRxn(g.name, this.cell.proteins, g.proteinDegradationRate));
}
}
// genomes and templates
this.rxns.add(new FirstOrderDegradationRxn(this.virus.genomeName(), this.virus.genomeFullname(), this.cell.templates, Virus.nucleocapsid_degConstant));
this.rxns.add(new FirstOrderDegradationRxn(this.virus.antiGenomeName(), this.virus.antiGenomeFullname(), this.cell.templates, Virus.nucleocapsid_degConstant));
this.rxns.add(new FirstOrderDegradationRxn(this.virus.condensedGenomeName(), this.virus.condensedGenomeFullname(), this.cell.templates, Virus.nucleocapsid_degConstant));
}
private void initializeGenomePolymeraseInteraction()
{
// ////////////////////////////////////////////////////////////////////////////////
// Genome-polymerase complexing (make sure ot add complexing for antigenome
// ////////////////////////////////////////////////////////////////////////////////
// gen+Pol -> genPol
// Agen+Pol-> AgenPol
double tSpacing = this.virus.PARAM_polymeraseSpacing / this.virus.PARAM_polymeraseNtPerSec_Transcription;
double kRxn = this.virus.PARAM_polymeraseOnRate_Transcription;
// kRxn=1/tSpacing;
//
this.rxns.add(new TwoBodyOneProductRxn(this.virus.genomeName(), this.cell.templates, 1, 1, Virus.POLYMERASE, this.cell.proteins, 1.0, 1.0, this.virus.genPolComplex.name, this.cell.templates, 1, kRxn));
//
this.rxns.add(new TwoBodyOneProductRxn(this.virus.antiGenomeName(), this.cell.templates, 1, 1, Virus.POLYMERASE, this.cell.proteins, 1.0, 1.0, this.virus.AgenPolComplex.name, this.cell.templates, 1, kRxn));
}
/**
* adds a replication reaction with a cell virus genome virus antiGenome Virus POLYMERASE N protein polymeraseOnRate_GenomeReplication polymeraseNtPerSec_Replication polymeraseSpacing virus.errorGenomeName??? virus.PARAM_detectableGenomeStoich
* ???
*/
private void initializeReplication()
{
// ////////////////////////////////////////////////////////////////////////////////
// Replication (must add 2 reactions for each template type)
// ////////////////////////////////////////////////////////////////////////////////
// genome + pol + N -> antigenome + genome + pol
this.rxns.add(new ExplicitReplicationAndErrorRxn(this.cell, this.virus.genPolComplex, this.virus.genome, this.virus.antiGenome, Virus.POLYMERASE, Virus.N.name, this.virus.polymeraseOnRate_GenomeReplication, this.virus.polymeraseNtPerSec_Replication, this.virus.PARAM_polymeraseSpacing, this.virus.errorGenomeFullname(), this.virus.errorGenomeName(), this.virus.PARAM_detectableGenomeStoich));
// antigenome + pol + N -> genome + antigenome + pol + detectableGenome
this.rxns.add(new ExplicitReplicationAndErrorRxn(this.cell, this.virus.AgenPolComplex, this.virus.antiGenome, this.virus.genome, Virus.POLYMERASE, Virus.N.name, this.virus.polymeraseOnRate_AntiGenomeReplication, this.virus.polymeraseNtPerSec_Replication, this.virus.PARAM_polymeraseSpacing, this.virus.errorAntiGenomeName(), this.virus.errorAntiGenomeName(), this.virus.PARAM_detectableGenomeStoich));
}
/**
* L and P interacts to make polymerase
*/
private void initializeProteinInteractions()
{
// ////////////////////////////////////////////////////////////////////////////////
// Protein Interactions
// ////////////////////////////////////////////////////////////////////////////////
// L + 3.6 P -> polymerase, krxn
this.rxns.add(new TwoBodyOneProductRxn(Virus.L.name, this.cell.proteins, 1.0, 1.0, Virus.P.name, this.cell.proteins, 3.6, 1.0, Virus.POLYMERASE, this.cell.proteins, 1.0, this.virus.PARAM_PLPol_rate));
}
/**
* initialize packaging based on the M protein and genome availability at genomeMcondensationRate (will be followed by condensation of this complex with other proteins)
*/
private void initializePackaging()
{
// ////////////////////////////////////////////////////////////////////////////////
// Packaging
// ////////////////////////////////////////////////////////////////////////////////
// genome + M -> genM, k (template protein reaction produce template)
// rate = k*M^2*template
this.rxns.add(new TwoBodyOneProductRxn(Virus.M.name, this.cell.proteins, this.virus.getComposition().get(Virus.M.name), 2.0, this.virus.genome.fullname, this.cell.templates, 1.0, 1.0, this.virus.condensedGenomeFullname(), this.cell.templates, 1.0, this.virus.PARAM_genomeMcondensationRate));
// genM + pol -> virion, kpack
// genM + pol + G -> virion, kpack (equal to kpack above, so G enhances
// the packing rate) (model as 1 equation)
// Take this out for now to help troubleshoot.
// this.rxns.add(new
// PackagingRxn(cell,Virus.POLYMERASE,Virus.G.name,virus.condensedGenomeName(),virus.name,virus.packagingRateConstant));
}
/**
* initialize the detection reactions of detectable ("error") genomes by proteins
*/
private void initializeDetection()
{
// ////////////////////////////////////////////////////////////////////////////////
// Detection and response to bad genomes
// ////////////////////////////////////////////////////////////////////////////////
// detectableGenome+detectionProtein --> responseProtein
this.rxns.add(new TwoBodyOneProductRxn(this.virus.errorGenomeFullname(), this.cell.templates, 1.0, 1.0, Cell.PROTEIN_DETECTION, this.cell.proteins, 1.0, 1.0, Cell.PROTEIN_RESPONSE, this.cell.proteins, 1.0, this.cell.PARAM_detectionRateConstant));
// responseProtein --> AVProduct ???
}
/**
* initialize the virus as a list of genes. This call will do all the work in naming the virus
*/
private void initializeVirus()
{
// N1 virus
this.virus = new Virus(new Gene[] { Virus.Le, Virus.IG1, Virus.N, Virus.IG2, Virus.P, Virus.IG3, Virus.M, Virus.IG4, Virus.G, Virus.IG5, Virus.L, Virus.IG6, Virus.TrC }, "VSVN1");
}
/**
* initializes a cell by initializing template and protein pools by adding viral genomes, polymerase, ribosomes and detection proteins
*/
private void initializeCell()
{
this.cell = new Cell();
// Load up Cell with goodies (infect the cell and add other ribosomes
// and proteins)
this.cell.templates.initialize(new Item(this.virus.genPolComplex.name, this.moi, 0.0));
this.cell.proteins.initialize(new Item(Virus.POLYMERASE, this.moi * this.virus.getComposition().getComponentCount(Virus.POLYMERASE), 0.0));
this.cell.proteins.initialize(new Item(Cell.PROTEIN_RIBOSOME, this.cell.initialRibosomes, 0.0));
this.cell.proteins.initialize(new Item(Cell.PROTEIN_DETECTION, this.cell.initialDetectionProteins, 0.0));
}
/**
* This method returns a value between 0 and 1 representing the decay of the cell due to a response protein The equation used to calculate the response is sigmoid - NOT IN CURRENT VERSION!!!
*
* @param PROTEIN_RESPONSE
* @return
*/
public double cellDecay(double time)
{
// ////////////////////////////////////////////////
// Cell decay by response to detectable genomes //
// ////////////////////////////////////////////////
// //decay = 1/ (1 + exp( -k * responseProtein + offset))
// double factor=0.1;
// double offset=20;
// double responseConc=cell.proteins.getCount(Cell.PROTEIN_RESPONSE);
// double expTerm=-factor*responseConc+offset;
// double decay=1/(1+Math.exp(expTerm));
// return decay;
// ////////////////////////////////////////////////
// Cell decay according to time //
// ////////////////////////////////////////////////
// double decay;
// try
// {
// decay = 1-StatisticsUtility.normalCDF(time, Cell.halfLife,
// Cell.halfLifeSigma);
// if(decay < 0)
// {
// decay = 0;
// }
// return decay;
// }
// catch (MathException e)
// {
// e.printStackTrace();
// return 0.0;
// }
// ////////////////////////////////////////////////
// Cell decay according to number of genomes //
// ////////////////////////////////////////////////
return 1.0;
// double templates = this.cell.templates.getCount(this.virus.genomeName());// +
// // this.cell.templates.delayedAmounts.getAll().getCount(virus.genomeName());
// double thresh = Math.log10(templates);
// try
// {
// // created sigmoidal decay function for cell activity
// double decay = (1 - StatisticsUtility.normalCDF(templates, Cell.virusProductionMean / 2, Cell.virusProductionMean / 3));
// if(decay < 0)
// {
// decay = 0;
// }
// return decay;
// }
// catch (MathException e)
// {
// e.printStackTrace();
// return 0;
// }
}
}