Custom Simulations

This is an example of building a custom simulation of a FACS-based screen.

Tip

This section is complementary to the Implementation section of the paper

Setup

Lets first start the Julia REPL or a Julia session inside of a Jupyter Notebook and load the packages we'll need:

using Crispulator
using Gadfly

Basic screen parameters

First lets design a simple Crispulator.FacsScreen with 250 genes with 5 guides per gene. Lets say that we make sure we have 1000x as many cells as guides during transfection (representation) and sorting (bottleneck_representation) and 1000x as many reads as guides during sequencing (seq_depth). We'll leave the rest of the values as the defaults and print the object

s = FacsScreen()
s.num_genes = 250
s.coverage = 5
s.representation = 1000
s.bottleneck_representation = 1000
s.seq_depth = 1000
println(s)
FacsScreen <: ScreenSetup

    Number of genes: 250
    Number of guides per gene: 5 (1250 guides total)
    Cells per guide at transfection: 1000 (1250000 cells total)
    Multiplicity of infection (M.O.I.): 0.25
    Number of cells per guide at sequencing: 1000 (1250000 cells total)

    Number of cells per guide sorted: 1000 (1250000 cells total)
    Gaussian standard deviation of sorting: 1.0 (phenotype units)
    Bins:
        bin1: 0-33 percentile of cells
        bin2: 67-100 percentile of cells

Construction of true phenotype distribution

Next, lets make our distribution of true phenotypes. The basic layout is a Dict mapping a class name to a tuple of the probability of selecting this class and then the Distributions.Sampleable from which to draw a random phenotype from this class. The probabilities across all the classes should add up to 1.

For example, here we are making three different classes of "genes": the first group are :inactive, i.e. they have no phenotype, so we'll set their phenotypes to 0.0 using a Crispulator.Delta. We'll also make them 60% of all the genes. The second group are the negative controls :negcontrol (the only required group) which make up 10% of the population of genes and also have no effect. The final group is :increasing which makes up 30% of all genes and which are represented by a Normal(μ=0.1, σ=0.1) distribution clamped between 0.025 and 1.

max_phenotype_dists = Dict{Symbol, Tuple{Float64, Sampleable}}(
    :inactive => (0.60, Delta(0.0)),
    :negcontrol => (0.1, Delta(0.0)),
    :increasing => (0.3, truncated(Normal(0.1, 0.1), 0.025, 1)),
);
Dict{Symbol, Tuple{Float64, Distributions.Sampleable}} with 3 entries:
  :negcontrol => (0.1, Delta(0.0))
  :inactive   => (0.6, Delta(0.0))
  :increasing => (0.3, Truncated(Distributions.Normal{Float64}(μ=0.1, σ=0.1); l…
Note

The :negcontrol class needs to be present because Crispulator normalizes the frequencies of all other guides against the median frequency of the negative control guides. Also the distribution of :negcontrol guides serve as the null distribution against which the log2 fold changes of guides targeting a specific gene are assayed to calculate a statistical significance of the shift for each gene. See Crispulator.differences_between_bins for more details.

Library construction

Now, we actually build the library. Here we're making a Crispulator.CRISPRi library and then getting the guides that were built from the true phenotype distribution that we constructed above and we also get the frequency of each guide in the library.

lib = Library(max_phenotype_dists, CRISPRi())
guides, guide_freqs_dist = construct_library(s, lib);
(Crispulator.Barcode[Crispulator.Barcode(1, 0.878120833563954, 0.02601178650831795, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(1, 0.965258105212688, 0.028592975816678773, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(1, 0.6715851400901364, 0.019893764751353144, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(1, 0.8544841624248554, 0.025311618581607694, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(1, 0.9852213704566297, 0.029184329732547937, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(2, 0.8380539512951146, 0.0, NaN, :linear, :inactive, -Inf), Crispulator.Barcode(2, 0.8245079147510144, 0.0, NaN, :linear, :inactive, -Inf), Crispulator.Barcode(2, 0.7575091121895536, 0.0, NaN, :linear, :inactive, -Inf), Crispulator.Barcode(2, 0.0515177239881524, 0.0, NaN, :linear, :inactive, -Inf), Crispulator.Barcode(2, 0.7280375459151591, 0.0, NaN, :linear, :inactive, -Inf)  …  Crispulator.Barcode(249, 0.8727877400094837, 0.0, NaN, :sigmoidal, :negcontrol, -Inf), Crispulator.Barcode(249, 0.9048341862531871, 0.0, NaN, :sigmoidal, :negcontrol, -Inf), Crispulator.Barcode(249, 0.9942189015695218, 0.0, NaN, :sigmoidal, :negcontrol, -Inf), Crispulator.Barcode(249, 0.9724247798455464, 0.0, NaN, :sigmoidal, :negcontrol, -Inf), Crispulator.Barcode(249, 0.9407497886099611, 0.0, NaN, :sigmoidal, :negcontrol, -Inf), Crispulator.Barcode(250, 0.7458915279599929, 0.22431119015876855, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(250, 0.9839303489047019, 0.295896359353721, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(250, 0.8343090367030173, 0.2509008964009943, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(250, 0.9771582168942925, 0.29385978307657534, NaN, :linear, :increasing, -Inf), Crispulator.Barcode(250, 0.6666785376725564, 0.20048954926145715, NaN, :linear, :increasing, -Inf)], Distributions.Categorical{Float64, Vector{Float64}}(
support: Base.OneTo(1250)
p: [0.0007827106886745094, 0.0005121104490352278, 0.0003537343914889569, 0.0005651772283505308, 0.00015159386514736474, 0.0007283282074873836, 0.0028838202139263775, 0.0006046840669220868, 0.0003547646012889437, 0.00013371127911394548  …  0.0005789135617149528, 0.0011189923130810423, 0.0011109256391882178, 0.0002562241704448103, 0.00045358134346869657, 0.00031573307674935845, 0.00041388113433962574, 0.0002437956549870102, 0.0005827199496525896, 0.0006209619491373765]
)
)

Lets first look at what the true phenotype distribution of our different classes of guides looks like

df = DataFrame(Dict(
    :phenotype=>map(x->x.theo_phenotype, guides),
    :class=>map(x->x.class, guides),
    :freq=>pdf.(guide_freqs_dist, 1:(length(guides)))
))
plot(df, x=:phenotype, color=:class, Geom.histogram, Guide.ylabel("Number of guides"),
Guide.title("Guide phenotype distribution"))
phenotype -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15 -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 -0.5 0.0 0.5 1.0 -0.40 -0.38 -0.36 -0.34 -0.32 -0.30 -0.28 -0.26 -0.24 -0.22 -0.20 -0.18 -0.16 -0.14 -0.12 -0.10 -0.08 -0.06 -0.04 -0.02 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 increasing inactive negcontrol class h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -1500 -1000 -500 0 500 1000 1500 2000 2500 -1000 -900 -800 -700 -600 -500 -400 -300 -200 -100 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 -1000 0 1000 2000 -1000 -950 -900 -850 -800 -750 -700 -650 -600 -550 -500 -450 -400 -350 -300 -250 -200 -150 -100 -50 0 50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 1650 1700 1750 1800 1850 1900 1950 2000 Number of guides Guide phenotype distribution

As you can see, most guides should have a phenotype of 0. In FACS Screens this is equivalent to having no preference to being in either the left (bin1) or right (bin2) bins. The :increasing genes have a small preference to be in the right bin.

We can also look at the frequency of each guide in the library, which follows a Log-Normal distribution.

plot(df, x=:freq, color=:class, Geom.histogram(position=:stack),
    Guide.xlabel("Frequency"), Guide.ylabel("Number of guides"),
    Guide.title("Frequencies of guides in simulated library"))
Frequency -0.007 -0.006 -0.005 -0.004 -0.003 -0.002 -0.001 0.000 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.010 0.011 0.012 0.013 -0.0060 -0.0055 -0.0050 -0.0045 -0.0040 -0.0035 -0.0030 -0.0025 -0.0020 -0.0015 -0.0010 -0.0005 0.0000 0.0005 0.0010 0.0015 0.0020 0.0025 0.0030 0.0035 0.0040 0.0045 0.0050 0.0055 0.0060 0.0065 0.0070 0.0075 0.0080 0.0085 0.0090 0.0095 0.0100 0.0105 0.0110 0.0115 0.0120 -0.01 0.00 0.01 0.02 -0.0060 -0.0058 -0.0056 -0.0054 -0.0052 -0.0050 -0.0048 -0.0046 -0.0044 -0.0042 -0.0040 -0.0038 -0.0036 -0.0034 -0.0032 -0.0030 -0.0028 -0.0026 -0.0024 -0.0022 -0.0020 -0.0018 -0.0016 -0.0014 -0.0012 -0.0010 -0.0008 -0.0006 -0.0004 -0.0002 0.0000 0.0002 0.0004 0.0006 0.0008 0.0010 0.0012 0.0014 0.0016 0.0018 0.0020 0.0022 0.0024 0.0026 0.0028 0.0030 0.0032 0.0034 0.0036 0.0038 0.0040 0.0042 0.0044 0.0046 0.0048 0.0050 0.0052 0.0054 0.0056 0.0058 0.0060 0.0062 0.0064 0.0066 0.0068 0.0070 0.0072 0.0074 0.0076 0.0078 0.0080 0.0082 0.0084 0.0086 0.0088 0.0090 0.0092 0.0094 0.0096 0.0098 0.0100 0.0102 0.0104 0.0106 0.0108 0.0110 0.0112 0.0114 0.0116 0.0118 0.0120 increasing inactive negcontrol class h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -100 -80 -60 -40 -20 0 20 40 60 80 100 120 140 160 180 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 -100 0 100 200 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 Number of guides Frequencies of guides in simulated library

Performing the screen

Now, we'll actually perform the screen. We'll first perform the transection via Crispulator.transfect, followed by the selection process via Crispulator.select:

cells, cell_phenotypes = transfect(s, lib, guides, guide_freqs_dist)
bin_cells = Crispulator.select(s, cells, cell_phenotypes, guides)
freqs = counts_to_freqs(bin_cells, length(guides));
Dict{Symbol, Vector{Float64}} with 2 entries:
  :bin1 => [0.000836158, 0.000423215, 0.000285568, 0.000585516, 0.00014792, 0.0…
  :bin2 => [0.000780687, 0.000433487, 0.000256805, 0.000540317, 0.000156137, 0.…

Lets look at what the observed phenotype distribution looks like when the selection was performed:

df = DataFrame(Dict(
    :phenotype=>map(x->x.theo_phenotype, guides),
    :class=>map(x->x.class, guides),
    :obs_freq=>map(x->x.obs_phenotype, guides)
))
plot(df, x=:obs_freq, Geom.density, Guide.xlabel("Observed phenotype on FACS machine"),
Guide.title("Kernel density estimate of guide observed phenotypes"), Guide.ylabel("ρ"))
Observed phenotype on FACS machine -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -40 -20 0 20 -25.0 -24.5 -24.0 -23.5 -23.0 -22.5 -22.0 -21.5 -21.0 -20.5 -20.0 -19.5 -19.0 -18.5 -18.0 -17.5 -17.0 -16.5 -16.0 -15.5 -15.0 -14.5 -14.0 -13.5 -13.0 -12.5 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15 -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 -0.5 0.0 0.5 1.0 -0.40 -0.38 -0.36 -0.34 -0.32 -0.30 -0.28 -0.26 -0.24 -0.22 -0.20 -0.18 -0.16 -0.14 -0.12 -0.10 -0.08 -0.06 -0.04 -0.02 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 ρ Kernel density estimate of guide observed phenotypes

As you can see, this looks like many FACS plots, e.g. when looking at density along the fluorescence channel. A quick sanity check is that we should see a slight enrichment of the frequency of :increasing genes on the right side

plot(df, x=:obs_freq, color=:class, Geom.density, Guide.xlabel("Observed phenotype on FACS machine"),
Guide.title("Kernel density estimate of guide observed phenotypes"), Guide.ylabel("ρ"))
Observed phenotype on FACS machine -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -40 -20 0 20 -25.0 -24.5 -24.0 -23.5 -23.0 -22.5 -22.0 -21.5 -21.0 -20.5 -20.0 -19.5 -19.0 -18.5 -18.0 -17.5 -17.0 -16.5 -16.0 -15.5 -15.0 -14.5 -14.0 -13.5 -13.0 -12.5 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 increasing inactive negcontrol class h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 -0.50 -0.45 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15 -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 -0.5 0.0 0.5 1.0 -0.50 -0.48 -0.46 -0.44 -0.42 -0.40 -0.38 -0.36 -0.34 -0.32 -0.30 -0.28 -0.26 -0.24 -0.22 -0.20 -0.18 -0.16 -0.14 -0.12 -0.10 -0.08 -0.06 -0.04 -0.02 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 ρ Kernel density estimate of guide observed phenotypes

And that is what we see. The change is really small (this is pretty usual), but the later analysis will be able to pull out the increasing genes.

Sequencing and Analysis

Now we'll use Crispulator.sequencing to simulate sequencing by transforming the guide frequencies into a Categorical distribution and drawing a random sample of reads from this distribution. Finally, we'll use the Crispulator.differences_between_bins function to compute the differences between bins on a per-guide level (guide_data) and per-gene level (gene_data).

raw_data = sequencing(Dict(:bin1=>s.seq_depth, :bin2=>s.seq_depth), guides, freqs)
guide_data, gene_data = differences_between_bins(raw_data);
(1250×17 DataFrame
  Row │ gene   knockdown  theo_phenotype  behavior   class       initial_freq  ⋯
      │ Int64  Float64    Float64         Symbol     Symbol      Float64       ⋯
──────┼─────────────────────────────────────────────────────────────────────────
    1 │     1  0.878121        0.0260118  linear     increasing   0.000801233  ⋯
    2 │     1  0.965258        0.028593   linear     increasing   0.000431433
    3 │     1  0.671585        0.0198938  linear     increasing   0.000275295
    4 │     1  0.854484        0.0253116  linear     increasing   0.000567026
    5 │     1  0.985221        0.0291843  linear     increasing   0.000139702  ⋯
    6 │     2  0.838054        0.0        linear     inactive     0.000813559
    7 │     2  0.824508        0.0        linear     inactive     0.00292142
    8 │     2  0.757509        0.0        linear     inactive     0.000624551
  ⋮   │   ⋮        ⋮            ⋮             ⋮          ⋮            ⋮        ⋱
 1244 │   249  0.972425        0.0        sigmoidal  negcontrol   0.000287622  ⋯
 1245 │   249  0.94075         0.0        sigmoidal  negcontrol   0.000419106
 1246 │   250  0.745892        0.224311   linear     increasing   0.000320493
 1247 │   250  0.98393         0.295896   linear     increasing   0.000439651
 1248 │   250  0.834309        0.250901   linear     increasing   0.000242424  ⋯
 1249 │   250  0.977158        0.29386    linear     increasing   0.000677966
 1250 │   250  0.666679        0.20049    linear     increasing   0.000579353
                                                11 columns and 1235 rows omitted, 214×7 DataFrame
 Row │ gene   behavior   class       pvalue_bin2_div_bin1  mean_bin2_div_bin1  ⋯
     │ Int64  Symbol     Symbol      Float64               Float64             ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │     1  linear     increasing             0.0164375           0.0498722  ⋯
   2 │     2  linear     inactive               0.51767            -0.0181567
   3 │     3  linear     increasing             3.61572             0.620516
   4 │     4  linear     increasing             1.23321             0.235206
   5 │     5  sigmoidal  increasing             3.09029             0.364646   ⋯
   6 │     6  linear     inactive               0.044653            0.107356
   7 │     7  linear     increasing             3.52993             0.49624
   8 │     8  sigmoidal  inactive               0.124439            0.103894
  ⋮  │   ⋮        ⋮          ⋮                ⋮                    ⋮           ⋱
 208 │   242  linear     inactive               0.0544275           0.108626   ⋯
 209 │   243  sigmoidal  inactive               0.611977            0.172729
 210 │   244  sigmoidal  increasing             0.0918785           0.0978016
 211 │   245  linear     inactive               1.19167            -0.030791
 212 │   247  linear     increasing             2.41616             0.655583   ⋯
 213 │   248  linear     increasing             3.57269             0.544639
 214 │   250  linear     increasing             3.82001             0.796165
                                                  2 columns and 199 rows omitted)

Here's what the per-guide data looks like:

10×17 DataFrame
Rowgeneknockdowntheo_phenotypebehaviorclassinitial_freqcountsbarcodeidfreqsrel_freqscounts_bin1freqs_bin1rel_freqs_bin1counts_bin2freqs_bin2rel_freqs_bin2log2fc_bin2_div_bin1
Int64Float64Float64SymbolSymbolFloat64Float64Int64Float64Float64Float64Float64Float64Float64Float64Float64Float64
110.8781210.0260118linearincreasing0.0008012331032.510.0008255871.185421032.50.0008255871.185421009.50.0008071961.305950.139703
210.9652580.028593linearincreasing0.000431433528.520.0004225890.606774528.50.0004225890.606774539.50.0004313840.697930.201924
310.6715850.0198938linearincreasing0.000275295371.530.0002970510.426521371.50.0002970510.426521304.50.0002434780.39392-0.114716
410.8544840.0253116linearincreasing0.000567026832.540.0006656670.955798832.50.0006656670.955798642.50.0005137430.831177-0.20155
510.9852210.0291843linearincreasing0.000139702191.550.0001531230.219862191.50.0001531230.219862198.50.0001587210.2567920.223999
620.8380540.0linearinactive0.0008135591011.560.0008087961.161311011.50.0008087961.16131964.50.0007712141.247740.103561
720.8245080.0linearinactive0.002921423849.570.003078064.419633849.50.003078064.419633557.50.002844584.60220.058397
820.7575090.0linearinactive0.000624551758.580.0006064970.870838758.50.0006064970.870838732.50.0005857070.9476070.121884
920.05151770.0linearinactive0.000299949373.590.0002986510.428817373.50.0002986510.428817327.50.0002618690.423674-0.017409
1020.7280380.0linearinactive0.000115049146.5100.0001171410.168197146.50.0001171410.168197101.58.11594e-50.131307-0.357217
Tip

See Crispulator.differences_between_bins for details on what each column means.

And the gene level data

10×7 DataFrame
Rowgenebehaviorclasspvalue_bin2_div_bin1mean_bin2_div_bin1absmean_bin2_div_bin1pvalmeanprod_bin2_div_bin1
Int64SymbolSymbolFloat64Float64Float64Float64
11linearincreasing0.01643750.04987220.04987220.000819775
22linearinactive0.51767-0.01815670.0181567-0.00939919
33linearincreasing3.615720.6205160.6205162.24361
44linearincreasing1.233210.2352060.2352060.290059
55sigmoidalincreasing3.090290.3646460.3646461.12686
66linearinactive0.0446530.1073560.1073560.00479377
77linearincreasing3.529930.496240.496241.75169
88sigmoidalinactive0.1244390.1038940.1038940.0129284
99linearincreasing3.238030.3812130.3812131.23438
1010sigmoidalinactive0.3984350.1377110.1377110.0548688

We can generate standard pooled screen plots from this dataset. Like a count scatterplot:

nopseudo = guide_data[(guide_data[!, :counts_bin1] .> 0.5) .& (guide_data[!, :counts_bin2] .> 0.5), :]
plot(nopseudo, x=:counts_bin1, y=:counts_bin2, color=:class, Scale.x_log10,
Scale.y_log10, Theme(highlight_width=0pt), Coord.cartesian(fixed=true),
Guide.xlabel("log counts bin1"), Guide.ylabel("log counts bin2"))
log counts bin1 10-5 10-4 10-3 10-2 10-1 100 101 102 103 104 105 106 107 108 109 10-4.0 10-3.5 10-3.0 10-2.5 10-2.0 10-1.5 10-1.0 10-0.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 104.5 105.0 105.5 106.0 106.5 107.0 107.5 108.0 10-5 100 105 1010 10-4.0 10-3.8 10-3.6 10-3.4 10-3.2 10-3.0 10-2.8 10-2.6 10-2.4 10-2.2 10-2.0 10-1.8 10-1.6 10-1.4 10-1.2 10-1.0 10-0.8 10-0.6 10-0.4 10-0.2 100.0 100.2 100.4 100.6 100.8 101.0 101.2 101.4 101.6 101.8 102.0 102.2 102.4 102.6 102.8 103.0 103.2 103.4 103.6 103.8 104.0 104.2 104.4 104.6 104.8 105.0 105.2 105.4 105.6 105.8 106.0 106.2 106.4 106.6 106.8 107.0 107.2 107.4 107.6 107.8 108.0 increasing inactive negcontrol class h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 10-5 10-4 10-3 10-2 10-1 100 101 102 103 104 105 106 107 108 109 10-4.0 10-3.5 10-3.0 10-2.5 10-2.0 10-1.5 10-1.0 10-0.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 104.5 105.0 105.5 106.0 106.5 107.0 107.5 108.0 10-5 100 105 1010 10-4.0 10-3.8 10-3.6 10-3.4 10-3.2 10-3.0 10-2.8 10-2.6 10-2.4 10-2.2 10-2.0 10-1.8 10-1.6 10-1.4 10-1.2 10-1.0 10-0.8 10-0.6 10-0.4 10-0.2 100.0 100.2 100.4 100.6 100.8 101.0 101.2 101.4 101.6 101.8 102.0 102.2 102.4 102.6 102.8 103.0 103.2 103.4 103.6 103.8 104.0 104.2 104.4 104.6 104.8 105.0 105.2 105.4 105.6 105.8 106.0 106.2 106.4 106.6 106.8 107.0 107.2 107.4 107.6 107.8 108.0 log counts bin2

And a volcano plot:

plot(gene_data, x=:mean_bin2_div_bin1, y=:pvalue_bin2_div_bin1, color=:class, Theme(highlight_width=0pt),
Guide.xlabel("mean log2 fold change"), Guide.ylabel("-log10 pvalue"))
mean log2 fold change -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 -4 -2 0 2 4 -2.5 -2.4 -2.3 -2.2 -2.1 -2.0 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 increasing inactive class h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 -5 0 5 10 -4.0 -3.8 -3.6 -3.4 -3.2 -3.0 -2.8 -2.6 -2.4 -2.2 -2.0 -1.8 -1.6 -1.4 -1.2 -1.0 -0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 -log10 pvalue

And finally we can see how well we can differentiate between the different classes using Area Under the Precision-Recall Curve (Crispulator.auprc)

auprc(gene_data[!, :pvalmeanprod_bin2_div_bin1], gene_data[!, :class], Set([:increasing]))[1]
0.9206869819545944

Crispulator.auroc and Crispulator.venn are also good summary statistics.