Skip to content

Commit

Permalink
Merge pull request #13 from JoshuaHess12/master
Browse files Browse the repository at this point in the history
Bug fix -- add suffix to non-unique channel names
  • Loading branch information
DenisSch authored Apr 6, 2020
2 parents a4e1ec5 + e708edd commit 639c6e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions SingleCellDataExtraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def PrepareData(image,z):
if image.endswith(('.ome.tif','.ome.tiff')):
#Read the image
image_loaded_z = skimage.io.imread(image,img_num=z,plugin='tifffile')
#print('OME TIF(F) found')
#print('OME TIF(F) found')
else:
#Read the image
image_loaded_z = skimage.io.imread(image,img_num=z,plugin='tifffile')
Expand Down Expand Up @@ -171,10 +171,24 @@ def ExtractSingleCells(mask,image,channel_names,output):
channel_names_loaded.columns = ["marker"]
#Convert the channel names to a list
channel_names_loaded = list(channel_names_loaded.marker.values)
#Check for unique marker names -- create new list to store new names
channel_names_loaded_checked = []
for idx,val in enumerate(channel_names_loaded):
#Check for unique value
if channel_names_loaded.count(val) > 1:
#If unique count greater than one, add suffix
channel_names_loaded_checked.append(val + "_"+ str(channel_names_loaded[:idx].count(val) + 1))
else:
#Otherwise, leave channel name
channel_names_loaded_checked.append(val)

#Clear small memory amount by clearing old channel names
channel_names_loaded = None

#Read the mask
mask_loaded = skimage.io.imread(mask,plugin='tifffile')

scdata_z = MaskZstack(mask_loaded,image,channel_names_loaded)
scdata_z = MaskZstack(mask_loaded,image,channel_names_loaded_checked)
#Write the singe cell data to a csv file using the image name

im_full_name = os.path.basename(image)
Expand All @@ -195,5 +209,3 @@ def MultiExtractSingleCells(mask,image,channel_names,output):
im_full_name = os.path.basename(image)
im_name = im_full_name.split('.')[0]
print("Finished "+str(im_name))


Binary file added __pycache__/ParseInput.cpython-37.pyc
Binary file not shown.
Binary file not shown.

0 comments on commit 639c6e8

Please sign in to comment.