Filters the regions of a qseaSet using dplyr::filter() predicates applied to its regions (as a data frame), then subsets the object accordingly.

filterWindows(qseaSet, ...)

Arguments

qseaSet

qseaSet. The qseaSet object whose regions (windows) will be filtered.

...

Expressions. Predicates passed to dplyr::filter() and evaluated on the regions data frame. Default: none (no filtering).

Value

A qseaSet object with only regions matching the filter conditions. Both the count_matrix and @regions slot are updated consistently.

See also

qsea::getRegions(), filter.qseaSet() (for filtering samples instead of regions), dplyr::filter()

Examples

data(exampleTumourNormal, package = "mesa")

# Keep regions starting before position 25,020,000
exampleTumourNormal %>% filterWindows(start <= 25020000)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Colon1_N, Colon1_T, Colon2_N, Colon2_T, Lung1_N, Lung1_T, Lung2_N, Lung2_T, Lung3_N, Lung3_T
#> 12 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38

# Keep regions with CpG density > 10
exampleTumourNormal %>% filterWindows(CpG_density > 10)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Colon1_N, Colon1_T, Colon2_N, Colon2_T, Lung1_N, Lung1_T, Lung2_N, Lung2_T, Lung3_N, Lung3_T
#> 274 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38

# Combine multiple conditions
exampleTumourNormal %>%
    filterWindows(seqnames == "chr7", CpG_density > 5)
#> qseaSet
#> =======================================
#> 10 Samples: 
#> Colon1_N, Colon1_T, Colon2_N, Colon2_T, Lung1_N, Lung1_T, Lung2_N, Lung2_T, Lung3_N, Lung3_T
#> 0 Regions in 22 chromosomes of BSgenome.Hsapiens.NCBI.GRCh38