Skip to content

Commit

Permalink
Change os.rename to shutil.move (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
cliu72 authored Mar 21, 2023
1 parent ad4e42f commit e06838f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ark/phenotyping/pixel_meta_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import random
from functools import partial
from shutil import rmtree
from shutil import rmtree, move

import feather
import numpy as np
Expand Down Expand Up @@ -185,7 +185,7 @@ def pixel_consensus_cluster(fovs, channels, base_dir, max_k=20, cap=3,

# remove the data directory and rename the temp directory to the data directory
rmtree(pixel_data_path)
os.rename(pixel_data_path + '_temp', pixel_data_path)
move(pixel_data_path + '_temp', pixel_data_path)

return pixel_cc

Expand Down Expand Up @@ -435,7 +435,7 @@ def apply_pixel_meta_cluster_remapping(fovs, channels, base_dir,

# remove the data directory and rename the temp directory to the data directory
rmtree(pixel_data_path)
os.rename(pixel_data_path + '_temp', pixel_data_path)
move(pixel_data_path + '_temp', pixel_data_path)


def generate_remap_avg_files(fovs, channels, base_dir, pixel_data_dir, pixel_remapped_name,
Expand Down
4 changes: 2 additions & 2 deletions src/ark/phenotyping/pixel_som_clustering.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import multiprocessing
import os
from functools import partial
from shutil import rmtree
from shutil import rmtree, move

import feather
from pyarrow.lib import ArrowInvalid
Expand Down Expand Up @@ -269,7 +269,7 @@ def cluster_pixels(fovs, channels, base_dir, pixel_pysom, data_dir='pixel_mat_da

# remove the data directory and rename the temp directory to the data directory
rmtree(data_path)
os.rename(data_path + '_temp', data_path)
move(data_path + '_temp', data_path)


def generate_som_avg_files(fovs, channels, base_dir, pixel_pysom, data_dir='pixel_data_dir',
Expand Down

0 comments on commit e06838f

Please sign in to comment.