def filter_and_normalize(data, min_counts=None, min_counts_u=None, min_cells=None, min_cells_u=None,<EOL>min_shared_counts=None, min_shared_cells=None, n_top_genes=None, flavor='<STR_LIT>', log=True,<EOL>copy=False):
adata = data.copy() if copy else data<EOL>if '<STR_LIT>' not in adata.layers.keys() or '<STR_LIT>' not in adata.layers.keys():<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>filter_genes(adata, min_counts=min_counts, min_counts_u=min_counts_u, min_cells=min_cells, min_cells_u=min_cells_u,<EOL>min_shared_counts=min_shared_counts, min_shared_cells=min_shared_cells,)<EOL>normalize_per_cell(adata)<EOL>if n_top_genes is not None:<EOL><INDENT>filter_genes_dispersion(adata, n_top_genes=n_top_genes, flavor=flavor)<EOL><DEDENT>log_advised = np.allclose(adata.X[:<NUM_LIT:10>].sum(), adata.layers['<STR_LIT>'][:<NUM_LIT:10>].sum())<EOL>if log and log_advised:<EOL><INDENT>log1p(adata)<EOL><DEDENT>logg.info('<STR_LIT>' if log and log_advised else<EOL>'<STR_LIT>' if log else<EOL>'<STR_LIT>' if log_advised else '<STR_LIT>')<EOL>return adata if copy else None<EOL>
Filtering, normalization and log transform

    Expects non-logarithmized data. If using logarithmized data, pass `log=False`.

    Runs the following steps

    .. code:: python

        scv.pp.filter_genes(adata)
        scv.pp.normalize_per_cell(adata)
        if n_top_genes is not None:
            scv.pp.filter_genes_dispersion(adata)
        if log:
            scv.pp.log1p(adata)


    Arguments
    ---------
    data: :class:`~anndata.AnnData`
        Annotated data matrix.
    min_counts: `int` (default: `None`)
        Minimum number of counts required for a gene to pass filtering (spliced).
    min_counts_u: `int` (default: `None`)
        Minimum number of counts required for a gene to pass filtering (unspliced).
    min_cells: `int` (default: `None`)
        Minimum number of cells expressed required for a gene to pass filtering (spliced).
    min_cells_u: `int` (default: `None`)
        Minimum number of cells expressed required for a gene to pass filtering (unspliced).
    min_shared_counts: `int`, optional (default: `None`)
        Minimum number of counts (in cells expressed simultaneously in unspliced and spliced) required for a gene.
    min_shared_cells: `int`, optional (default: `None`)
        Minimum number of cells required for a gene to be expressed simultaneously in unspliced and spliced.
    n_top_genes: `int` (default: `None`)
        Number of genes to keep.
    flavor: {'seurat', 'cell_ranger', 'svr'}, optional (default: 'seurat')
        Choose the flavor for computing normalized dispersion. If choosing 'seurat', this expects non-logarithmized data.
    log: `bool` (default: `True`)
        Take logarithm.
    copy: `bool` (default: `False`)
        Return a copy of `adata` instead of updating it.

    Returns
    -------
    Returns or updates `adata` depending on `copy`.