<jupyter_start><jupyter_text>CryoSparc stores metadata into npy format<jupyter_code># This is form the directory of 3DVA 
data = np.load("cryosparc_P50_J47_particles.cs")
# Get the key for indexing
for i in range(len(data.dtype)):
    print(i, data.dtype.names[i], data[0][i])
# We get the reaction coordernates here
test = np.array([x[41] for x in data])
for i in range(19):
    test = np.column_stack([test, np.array([x[43+2*i] for x in data])])<jupyter_output><empty_output><jupyter_text>We can use other clustering method on the reaction coordinates or plot for visulization purpose<jupyter_code>test.shape
X_embedded = TSNE(negative_gradient_method="fft").fit(test)
# This is form the directory of 3DVA cluster mode
label = np.load("cryosparc_P50_J50_cluster_000_particles.cs")
for i in range(len(label.dtype)):
    print(i, label.dtype.names[i], label[0][i])
g1 = np.array([x[2] for x in label])
plt.rcParams["figure.figsize"] = (16,12)
fig, ax = plt.subplots()
ax.scatter(X_embedded[:,0], X_embedded[:,1])
ax.scatter(X_embedded[g1,0], X_embedded[g1,1], label=1)
pca_variance = np.sort(np.var(test, axis=0))[::-1] 
plt.figure(figsize=(8, 6))
plt.bar(range(20), pca_variance, alpha=0.5, align='center', label='individual variance')
plt.legend()
plt.ylabel('Variance ratio')
plt.xlabel('Principal components')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.155096011816839, 'fraction_numerical': 0.03175775480059084, 'mean_word_length': 6.787356321839081, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '616416', 'license': 'CC0-1.0', 'n_tokens_mistral': 552, 'n_tokens_neox': 519, 'n_words': 117, 'path': 'Parse_Cryosparc.ipynb', 'repo_name': 'phonchi/Computational-CryoEM', 'size': '1354'}