JonathanShor / DoubletDetection

Doublet detection in single-cell RNA-seq data.
https://doubletdetection.readthedocs.io/en/stable/
MIT License
86 stars 23 forks source link

Vectorize synthetic doublet creation #107

Closed adamgayoso closed 5 years ago

adamgayoso commented 6 years ago

We can likely improve the speed of this process

     choices = np.random.choice(self._num_cells, size=(num_synths, 2), replace=self.replace)
     for i, parent_pair in enumerate(choices):
        row1 = parent_pair[0]
        row2 = parent_pair[1]
        if self.new_lib_as is not None:
            new_row = self._downsampleCellPair(self._raw_counts[row1], self._raw_counts[row2])
        else:
            new_row = self._raw_counts[row1] + self._raw_counts[row2]
        synthetic[i] = new_row
        parents.append([row1, row2])
adamgayoso commented 5 years ago

Fixed in #116