Skip to content

Instantly share code, notes, and snippets.

@rhliang
rhliang / LabellingPlots.r
Last active December 7, 2015 22:27
Produce histograms to summarize the simulation results produced by pIDLabellingSimulation.r.
## This code assumes you've run pIDLabellingSimulation.r already. Either
## run this immediately after, or load the file created by it, e.g.
## load([file created by pIDLabellingSimulation.r])
symbol.scale <- 1;
axis.scale <- 1;
label.scale <- 1;
text.size <- 0.79;
for (i in 1:length(num.RNA))
@rhliang
rhliang / pIDLabellingSimulation.r
Created December 7, 2015 22:24
Simulates primer ID coverage given the number of molecules and the number of pIDs available.
## Script that simulates the labelling of RNA molecules by pIDs.
simulate.labelling <- function(num.trials, num.molecules, num.pIDs)
{
labelling.trials <-
sapply(1:num.trials,
function (x)
{
pIDs.assigned <- sample(1:num.pIDs, num.molecules, replace=TRUE)
num.distinct.pIDs <- length(unique(pIDs.assigned))