src/scBONITA/singleCell.py
def __sampleCells(self, data, number_cells):
        """Sample a representative population of cells for rule inference - reduce memory requirements"""
        combined = np.apply_along_axis(
            lambda x: "".join(str(x)), axis=0, arr=data[1:, 1:]
        )
        combined_weights = np.unique(combined, return_counts=True)[1] / len(combined)
        sampled_cells = np.random.choice(
            range(len(combined_weights)), size=number_cells, p=combined_weights
        )
        sampled_cells = np.delete(sampled_cells, np.where(sampled_cells == 0))
        return sampled_cells
Sample a representative population of cells for rule inference - reduce memory requirements
Sample a representative population of cells for rule inference - reduce memory requirements
Sample a representative population of cells for rule inference - reduce memory requirements
def __sampleCells(self, data, number_cells):
        combined = np.apply_along_axis(
            lambda x: "".join(str(x)), axis=0, arr=data[1:, 1:]
        )
        combined_weights = np.unique(combined, return_counts=True)[1] / len(combined)
        sampled_cells = np.random.choice(
            range(len(combined_weights)), size=number_cells, p=combined_weights
        )
        sampled_cells = np.delete(sampled_cells, np.where(sampled_cells == 0))
        return sampled_cells
def __sampleCells ( self , data , number_cells ) : combined = np . apply_along_axis ( lambda x : "" . join ( str ( x ) ) , axis = 0 , arr = data [ 1 : , 1 : ] ) combined_weights = np . unique ( combined , return_counts = True ) [ 1 ] / len ( combined ) sampled_cells = np . random . choice ( range ( len ( combined_weights ) ) , size = number_cells , p = combined_weights ) sampled_cells = np . delete ( sampled_cells , np . where ( sampled_cells == 0 ) ) return sampled_cells
Sample a representative population of cells for rule inference - reduce memory requirements
Sample a representative population of cells for rule inference - reduce memory requirements
"""Sample a representative population of cells for rule inference - reduce memory requirements"""
self
data
number_cells