Skip to content

Commit

Permalink
Address code review comments (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-l-kong committed Apr 8, 2021
1 parent c160e73 commit 9737fa4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 19 deletions.
2 changes: 0 additions & 2 deletions ark/phenotyping/consensus_cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ library(arrow)
library(data.table)
library(ConsensusClusterPlus)

set.seed(59)

# get the command line arguments
args <- commandArgs(trailingOnly=TRUE)

Expand Down
2 changes: 0 additions & 2 deletions ark/phenotyping/create_som_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ library(arrow)
library(data.table)
library(FlowSOM)

set.seed(59)

# get the command line arguments
args <- commandArgs(trailingOnly=TRUE)

Expand Down
4 changes: 2 additions & 2 deletions ark/phenotyping/som_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def compute_cluster_avg(fovs, channels, base_dir, cluster_col,
cluster_dir='pixel_mat_clustered'):
"""Averages channel values across all fovs in pixel_mat_clustered
"""For each fov, compute the average channel values across each SOM cluster
Args:
fovs (list):
Expand Down Expand Up @@ -130,7 +130,7 @@ def create_pixel_matrix(fovs, base_dir, tiff_dir, seg_dir,
pre_dir='pixel_mat_preprocessed',
sub_dir='pixel_mat_subsetted', is_mibitiff=False,
blur_factor=2, subset_proportion=0.1, seed=None):
"""Preprocess the images for FlowSOM clustering and creates a pixel-level matrix
"""For each fov, add a Gaussian blur to each channel and normalize channel sums for each pixel
Saves preprocessed data to pre_dir and subsetted data to sub_dir
Expand Down
6 changes: 0 additions & 6 deletions ark/phenotyping/som_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ def test_compute_cluster_avg():
# compute cluster average matrix
cluster_avg = som_utils.compute_cluster_avg(fovs, chans, temp_dir, 'cluster')

# assert that pixel_cluster_avg.feather was actually created
# assert os.path.exists(os.path.join(temp_dir, 'pixel_cluster_avg.feather'))

# read the averaged results
# cluster_avg = feather.read_dataframe(os.path.join(temp_dir, 'pixel_cluster_avg.feather'))

# verify the provided channels and the channels in cluster_avg are exactly the same
misc_utils.verify_same_elements(
cluster_avg_chans=cluster_avg[chans].columns.values,
Expand Down
14 changes: 7 additions & 7 deletions ark/utils/notebooks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ def _exec_notebook(nb_filename):
subprocess.check_call(args)


# # test runs with default inputs
# def test_segment_image_data():
# _exec_notebook('Segment_Image_Data.ipynb')
# test runs with default inputs
def test_segment_image_data():
_exec_notebook('Segment_Image_Data.ipynb')


# def test_example_spatial_analysis():
# _exec_notebook('example_spatial_analysis_script.ipynb')
def test_example_spatial_analysis():
_exec_notebook('example_spatial_analysis_script.ipynb')


# def test_example_neighborhood_analysis():
# _exec_notebook('example_neighborhood_analysis_script.ipynb')
def test_example_neighborhood_analysis():
_exec_notebook('example_neighborhood_analysis_script.ipynb')


# test mibitiff segmentation
Expand Down

0 comments on commit 9737fa4

Please sign in to comment.