Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yichunher committed Oct 11, 2021
1 parent ae45ec2 commit e1d1bf5
Show file tree
Hide file tree
Showing 7 changed files with 1,477 additions and 16 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion ClusterMap/clustermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def segmentation(self,cell_num_threshold=0.015, dapi_grid_interval=5, add_dapi=T
print('DPC')
cell_ids = DPC(self,all_coord, all_ngc,cell_num_threshold,use_genedis)
else:
self.num_spots_with_dapi=0
spatial = np.array(spots_denoised[['spot_location_1', 'spot_location_2', 'spot_location_3']]).astype(np.float32)
print('DPC')
cell_ids = DPC(self,spatial,ngc, cell_num_threshold, use_genedis)
Expand All @@ -82,7 +83,7 @@ def segmentation(self,cell_num_threshold=0.015, dapi_grid_interval=5, add_dapi=T

print('Postprocessing')
erase_small_clusters(self.spots,self.min_spot_per_cell)
# res_over_dapi_erosion(self.spots, self.dapi_binary)
res_over_dapi_erosion(self.spots, self.dapi_binary)

# Keep all spots id for plotting
is_remain=np.in1d(cell_ids, self.spots['clustermap'].unique())
Expand Down
2 changes: 1 addition & 1 deletion ClusterMap/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def res_over_dapi_erosion(spots, dapi_binary, method='clustermap', minus1 = Fals
returns : None
'''

dapi_binary_eroded = erosion(dapi_binary, ball(2))
dapi_binary_eroded = dapi_binary
cell_list = np.unique(spots[method])[1:]
if minus1:
for cell in cell_list:
Expand Down
5 changes: 4 additions & 1 deletion ClusterMap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,14 @@ def DPC(self,all_coord, all_ngc, cell_num_threshold, spearman_metric=spearman_me
list12not=[not x for x in list12]
self.cellcenter=all_coord[list12,:]

print(f' Find cell number:{number_cell}')



#assign the remaining spots
cellid=np.zeros((self.num_spots_with_dapi,))-1
self.number_cell=sum(list12)
print(f' Find cell number:{number_cell}')

cellid[list12]=range(self.number_cell) #range(cellid[list12].shape[0])
for i_value in tqdm(rho_descending_order):
if cellid[int(i_value)]==-1:
Expand Down
Loading

0 comments on commit e1d1bf5

Please sign in to comment.