crested.pp.change_regions_width#
- crested.pp.change_regions_width(adata, width, chromsizes_file=None, inplace=True)#
Change the widths of all regions in the adata object.
The new region will have the same center as the original region. Modifies the adata.var and adata.var_names in place. This function is useful when you want to train on a wider/narrower region than the original consensus regions.
- Parameters:
adata (
AnnData) – The AnnData object containing the regions as ‘chr:start-end’ to be modified in the .var_names.width (
int) – The new width of the regions.chromsizes_file (
str|PathLike|None(default:None)) – File path of the chromsizes file. Used for checking if the new regions are within the chromosome boundaries. If not provided, uses chromsizes from the registered Genome object, and if that doesn’t exist either, doesn’t check against chromosome boundaries.inplace (
bool(default:True)) – Perform computation and modifyadatain-place or return a resulting copy of theadatainstead.
- Return type:
- Returns:
If
inplace=True(default), modifies the anndata in-place and doesn’t return anything. Ifinplace=False, returns the AnnData object with the modified regions.
Example
>>> crested.pp.change_regions_width(adata, width=1000)