Dna.clustered_barcodes#
missionbio.mosaic.dna.Dna.clustered_barcodes
- Dna.clustered_barcodes(orderby: Optional[Union[str, ndarray, DataFrame]] = None, splitby: Union[str, ndarray, DataFrame] = 'label', override: bool = False, subcluster: bool = True, return_index: bool = False, **kwargs: Any) ndarray #
Hierarchical clustering of barcodes.
If orderby is not provided, the ordered barcodes are returned according to splitby. If orderby is provided, then further hierarchical clustering is performed based on the values in it for each unqiue splitby value.
- Parameters:
- orderbystr / np.ndarray
An attribute with at least one dimension equal to the number of barcodes. Uses
get_attribute()
to retrieve the values constrained by row.- splitbystr / np.ndarray
Whether to order the barcodes based on the given labels or not. Only applicable when labels orderby is None. Uses
get_attribute()
to retrieve the values constrained by row. The shape must be equal to (#cells)- overridebool
Continue clustering even if the number of id is greater than 1,000.
- subclusterbool
Whether to hierarchically cluster the barcodes within each unique splitby value cluster.
- return_indexbool
Whether to return the indices of the ordered barcodes or the barcodes themselves.
- kwargsAny
The keyword arguments to be passed to the
scipy.cluster.hierarchy.linkage()
function. Seehierarchical_cluster()
for the default values.
- Returns:
- numpy.ndarray
Ordered barcodes
- Raises:
- ValueError
When the splitby is not one-dimensional
- Exception
When the number of id in the assay is greater than 1,000. This can take a long time to process, hence denied.
- Warning
If the number of id is greater than 1,000 and override is passed.
< Class Dna