-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
207 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,20 @@ | ||
function setup_screen(setup::ScreenSetup, lib::Library) | ||
guides, guide_freqs = construct_library(lib, setup.num_genes, setup.coverage) | ||
guide_freqs_dist = Categorical(guide_freqs) | ||
guides, guide_freqs_dist | ||
end | ||
|
||
function teardown_screen(setup::ScreenSetup, | ||
guides::Vector{Barcode}, | ||
bin_cells::Dict{Symbol,Vector{Int64}}, | ||
processing_func::Function) | ||
|
||
freqs = counts_to_freqs(bin_cells, length(guides)) | ||
# uniform for now for all bins | ||
seq_depths = Dict{Symbol, Int64}([binname=>setup.seq_depth for binname in keys(bin_cells)]) | ||
raw_data = sequencing(seq_depths, guides, freqs) | ||
genes = differences_between_bins(raw_data) | ||
processing_func(genes) | ||
end | ||
|
||
""" | ||
Runs a FACS screen given the parameters specified in `setup` using the | ||
Runs a screen given the parameters specified in `setup` using the | ||
library `lib` and applies the `processing_func` function to the result. | ||
""" | ||
function run_exp(setup::FacsScreen, lib::Library, processing_func::Function; run_idx=-1) | ||
|
||
guides, guide_freqs_dist = setup_screen(setup, lib) | ||
|
||
min_perc = minimum([range[2] - range[1] for (binname, range) in setup.bin_info]) | ||
expand_to = round(Int64, (setup.num_cells_per_bin * length(guides))/min_perc) | ||
function run_exp(setup::ScreenSetup, lib::Library, processing_func::Function; run_idx=-1) | ||
|
||
cells = transfect(guides, guide_freqs_dist, length(guides)*setup.representation, setup.moi, expand_to) | ||
guides, guide_freqs_dist = construct_library(setup, lib) | ||
|
||
bin_cells = facs_sort(cells, guides, setup.bin_info, setup.σ) | ||
cells, cell_phenotypes = transfect(setup, lib, guides, guide_freqs_dist) | ||
|
||
[teardown_screen(setup, guides, bin_cells, processing_func)...; as_array(setup)...; run_idx] | ||
end | ||
|
||
""" | ||
Runs a growth screen given the parameters specified in `setup` using the | ||
library `lib` and applies the `processing_func` function to the result. | ||
""" | ||
function run_exp(setup::GrowthScreen, lib::Library, processing_func::Function; run_idx=-1) | ||
|
||
guides, guide_freqs_dist = setup_screen(setup, lib) | ||
bin_cells = select(setup, cells, cell_phenotypes, guides) | ||
|
||
cells, num_doublings = transfect(setup, guides, guide_freqs_dist) | ||
|
||
bin_cells = growth_assay(cells, guides, setup.num_bottlenecks, setup.bottleneck_representation) | ||
freqs = counts_to_freqs(bin_cells, length(guides)) | ||
# uniform for now for all bins | ||
seq_depths = Dict{Symbol, Int64}([binname=>setup.seq_depth for binname in keys(bin_cells)]) | ||
raw_data = sequencing(seq_depths, guides, freqs) | ||
genes = differences_between_bins(raw_data) | ||
|
||
[teardown_screen(setup, guides, bin_cells, processing_func)...; as_array(setup)...; run_idx] | ||
[processing_func(genes)...; as_array(setup)...; run_idx] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.