Refines a list of candidate hits by the consistency of their barcodes. For each gene it computes the variance of the log2 fold changes of its barcodes (estimated with edgeR for the given contrast) and keeps the genes whose variance is at most the given threshold: a gene whose barcodes disagree is a less reliable hit.
Arguments
- screenR_Object
The ScreenR object obtained using
create_screenr_object, normalized withnormalize_data. The model uses its raw counts with its effective library sizes as offsets, the same normalization as the plots and the data table (seecreate_edger_obj).- genes
The genes to filter, for example the hits found by
find_gene_zscore_hit,find_camera_hitorfind_roast_hit.- matrix_model
The design matrix of the linear model, for example created with
create_design_matrix(or withmodel.matrix). Rows must be named with sample identifiers in object order (seecreate_design_matrix); mismatched names or order are errors. Named contrast coefficients are aligned to design columns.- variance
The maximum variance of the barcode log2 fold changes accepted (default 0.5).
- contrast
The comparison used to compute the log2 fold changes: the name or index of a column of matrix_model, a numeric contrast vector (for example created with
create_contrast) or a one-column matrix created withmakeContrasts.
Value
The rows of the data table (see get_data_table) of
the genes that pass the filter, with an additional Variance column (the
variance of the barcode log2 fold changes of the gene).
Examples
object <- get0("object", envir = asNamespace("ScreenR"))
matrix_model <- create_design_matrix(object)
contrast <- create_contrast(matrix_model,
treatment = "Treated", control = "Control"
)
data <- filter_by_variance(
screenR_Object = object, genes = c("Gene_42"),
matrix_model = matrix_model, contrast = contrast
)
head(data)
#> # A tibble: 6 × 10
#> Barcode Gene Sample Frequency Sequence Library Gene_ID Day Treatment
#> <fct> <chr> <fct> <dbl> <lgl> <lgl> <lgl> <chr> <chr>
#> 1 12937 Gene_42 T1 471. NA NA NA T1 T1
#> 2 12937 Gene_42 T2 406. NA NA NA T2 T2
#> 3 12937 Gene_42 Time3_TRT_A 365. NA NA NA Time3 TRT
#> 4 12937 Gene_42 Time3_TRT_B 448. NA NA NA Time3 TRT
#> 5 12937 Gene_42 Time3_TRT_C 394. NA NA NA Time3 TRT
#> 6 12937 Gene_42 Time3_A 459. NA NA NA Time3 Time3
#> # ℹ 1 more variable: Variance <dbl>
