Skip to content

Commit

Permalink
Fix timecourse extraction code to properly generate labelled index ac…
Browse files Browse the repository at this point in the history
…counting for cells that can not be extracted as being too close to slide edges

final fix for issues resulting in "empty" cells without proper labelling being generated
  • Loading branch information
sophiamaedler committed Apr 25, 2024
1 parent 577019d commit 6b260e4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/sparcscore/pipeline/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def _transfer_tempmmap_to_hdf5(self):

#generate index data container
index_labelled = _tmp_single_cell_index[keep_index]
index_labelled = pd.DataFrame(index_labelled)[1:].reset_index().values #need to reset the lookup index so that it goes up sequentially
index_labelled = pd.DataFrame(index_labelled).iloc[:, 1:].reset_index(drop = True).values #need to reset the lookup index so that it goes up sequentially
index_labelled = np.char.encode(index_labelled.astype(str))

hf.create_dataset('single_cell_index_labelled', data = index_labelled, chunks = None, dtype = dt)
Expand All @@ -807,8 +807,7 @@ def _transfer_tempmmap_to_hdf5(self):
with h5py.File(self.output_path, 'a') as hf:

#need to save this index seperately since otherwise we get issues with the classificaiton of the extracted cells
index = _tmp_single_cell_index[keep_index, 0:2]
_, cell_ids = index.T
cell_ids = _tmp_single_cell_index[keep_index, 1]
index = np.array(list(zip(range(len(cell_ids)), cell_ids)))
index = index.astype("uint64")

Expand Down

0 comments on commit 6b260e4

Please sign in to comment.