Skip to content

Commit

Permalink
Remove _norm from file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-l-kong committed Jul 12, 2021
1 parent 962112d commit 723a1b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions ark/phenotyping/run_pixel_som.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ markers <- colnames(somWeights)
print("Mapping data to cluster labels")
for (i in 1:length(fovs)) {
# read in pixel data
fovName <- file.path(fovs[i], "norm", fsep="_")
fileName <- file.path(fovName, "feather", fsep=".")
fileName <- file.path(fovs[i], "feather", fsep=".")
matPath <- file.path(pixelMatDir, fileName)
fovPixelData <- arrow::read_feather(matPath)

Expand Down
6 changes: 3 additions & 3 deletions ark/phenotyping/som_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def preprocess_row_sums(fovs, channels, base_dir, pre_dir='pixel_mat_preprocesse

pixel_data = normalize_rows(pixel_data, channels)

# write the normalized data
# write the normalized data, overwrite with sum normalized values
feather.write_dataframe(pixel_data,
os.path.join(preprocessed_path, fov + '_norm.feather'),
os.path.join(preprocessed_path, fov + '.feather'),
compression='uncompressed')


Expand Down Expand Up @@ -540,7 +540,7 @@ def cluster_pixels(fovs, base_dir, pre_dir='pixel_mat_preprocessed',
preprocess_row_sums(fovs, weights.columns.values, base_dir, pre_dir)

# ensure the norm vals columns are valid indexes
sum_norm_files = io_utils.list_files(preprocessed_path, substrs='_norm.feather')
sum_norm_files = io_utils.list_files(preprocessed_path, substrs='.feather')
norm_vals = feather.read_dataframe(os.path.join(base_dir, norm_vals_name))
sample_fov = feather.read_dataframe(os.path.join(base_dir, pre_dir, sum_norm_files[0]))
sample_fov = sample_fov.drop(
Expand Down
6 changes: 3 additions & 3 deletions ark/phenotyping/som_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ def test_preprocess_row_sums():
som_utils.preprocess_row_sums(fovs, chans, temp_dir, 'pixel_mat_preprocessed')

for fov in fovs:
# assert we actually created a fov_norm.feather file
# assert we still have a fov.feather file
assert os.path.exists(
os.path.join(temp_dir, 'pixel_mat_preprocessed', fov + '_norm.feather')
os.path.join(temp_dir, 'pixel_mat_preprocessed', fov + '.feather')
)

# read the row preprocessed data in
fov_row_pre = feather.read_dataframe(os.path.join(temp_dir,
'pixel_mat_preprocessed',
fov + '_norm.feather'))
fov + '.feather'))

# drop the metadata columns
fov_row_pre = fov_row_pre.drop(
Expand Down

0 comments on commit 723a1b2

Please sign in to comment.