deconvatac.pp
=============

.. py:module:: deconvatac.pp


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/deconvatac/pp/feature_selection/index
   /autoapi/deconvatac/pp/reads_to_fragments/index


Functions
---------

.. autoapisummary::

   deconvatac.pp.highly_variable_peaks
   deconvatac.pp.highly_accessible_peaks
   deconvatac.pp.reads_to_fragments


Package Contents
----------------

.. py:function:: highly_variable_peaks(adata: anndata.AnnData, cluster_key: str, layer: str = None, scale: float = 1, n_top_features: int = 20000)

   Selects highly variable features the "var" way. 

   Adapted from: https://github.com/GreenleafLab/ArchR/blob/c61b0645d1482f80dcc24e25fbd915128c1b2500/R/IterativeLSI.R#L1015

   Parameters
   -----------

   adata: AnnData
       AnnData object of the (reference) scATAC data.
   cluster_key: str
       Name of column in adata.obs containing the clusters.
   layer: str 
       Layer of the raw counts. If None, uses .X
   scale: float
       Scale factor, i.e. log2((sums/feature_sums) *scale + 1).
   n_top_features: int
       How many features to select.

       
   Returns
   -------

   Saves a boolean indicator of the HVPs in place to adata.var['highly_variable'].


.. py:function:: highly_accessible_peaks(adata: anndata.AnnData, layer: str = None, n_top_features: int = 20000, copy: bool = False)

   Selects the most accessible peaks from the given AnnData object.

   Parameters
   ----------

   adata: AnnData
       Annotated data object containing the peaks.
   layer: str 
       Name of the layer to use for peak accessibility.
   n_top_features: int
       Number of top accessible peaks to select.
   copy: bool
       Whether to copy the AnnData object. 

       
   Returns
   -------

   AnnData object with the highly accessible peaks saved to adata.var['highly_accessible'].


.. py:function:: reads_to_fragments(adata: anndata.AnnData, read_layer: Optional[str] = None, fragment_layer: str = 'fragments') -> None

   Convert scATAC-seq read counts to appoximate fragment counts.

   Parameters
   ----------
   adata
       AnnData object that contains read counts.
   read_layer
       Key in`.layer` that the read counts are stored in.
   fragment_layer
       Key in`.layer` that the fragment counts will be stored in.

   Returns
   -------
   Adds layer with fragment counts in `.layers[fragment_layer]`.


