iss_patcher.patch
- iss_patcher.patch(iss, gex, min_genes=3, obs_to_take=None, cont_obs_to_take=None, nanmean=False, round_counts=True, chunk_size=100000, computation='annoy', neighbours=15, obsm_fraction=False, obsm_pbs=False)
Identify the nearest neighbours of low dimensionality observations in related higher dimensionality data, approximate features absent from the low dimensionality data as high dimensionality neighbour means. The data is log-normalised and z-scored prior to KNN inference.
Input
- iss
AnnData The low dimensionality data object, with raw counts in
.X.- gex
AnnData The high dimensionality data object, with raw counts in
.X.- min_genes
int, optional (default: 3) Passed to
scanpy.pp.filter_cells()ran on the shared feature space ofissandgex.- obs_to_take
stror list ofstr, optional (default:None) If provided, will report the most common value of the specified
gex.obscolumn(s) for the neighbours of eachisscell. Discrete metadata only.- cont_obs_to_take
stror list ofstr, optional (default:None) If provided, will report the average of the values of the specified
gex.obscolumn(s) for the neighbours of eachisscell. Continuous metadata only.- nanmean
bool, optional (default:False) If
True, will also compute an equivalent ofnp.nanmean()for eachcont_obs_to_take.- round_counts
bool, optional (default:True) If
True, will round the computed counts to the nearest integer.- chunk_size
int, optional (default: 100000) If
round_countsisTrue, will computeissprofiles these many observations at a time and round them to reduce RAM use. A larger value means fewer matrix operations (i.e. quicker run time) at the cost of more memory.- computation
str, optional (default:"annoy") The package supports KNN inference via annoy (specify
"annoy"), PyNNDescent (specify"pynndescent") and scipy’s cKDTree (specify"cKDTree"). Annoy identifies approximate neighbours and runs quicker, cKDTree identifies exact neighbours and is a bit slower.- neighbours
int, optional (default: 15) How many neighbours in
gexto identify for eachisscell.- obsm_fraction
bool, optional (default:False) If
True, will report the full fraction distribution of eachobs_to_takein.obsmof the resulting object.- obsm_pbs
bool, optional (default:False) If
True, will store the identifiedgexneighbours for eachisscell in.obsm['pbs']. A corresponding vector ofgex.obs_nameswill be stored in.uns['pbs_gex_obs_names'].
- iss