Skip to content

Commit

Permalink
remove unnecesayry npy files
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlab committed Jul 13, 2024
1 parent ea25573 commit 050dfa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 191 deletions.
196 changes: 7 additions & 189 deletions src/napatrackmater/Trackvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ def plot_mitosis_times(self, full_dataframe, save_path=""):
]

dividing_counts = subset.groupby("t").size() / 2

times = dividing_counts.index
counts = dividing_counts.values
data = {"Time": times, "Count": counts}
Expand Down Expand Up @@ -558,6 +557,7 @@ def plot_mitosis_times(self, full_dataframe, save_path=""):
)

all_split_data = []

for split_id in tqdm(self.split_cell_ids, desc="Cell split IDs"):
spot_properties = self.unique_spot_properties[split_id]
track_id = spot_properties[self.trackid_key]
Expand Down Expand Up @@ -1184,7 +1184,6 @@ def simple_unsupervised_clustering(
distance_vectors="shape",
):

csv_file_name_original = csv_file_name
analysis_track_ids = []
shape_dynamic_covariance_matrix = []
position_matrix = []
Expand Down Expand Up @@ -1296,98 +1295,6 @@ def simple_unsupervised_clustering(
distance_vectors=distance_vectors,
)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ f"_silhouette_{metric}_{cluster_threshold_shape_dynamic}.npy"
)
np.save(silhouette_file_name, shape_dynamic_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ f"_wcss_{metric}_{cluster_threshold_shape_dynamic}.npy"
)
np.save(wcss_file_name, shape_dynamic_wcss_value)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ f"_silhouette_{metric}_{cluster_threshold_dynamic}.npy"
)
np.save(silhouette_file_name, dynamic_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ f"_wcss_{metric}_{cluster_threshold_dynamic}.npy"
)
np.save(wcss_file_name, dynamic_wcss_value)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ f"_silhouette_{metric}_{cluster_threshold_shape}.npy"
)
np.save(silhouette_file_name, shape_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ f"_wcss_{metric}_{cluster_threshold_shape}.npy"
)
np.save(wcss_file_name, shape_wcss_value)

cluster_distance_map_shape_dynamic_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ "_cluster_distance_map_shape_dynamic.npy"
)
np.save(
cluster_distance_map_shape_dynamic_file_name,
cluster_distance_map_shape_dynamic,
)

cluster_distance_map_shape_file_name = os.path.join(
csv_file_name_original + "shape" + "_cluster_distance_map_shape.npy"
)
np.save(cluster_distance_map_shape_file_name, cluster_distance_map_shape)

cluster_distance_map_dynamic_file_name = os.path.join(
csv_file_name_original + "dynamic" + "_cluster_distance_map_dynamic.npy"
)
np.save(cluster_distance_map_dynamic_file_name, cluster_distance_map_dynamic)

cluster_eucledian_distance_map_shape_dynamic_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ "_cluster_eucledian_distance_map_shape_dynamic.npy"
)
np.save(
cluster_eucledian_distance_map_shape_dynamic_file_name,
cluster_eucledian_distance_map_shape_dynamic,
)

cluster_eucledian_distance_map_shape_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ "_cluster_eucledian_distance_map_shape.npy"
)
np.save(
cluster_eucledian_distance_map_shape_file_name,
cluster_eucledian_distance_map_shape,
)

cluster_eucledian_distance_map_dynamic_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ "_cluster_eucledian_distance_map_dynamic.npy"
)
np.save(
cluster_eucledian_distance_map_dynamic_file_name,
cluster_eucledian_distance_map_dynamic,
)


def unsupervised_clustering(
full_dataframe,
Expand All @@ -1402,7 +1309,6 @@ def unsupervised_clustering(
distance_vectors="shape",
):

csv_file_name_original = csv_file_name
analysis_track_ids = []
shape_dynamic_covariance_matrix = []
shape_covariance_matrix = []
Expand Down Expand Up @@ -1501,98 +1407,6 @@ def unsupervised_clustering(
distance_vectors=distance_vectors,
)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ f"_silhouette_{metric}_{cluster_threshold_shape_dynamic}.npy"
)
np.save(silhouette_file_name, shape_dynamic_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ f"_wcss_{metric}_{cluster_threshold_shape_dynamic}.npy"
)
np.save(wcss_file_name, shape_dynamic_wcss_value)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ f"_silhouette_{metric}_{cluster_threshold_dynamic}.npy"
)
np.save(silhouette_file_name, dynamic_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ f"_wcss_{metric}_{cluster_threshold_dynamic}.npy"
)
np.save(wcss_file_name, dynamic_wcss_value)

silhouette_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ f"_silhouette_{metric}_{cluster_threshold_shape}.npy"
)
np.save(silhouette_file_name, shape_silhouette)

wcss_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ f"_wcss_{metric}_{cluster_threshold_shape}.npy"
)
np.save(wcss_file_name, shape_wcss_value)

cluster_distance_map_shape_dynamic_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ "_cluster_distance_map_shape_dynamic.npy"
)
np.save(
cluster_distance_map_shape_dynamic_file_name,
cluster_distance_map_shape_dynamic,
)

cluster_distance_map_shape_file_name = os.path.join(
csv_file_name_original + "shape" + "_cluster_distance_map_shape.npy"
)
np.save(cluster_distance_map_shape_file_name, cluster_distance_map_shape)

cluster_distance_map_dynamic_file_name = os.path.join(
csv_file_name_original + "dynamic" + "_cluster_distance_map_dynamic.npy"
)
np.save(cluster_distance_map_dynamic_file_name, cluster_distance_map_dynamic)

cluster_eucledian_distance_map_shape_dynamic_file_name = os.path.join(
csv_file_name_original
+ "shape_dynamic"
+ "_cluster_eucledian_distance_map_shape_dynamic.npy"
)
np.save(
cluster_eucledian_distance_map_shape_dynamic_file_name,
cluster_eucledian_distance_map_shape_dynamic,
)

cluster_eucledian_distance_map_dynamic_file_name = os.path.join(
csv_file_name_original
+ "dynamic"
+ "_cluster_eucledian_distance_map_dynamic.npy"
)
np.save(
cluster_eucledian_distance_map_dynamic_file_name,
cluster_eucledian_distance_map_dynamic,
)

cluster_eucledian_distance_map_shape_file_name = os.path.join(
csv_file_name_original
+ "shape"
+ "_cluster_eucledian_distance_map_shape.npy"
)
np.save(
cluster_eucledian_distance_map_shape_file_name,
cluster_eucledian_distance_map_shape,
)


def convert_tracks_to_arrays(
analysis_vectors,
Expand Down Expand Up @@ -2856,8 +2670,6 @@ def populate_zero_gen_tracklets(
feature,
)

print(f"Good zero_gens, {good_zero_gens}")


def generic_polynomial_fits(
track_array,
Expand Down Expand Up @@ -3662,3 +3474,9 @@ def angular_plot(global_shape_dynamic_dataframe, column="Radial_Angle_Z", time_p

plt.show()
clear_output(wait=True)


def normalize_list(lst):
mean_val = np.mean(lst)
std_val = np.std(lst)
return [(x - mean_val) / std_val for x in lst]
4 changes: 2 additions & 2 deletions src/napatrackmater/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = version = "5.3.4"
__version_tuple__ = version_tuple = (5, 3, 4)
__version__ = version = "5.3.5"
__version_tuple__ = version_tuple = (5, 3, 5)

0 comments on commit 050dfa4

Please sign in to comment.