mira.rp_model.rp_model.GeneModel#
- class mira.rp_model.rp_model.GeneModel(*, gene, learning_rate=1.0, use_NITE_features=False, init_params=None, search_reps=1)[source]#
Gene-level RP model object.
- Attributes
parameters_Returns maximum a posteriori estimate of RP model parameters as dictionary dict[str : parameter, float : value].
Methods
get_influential_local_peaks(adata[, ...])Returns the .var field of the adata, but subset for only peaks within the local chromatin neighborhood of a gene.
write_bedgraph(adata[, scale_height, ...])Write bedgraph of RP model coverage.
- property parameters_#
Returns maximum a posteriori estimate of RP model parameters as dictionary dict[str : parameter, float : value].
- write_bedgraph(adata, scale_height=False, bin_size=50, decay_periods=20, promoter_width=3000, *, save_name)[source]#
Write bedgraph of RP model coverage. Useful for visualization with Bedtools.
- Parameters
- adataanndata.AnnData
AnnData object with TSS data annotated by mira.tl.get_distance_to_TSS.
- save_namestr
Path to saved bedgraph file.
- scale_heightboolean, default = False
Write RP model tails proportional in height to their respective multiplicative coeffecient. Useful for evaluating not only the distance of predicted regulatory influence, but the weighted importance of regions in terms of predicting expression.
- decay_periodsint>0, default = 10
Number of decay periods to write.
- promoter_widthint>0, default = 0
Width of flat region at promoter of gene in base pairs (bp). MIRA default is 3000 bp.
- Returns
- None
- get_influential_local_peaks(adata, decay_periods=5)[source]#
Returns the .var field of the adata, but subset for only peaks within the local chromatin neighborhood of a gene. The local chromatin neighborhood is defined by the decay distance parameter for that gene’s RP model.
- Parameters
- adataanndata.AnnData
AnnData object with ATAC features and TSS annotations.
- decay_periodsint > 0, default = 5
Return peaks that are within decay_periods*upstream_decay_distance upstream of gene and decay_periods*downstream_decay_distance downstream of gene, where upstream and downstream decay distances are given by the parameters of the RP model.
- Returns
- pd.DataFrame
subset from adata.var to include only features/peaks within the gene’s local chromatin neighborhood. This function adds two columns:
- distance_to_TSSint
Distance, in base pairs, from the gene’s TSS
- is_upstreamboolean
If peak is upstream or downstream of gene