# rvencio jul-08-2014 # # to run simulation just change parameters and copy-paste the code below into your R section # model parameters t_stall = c(30, 50, 80) # time spent stalled (units of time) t_iti = 10 # intrinsic transcription initiation interval (unit of time) x_stall = c(35, 40, 55) # position where pausing site(s) ir(are) (bp) t_atabase = 1 # normal (non-paused) time spent at each base transcribing (units of time) L = 1000 # gene length (bp) # simulation parameters T = 1E5 # total simulation time #starting simulation DNAtime = rep(t_atabase, L) # all bases along gene hold RNApol for the same amount of time DNAtime[x_stall] = t_stall # except at these positions where RNApol pauses longer times transcript = NULL # inicialization of list of transcripts produced t = 1 # clock ticks for the 1st time with the 1st RNApol to arrive polx = 1 # the 1st RNApol to arrive starts at genomic position x=1 polt = 1 # the 1st RNApol to arrive already spent 1 time unit at arriving position while(t < T){ # simulation goes on until time is up if(t %% t_iti == 0){ # a new RNApol must arrive and start new transcript if it is time if(all(polx != 1)){ # ... but only if there is no other RNApol at position x=1 polx = c(polx, 1) # start a new RNApol at x=1 polt = c(polt, 0) # start timer for this new RNApol } } if(length(polx) == 0){ break } # no RNApols, nothing to do, finish simulation for(i in length(polx):1){ # update every single RNApol available to new status if(polt[i] >= DNAtime[polx[i]]){ # is it time to leave current position? if(any(polx[i]+1 == polx)){ # if next base occupied then transcript = c(transcript, polx[i]) # release transcript up to here polx = polx[-i] # release this RNApol from DNA and from our list polt = polt[-i] # release this RNApol from DNA and from our list }else{ # if next position is available if(polx[i] + 1 > L){ # if next position is outside gene transcript = c(transcript, polx[i]) # transcript is over polx = polx[-i] # release RNApol from our list polt = polt[-i] # her job is over }else{ # if next position is valid polx[i] = polx[i] + 1 # move RNApol fwd polt[i] = 1 # and wait there for another time unit } } }else{ # if it is not time to leave current position polt[i] = polt[i] + 1 # just wait there for another time unit } } t = t + 1 # clock ticks } #end of simulation # save the number of molecules transcribed by all RNApol depending on transcript size output = table(transcript) # show output at your screen print(output)