# Filtering for sparse or dense matrix

Source: `R/sc_support.R`
`sparse_filter.Rd`

Perform dmFilter-like filtering for sparse or dense matrices

    sparse_filter(
      counts,
      tx2gene,
      BPPARAM = BiocParallel::SerialParam(),
      min_samps_gene_expr = 0,
      min_gene_expr = 0,
      min_samps_feature_expr = 0,
      min_feature_expr = 0,
      min_samps_feature_prop = 0,
      min_feature_prop = 0,
      run_gene_twice = FALSE
    )

## Arguments

counts | Sparse count matrix.
tx2gene | Feature to gene mapping.
BPPARAM | If multicore processing should be used, specify a `BiocParallelParam` object here. Among others, can be `SerialParam()` (default) for standard non-multicore processing or `MulticoreParam('number_cores')` for multicore processing. See `BiocParallel` for more information.
min_samps_gene_expr | Minimal number of samples where genes should be expressed. See Details.
min_gene_expr | Minimal gene expression.
min_samps_feature_expr | Minimal number of samples where features should be expressed. See Details.
min_feature_expr | Minimal feature expression.
min_samps_feature_prop | Minimal number of samples where features should be expressed. See details.
min_feature_prop | Minimal proportion for feature expression. This value should be between 0 and 1.
run_gene_twice | Whether to re-run the gene-level filter after the feature-level filters.

## Value

Filtered sparse matrix

## Details

Runtime optimized version of `dmFilter()`, which can optionally be executed in parallel.