⚠️ Note:
The following is an example demonstration. Here, the ST prediction model is trained on only 5 samples, using a single inner fold and a single outer fold.
The training process runs for a maximum of 50 epochs.
In the manuscript, the model was trained for 500 epochs on 25 samples from 14 patients,
utilizing 14 outer folds and 7 inner folds, resulting in a total of 98 trained models (14 × 7).
Load packages
import numpy as np
import pandas as pd
import os
import subprocess
import sys
import pkg_resources
import time
import platform
import psutil
import pickle
from scipy.spatial import cKDTree
from pathlib import Path
# Function to get system information
def get_system_info():
print("\n--- System Information ---")
print(f"Operating System: {platform.system()} {platform.release()} ({platform.version()})")
print(f"Processor: {platform.processor()}")
print(f"CPU Cores: {psutil.cpu_count(logical=False)} (Physical), {psutil.cpu_count(logical=True)} (Logical)")
print(f"Total RAM: {psutil.virtual_memory().total / (1024**3):.2f} GB")
# Check for GPU availability (if NVIDIA GPU is installed)
try:
gpu_info = subprocess.run("nvidia-smi --query-gpu=name --format=csv,noheader",
shell=True, capture_output=True, text=True, check=True)
print(f"GPU: {gpu_info.stdout.strip()}")
except subprocess.CalledProcessError:
print("GPU: Not needed")
get_system_info()
--- System Information --- Operating System: Linux 4.18.0-425.19.2.el8_7.x86_64 (#1 SMP Tue Apr 4 22:38:11 UTC 2023) Processor: x86_64 CPU Cores: 28 (Physical), 56 (Logical) Total RAM: 251.50 GB GPU: Tesla K80
Load input/output folder and metadata
path2input = f'../input_data/' # inputs folder
path2output = f'../output_data/' # outputs folder
# Load the meta file
meta_path = f"{path2input}metadata.csv"
metadata = pd.read_csv(meta_path)
# List all samples in meta
samples=metadata['sample_ID']
print("Samples in meta:", samples)
Samples in meta: 0 092B 1 093B 2 396A 3 397A 4 398B Name: sample_ID, dtype: object
# Measure execution time
start_time = time.time()
try:
# Loop over the slides and run the feature extraction for each of the samples
for i_slide in range(len(samples)):
command = f"python ../scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py {path2input} {path2output} {i_slide}"
print(command)
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True, cwd=os.getcwd())
print("Command Output:\n", result.stdout)
except subprocess.CalledProcessError as e:
print("Error occurred:\n", e.stderr)
# Calculate elapsed time
end_time = time.time()
elapsed_time = end_time - start_time
print(f"Execution Time: {elapsed_time:.2f} seconds")
python /vf/users/Ruppin_AI/st/zenodo/Path2Space/scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py /vf/users/Ruppin_AI/st/zenodo/Path2Space/input_data/ /vf/users/Ruppin_AI/st/zenodo/Path2Space/output_data/ 0 Command Output: device: cuda device: cuda i_slide: 0 Figure(4000x2000) n_tiles: 1352 tiles.shape: torch.Size([1352, 3, 224, 224]) features.shape: (1352, 768) python /vf/users/Ruppin_AI/st/zenodo/Path2Space/scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py /vf/users/Ruppin_AI/st/zenodo/Path2Space/input_data/ /vf/users/Ruppin_AI/st/zenodo/Path2Space/output_data/ 1 Command Output: device: cuda device: cuda i_slide: 1 Figure(4000x2000) n_tiles: 1146 tiles.shape: torch.Size([1146, 3, 224, 224]) features.shape: (1146, 768) python /vf/users/Ruppin_AI/st/zenodo/Path2Space/scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py /vf/users/Ruppin_AI/st/zenodo/Path2Space/input_data/ /vf/users/Ruppin_AI/st/zenodo/Path2Space/output_data/ 2 Command Output: device: cuda device: cuda i_slide: 2 Figure(4000x2000) n_tiles: 553 tiles.shape: torch.Size([553, 3, 224, 224]) features.shape: (553, 768) python /vf/users/Ruppin_AI/st/zenodo/Path2Space/scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py /vf/users/Ruppin_AI/st/zenodo/Path2Space/input_data/ /vf/users/Ruppin_AI/st/zenodo/Path2Space/output_data/ 3 Command Output: device: cuda device: cuda i_slide: 3 Figure(4000x2000) n_tiles: 924 tiles.shape: torch.Size([924, 3, 224, 224]) features.shape: (924, 768) python /vf/users/Ruppin_AI/st/zenodo/Path2Space/scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction.py /vf/users/Ruppin_AI/st/zenodo/Path2Space/input_data/ /vf/users/Ruppin_AI/st/zenodo/Path2Space/output_data/ 4 Command Output: device: cuda device: cuda i_slide: 4 Figure(4000x2000) n_tiles: 629 tiles.shape: torch.Size([629, 3, 224, 224]) features.shape: (629, 768) Execution Time: 2899.31 seconds
Create a single pickle file containing all the features
feature_path=f'{path2output}features/'
features = []
# Iterate through all files in the directory
for filename in os.listdir(feature_path):
if filename.endswith(".pkl"):
file_path = os.path.join(feature_path, filename)
x=np.load(file_path, allow_pickle=True)
features.append((filename, x))
with open(f'{path2output}/features.pkl', 'wb') as f:
pickle.dump(features, f)
View features for one spot
features[0]
('01_092B_10x100.pkl',
array([ 5.78595847e-02, -6.03137128e-02, -1.19494703e-02, -1.10864490e-01,
-1.20032780e-01, 6.99738562e-02, -8.05370882e-03, 9.50601548e-02,
-3.97506505e-02, 1.51806027e-01, -2.61575114e-02, 9.24117714e-02,
-6.76674023e-02, 3.84017043e-02, 3.72285694e-02, 7.55636161e-03,
-5.97706959e-02, -3.67219523e-02, 1.73861650e-03, -5.01133762e-02,
8.41503888e-02, -3.83917131e-02, -3.73696536e-02, 9.66740027e-02,
-5.17699234e-02, -1.10767327e-01, -1.93672135e-01, -8.64445791e-02,
-1.73920393e-01, 2.98542976e-02, 9.33961198e-02, 1.20131977e-01,
5.94598521e-03, 2.72769988e-01, -4.54045162e-02, 1.15285916e-02,
-1.04232945e-01, -1.39212519e-01, -3.93785127e-02, 2.79593933e-02,
-1.60944790e-01, -1.43909017e-02, -2.34741405e-01, 1.63038269e-01,
1.32380843e-01, -2.23268047e-01, 6.76847473e-02, 8.73918712e-01,
1.26256971e-02, 9.04839113e-02, -1.77488387e-01, -2.92885564e-02,
8.88735801e-02, 4.16664742e-02, -9.52726305e-02, 1.63847283e-01,
-4.85682040e-02, 1.45318225e-01, -8.04214552e-02, 2.09539771e-01,
1.40028298e-01, -7.88448900e-02, 5.49530657e-03, 2.17387490e-02,
5.68018854e-02, 2.03615502e-01, 1.31506220e-01, -4.39114608e-02,
1.14745423e-01, 2.50388592e-01, 5.12152612e-02, 5.71495891e-01,
2.47201137e-03, 8.51449296e-02, -1.63073689e-01, -4.67659757e-02,
-2.48251669e-02, 5.60021214e-02, 3.76640931e-02, -1.97907522e-01,
-9.93512094e-06, -6.56042695e-02, -9.58220735e-02, 2.73280591e-02,
2.48394787e-01, 1.62754998e-01, -8.56372714e-02, -1.98870078e-01,
-2.14046631e-02, -1.10991411e-02, 8.65221769e-02, -9.43993032e-02,
1.46579370e-01, -6.42499700e-02, -9.15146247e-02, 3.04352622e-02,
-3.83277610e-02, 7.50675797e-03, 5.30087613e-02, 3.22271958e-02,
3.16464491e-02, 2.31905237e-01, -3.57131958e-02, 2.75742691e-02,
1.64959766e-02, -5.99612109e-02, -1.14173075e-04, 1.16172917e-01,
-2.88563579e-01, 5.43233426e-03, 1.88220769e-01, -1.42211989e-02,
-8.60008821e-02, -1.08991265e-02, 7.03405365e-02, 1.43136263e-01,
1.56540915e-01, 3.37635577e-02, -7.97748752e-03, 2.32997462e-01,
-1.28852725e-01, -4.68709618e-02, -1.26529681e-02, 5.98321892e-02,
-4.14974727e-02, -4.83109355e-02, 1.83557672e-03, 2.13326309e-02,
-8.61705467e-02, -7.02638850e-02, -7.34763891e-02, -3.14446613e-02,
6.40273616e-02, -4.16132025e-02, -7.77681172e-02, 9.82677191e-02,
1.34362187e-02, -8.19453225e-02, -6.01226650e-02, -2.05730852e-02,
6.56994060e-02, 3.22783478e-02, -9.97580886e-02, -4.25382629e-02,
-3.29012759e-02, 3.73392776e-02, -4.75755855e-02, 1.48069277e-01,
-4.89032939e-02, -1.48398161e-01, -1.58696454e-02, 4.26976159e-02,
-6.09734505e-02, 9.64907333e-02, -7.25660846e-02, -4.27006222e-02,
-4.13310826e-02, -1.58633932e-03, 2.29592964e-01, 1.89283505e-01,
-5.85174523e-02, 3.11746541e-02, -1.37412816e-01, -1.25708699e-01,
-1.67236626e-01, 2.29483113e-01, -1.45939574e-01, 4.81953751e-03,
-5.62383533e-02, -7.16430470e-02, 7.33892024e-02, -1.99173409e-02,
-1.04944170e-01, -1.64124668e-02, -1.00565083e-01, -7.03638345e-02,
1.12846531e-01, 1.21177875e-01, -4.17281641e-03, -1.69076607e-01,
6.46030903e-02, 4.97851893e-02, 1.17404148e-01, 9.04208869e-02,
-6.19463250e-02, -1.18783019e-01, 1.60671651e-01, -8.22088897e-01,
9.73701775e-02, -1.12086952e-01, 2.24647624e-03, 1.53234422e-01,
3.97372693e-02, 1.83770165e-01, -6.44111335e-02, 1.51846856e-02,
4.80400063e-02, 8.25664923e-02, -1.37527287e-01, -2.95606017e-01,
6.61922991e-02, 4.59399521e-02, -9.46745500e-02, 6.60824701e-02,
-2.76794732e-02, -3.16641182e-02, 1.03569053e-01, 1.19908847e-01,
-1.11132719e-01, -8.29586461e-02, 1.17348367e-02, 1.52016878e-01,
2.77303215e-02, -3.37865315e-02, -9.93809570e-03, 2.29539294e-02,
-7.86952898e-02, 9.63759958e-04, 2.21204549e-01, -7.92610869e-02,
-8.53400901e-02, -4.25208993e-02, 1.95999444e-02, -1.04939736e-01,
-6.85805604e-02, -1.04262695e-01, 1.01364866e-01, -1.06468625e-01,
-5.88362999e-02, -5.71715198e-02, 6.36743680e-02, 1.58031344e-01,
5.47527634e-02, 1.56661391e-01, 3.26345079e-02, 1.75849393e-01,
-1.58545002e-01, -6.14866288e-03, 1.21671699e-01, 1.31305102e-02,
-1.00042531e-03, -6.92760423e-02, -1.10598415e-01, -2.43191402e-02,
1.69082195e-01, 8.22134037e-03, -3.46466117e-02, 1.91667035e-01,
-7.64223263e-02, 2.83778191e-01, 3.00595053e-02, 3.12378742e-02,
-2.29843765e-01, 7.84699097e-02, -6.64718449e-02, -2.25359231e-01,
-1.60364270e-01, -1.29008725e-01, -7.01376423e-03, 2.37469692e-02,
5.08328862e-02, -4.25486080e-02, 1.54239982e-01, -2.37070769e-01,
7.80097395e-02, 1.42474413e-01, -8.89206529e-02, -9.93912369e-02,
-1.49244517e-01, 1.40175270e-02, 6.17568642e-02, 1.39922053e-02,
-9.76701453e-02, 9.52821821e-02, 1.82246994e-02, 1.70854628e-01,
1.02621382e-02, 1.88155882e-02, -2.20762387e-01, 2.23946813e-02,
2.19321012e-01, 1.57041728e-01, -6.40655011e-02, -2.45706979e-02,
-3.47991139e-01, 3.13312188e-03, -2.88262125e-02, 4.44762222e-02,
2.58121733e-02, -7.24220872e-02, -4.02404368e-02, -2.02075504e-02,
-9.77092087e-02, 7.69700930e-02, 1.22046024e-02, -2.11820900e-02,
4.80787568e-02, 1.69028491e-01, 4.78493348e-02, -1.82144910e-01,
-6.35265335e-02, 1.94437772e-01, -4.34710532e-02, -1.09813467e-01,
-1.17785640e-01, 1.08662471e-01, 1.47749320e-01, -1.06488034e-01,
-6.00782223e-02, 1.23229124e-01, -3.83251533e-02, -1.58925489e-01,
-1.19543269e-01, -1.13904979e-02, 1.08005360e-01, 2.42130198e-02,
-3.06468830e-02, 9.26394090e-02, -8.11743513e-02, 8.38810671e-03,
-2.97471061e-02, -1.18852973e-01, -6.17138594e-02, 8.80208537e-02,
1.05446793e-01, -3.09082288e-02, -2.42552519e-01, 1.14139341e-01,
2.76867952e-02, -9.08729713e-03, 6.75531179e-02, -2.77333528e-01,
-2.37615481e-01, -4.05679643e-02, 1.12076558e-01, 3.86684760e-02,
3.29396352e-02, 1.64538831e-01, -8.98297653e-02, -5.39653637e-02,
7.76950121e-02, 1.15220614e-01, -1.45631015e-01, 7.75127336e-02,
1.56504139e-02, 3.82314548e-02, 1.21506035e-01, -1.03078738e-01,
5.87487556e-02, -4.87266034e-02, 6.22122642e-03, 5.93201637e-01,
-2.29878440e-01, -2.14549229e-02, 8.47616866e-02, -1.61324859e-01,
-3.82918656e-01, -7.03184456e-02, 5.13371490e-02, -6.64953841e-03,
8.03140774e-02, -9.35272500e-03, 4.10862453e-02, 2.33008177e-03,
-2.21265107e-02, -1.79911792e-01, -1.77226216e-01, 1.45732388e-02,
-8.72445628e-02, -8.25577155e-02, -1.87079176e-01, -3.24222855e-02,
-2.46167276e-02, 1.60962254e-01, 6.13528118e-02, -4.87555638e-02,
-1.37563422e-01, 4.57784198e-02, -1.00219093e-01, 9.73707587e-02,
3.99238542e-02, 2.06710119e-02, 2.46743578e-02, -1.78457852e-02,
-1.55743286e-01, 1.76556066e-01, -1.11039311e-01, -7.65650749e-01,
-1.73667476e-01, 3.46910894e-01, -8.93727615e-02, -4.00084220e-02,
1.54162236e-02, 6.12337748e-03, -3.88689116e-02, -1.58689588e-01,
-1.84612703e-02, -9.94756594e-02, 1.48300797e-01, 6.99674860e-02,
-1.77267101e-02, 6.78401589e-02, 1.27457470e-01, 1.76685229e-01,
-7.53202364e-02, 2.03092650e-01, 4.99497764e-02, -3.12729090e-01,
2.26134248e-03, 1.05568254e-02, -5.24634421e-02, 4.13558912e-03,
1.56051785e-01, 3.99602624e-03, 2.12883711e-01, -9.93463676e-03,
2.54744142e-02, 8.19103494e-02, 1.11445911e-01, -1.05812810e-01,
6.45752443e-05, -1.91546977e-02, 2.79098283e-02, -8.73852242e-03,
2.57312119e-01, 7.93981925e-02, 9.15517434e-02, -1.08829342e-01,
4.26840363e-03, 1.09789118e-01, 4.84834947e-02, 1.67876303e-01,
7.85486698e-02, -4.85770434e-01, 8.56535658e-02, -9.46890414e-02,
-1.76884942e-02, -1.32290944e-01, 5.42284176e-02, -2.35500969e-02,
-1.89024240e-01, -2.24347740e-01, 8.47616270e-02, -7.37303053e-04,
-3.76494601e-02, 1.52319223e-01, -1.73706815e-01, -8.70112479e-02,
1.67017236e-01, 1.25947129e-02, 9.80181172e-02, -9.60279405e-02,
-1.20347366e-01, 7.52296997e-04, -6.39457852e-02, 1.69637978e-01,
3.58802974e-02, 1.97292969e-01, 2.55506039e-01, -9.31546465e-02,
-9.79017168e-02, -3.32129225e-02, 1.16092496e-01, 8.65895525e-02,
1.34640440e-01, -3.98736857e-02, 2.41885126e-01, -5.82839362e-02,
-7.36562014e-02, 1.17206164e-02, -1.80632189e-01, -1.86898291e-01,
-5.17638177e-02, 2.50709891e-01, -3.24864946e-02, -9.36941132e-02,
3.62357460e-02, 9.66931581e-02, 1.09416872e-01, -1.44235849e-01,
2.77802378e-01, -4.04531583e-02, -1.37805387e-01, -2.36994252e-02,
1.39410019e-01, -1.69361178e-02, -8.16172808e-02, 5.07616885e-02,
-1.94987684e-01, 5.78816943e-02, -7.42150024e-02, -1.70761794e-01,
1.74665183e-01, -2.93830991e-01, -9.57281739e-02, -8.66684988e-02,
5.83605617e-02, 2.25192700e-02, -5.14378250e-02, 4.61659342e-01,
-1.71913072e-01, 6.86955312e-03, -5.88184595e-03, -1.08846575e-01,
-2.34500870e-01, -1.23935722e-01, -1.38142824e-01, 1.19988382e-01,
-1.02540739e-02, 1.81201939e-02, 1.86580732e-01, 9.65206996e-02,
4.80350554e-02, 3.77480760e-02, -7.23455250e-02, -7.14433193e-02,
8.94886702e-02, -7.64663965e-02, 1.03327237e-01, 1.99393064e-01,
1.46636486e-01, -3.33362222e-02, 1.32991523e-01, 1.68338969e-01,
-8.99649635e-02, -7.85661414e-02, 2.61767685e-01, -4.48555350e-01,
-6.07417990e-03, -1.00212216e-01, -5.71389832e-02, -1.26183242e-01,
-1.09990761e-02, -5.10786548e-02, -9.60177779e-02, -2.43437365e-02,
-8.09838343e-03, -8.07936713e-02, -3.41104083e-02, 9.12442990e-03,
-5.54867275e-02, -7.80701935e-02, 6.03309879e-03, 2.94040609e-02,
-1.96897522e-01, 2.27648970e-02, 7.43478835e-02, -1.30234376e-01,
-2.39419937e-01, -4.40853089e-02, 3.24613452e-01, -1.74817219e-01,
-1.13756686e-01, 2.07915708e-01, -6.81077540e-02, 1.20965511e-01,
2.94481888e-02, 1.74825042e-01, 1.56636670e-01, 5.32507360e-01,
-1.24678701e-01, 1.38424197e-02, -1.91692948e-01, 2.78950715e-03,
5.64180352e-02, -1.44241462e-02, 1.10502698e-01, -2.17856139e-01,
8.29654634e-02, 3.53045091e-02, 8.90630931e-02, -1.77031204e-01,
-1.11402143e-02, -1.10420868e-01, -1.99949846e-01, 3.43523562e-01,
1.18714370e-01, 2.61231177e-02, -3.01619787e-02, -5.82592338e-02,
-3.76139693e-02, -2.74843574e-01, 1.72560841e-01, 2.14335099e-02,
-1.97129816e-01, 1.88732803e-01, 2.51415908e-01, 9.20654982e-02,
1.40927672e-01, 8.04072767e-02, -1.39051422e-01, -8.07370543e-02,
9.18529835e-03, 3.12853232e-02, 1.37809038e-01, -8.60377923e-02,
9.63857397e-02, -4.44471575e-02, 9.66779441e-02, 1.95071220e-01,
-8.36386308e-02, -2.09051073e-02, 2.41695791e-01, 6.69163242e-02,
5.15889488e-02, -3.06147814e-01, -4.85827923e-02, 4.90279570e-02,
-2.93022394e-02, 1.35610327e-01, -9.98105779e-02, 7.70724267e-02,
-6.00924976e-02, -1.00163817e-01, 7.18366951e-02, -1.19214445e-01,
7.65648438e-03, 1.16288364e-01, 1.08143292e-01, -8.61057565e-02,
-5.74962310e-02, -7.70935193e-02, 9.62597877e-02, -7.03946920e-04,
1.78729042e-01, 7.25205839e-02, 2.35247202e-02, 9.27590430e-02,
1.10739201e-01, -1.73132401e-02, 1.20784687e-02, -3.45810205e-01,
7.76101425e-02, -1.61295727e-01, 8.49397108e-02, 5.58736809e-02,
6.07301258e-02, 1.64249659e-01, 6.12687580e-02, 3.69201154e-02,
-2.03923792e-01, -2.70327646e-02, 9.16342437e-02, 1.39949083e-01,
9.42087695e-02, 1.35681361e-01, 6.94272518e-02, 1.49722071e-02,
-2.63409130e-02, 6.02116762e-03, 4.24321704e-02, -6.70676604e-02,
-2.46162742e-01, -1.69358868e-02, 9.02379155e-02, 2.48299222e-02,
-6.89595714e-02, 3.39369737e-02, 1.60543174e-01, -1.45407110e-01,
-8.18309709e-02, 1.83216315e-02, -1.34991914e-01, -6.13780133e-02,
8.74837190e-02, -1.25442013e-01, -5.83080277e-02, -1.30316854e-01,
-2.31559463e-02, -4.30523679e-02, 9.49881449e-02, -8.97088572e-02,
-4.32207249e-02, 1.14923790e-02, 3.47515196e-02, -1.50968460e-02,
-3.12420521e-02, 8.69997069e-02, 3.72876972e-02, -2.60844707e-01,
5.44360653e-02, 2.42607817e-01, 2.74234153e-02, -5.17884456e-02,
1.59547761e-01, -1.92688257e-02, 1.71144441e-01, 2.43071970e-02,
1.52212068e-01, 2.07957476e-01, 3.13755833e-02, 4.71814116e-03,
2.02903926e-01, 5.66636771e-03, -5.40881753e-02, 3.40890363e-02,
9.91758034e-02, 1.57027453e-01, -1.35958433e-01, -1.12751730e-01,
3.86208333e-02, -9.56841856e-02, -1.98908746e-01, 2.52441992e-03,
-3.03306710e-02, 1.34130582e-01, -2.21352592e-01, 1.44426888e-02,
9.74281952e-02, 8.06700811e-02, -2.42046282e-01, -6.41992688e-02,
2.92708706e-02, -1.19211741e-01, 4.28062351e-03, 5.81018925e-01,
-5.88369481e-02, -1.53965831e-01, 1.69160112e-03, -3.93524468e-02,
-5.29663749e-02, 7.85565451e-02, 4.08855081e-02, -9.89483111e-03,
1.35682702e-01, 4.47031297e-02, -1.08934678e-01, -1.37776583e-01,
-9.56171453e-02, -1.09696100e-02, 9.24261212e-02, 6.84888884e-02,
1.44111767e-01, -1.58654768e-02, -2.06564635e-01, 1.91454321e-01,
-9.13801119e-02, -2.36673504e-01, -8.87821764e-02, -3.37554663e-02,
-5.56394905e-02, 6.51014745e-02, 1.96394548e-01, 6.61615729e-02,
2.77996898e-01, -8.63036811e-01, -1.38852643e-02, -1.22280695e-01,
-1.24892682e-01, -9.03077498e-02, 8.18398744e-02, 2.67975062e-01,
4.07496616e-02, -4.07935716e-02, 1.79799289e-01, 7.38511654e-03,
-1.65202618e-02, -1.21862344e-01, -2.57932727e-04, 5.39154708e-02,
-2.12313794e-02, 1.28011713e-02, 9.36827958e-02, -9.87139493e-02,
8.12445506e-02, -3.99992839e-02, -2.36591071e-01, 2.29170114e-01],
dtype=float32))
Load the split file. Here, since we have 5 slides, we use a split file for 5x4 nested cross validation
# Load the .npz file
file_path = f"{path2input}train_valid_test_idx.npz"
split_file = np.load(file_path, allow_pickle = True)
# Explore the contents of each key
for key in split_file.files:
print(f"\nKey: {key}")
print("Shape:", split_file[key].shape)
Key: train_idx Shape: (5, 4) Key: valid_idx Shape: (5, 4) Key: test_idx Shape: (5,)
Load the gene file
genes=pd.read_pickle(f'{path2input}gene_file.pkl')['gene']
Define the model parameters
ik_fold=0 # to fully train the model, the regression model should be trained for ik_folds=[0,1,2,3,4]
il_fold=0 # to fully train the model, the regression model should be trained for il_folds=[0,1,2,3]
max_epochs=10 # to fully train the model, the regression model should be trained with max_epochs=500
Define the command
command = f"python ../scripts/1.ST_prediction/1.2.Regression/1main_regression.py {path2input} {path2output} {ik_fold} {il_fold} {max_epochs}"
print(command)
python ../scripts/1.ST_prediction/1.2.Regression/1main_regression.py ../input_data/ ../output_data/ 0 0 10
Execute the command
# Measure execution time
start_time = time.time()
try:
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True, cwd=os.getcwd())
print("Command Output:\n", result.stdout)
except subprocess.CalledProcessError as e:
print("Error occurred:\n", e.stderr)
# Calculate elapsed time
end_time = time.time()
elapsed_time = end_time - start_time
print(f"Execution Time: {elapsed_time:.2f} seconds")
Command Output: device: cuda genes: ['AL627309.5' 'LINC01409' 'LINC01128' ... 'MT-CYB' 'AC011043.1' 'AC007325.4'] len(genes): 14068 ../output_data//result_0_0 len(features): 4604 rna_file: ../input_data/ge_actual.pkl --- fit --- 0, train_loss: 0.0498, coef: 0.1754, valid_loss: 0.0461, coef: 0.0256 1, train_loss: 0.0438, coef: 0.2751, valid_loss: 0.0530, coef: 0.0359 2, train_loss: 0.0424, coef: 0.2947, valid_loss: 0.0534, coef: 0.0438 3, train_loss: 0.0417, coef: 0.3073, valid_loss: 0.0557, coef: 0.0478 4, train_loss: 0.0411, coef: 0.3171, valid_loss: 0.0527, coef: 0.0532 5, train_loss: 0.0407, coef: 0.3255, valid_loss: 0.0541, coef: 0.0561 6, train_loss: 0.0403, coef: 0.3317, valid_loss: 0.0528, coef: 0.0596 7, train_loss: 0.0400, coef: 0.3376, valid_loss: 0.0560, coef: 0.0601 8, train_loss: 0.0397, coef: 0.3434, valid_loss: 0.0571, coef: 0.0618 9, train_loss: 0.0395, coef: 0.3477, valid_loss: 0.0554, coef: 0.0641 --- completed --- Execution Time: 523.19 seconds
We need to extract the features on the TCGA slide (like we did in step 1.1)
Define the inputs
path2input_pred = f'{path2input}slides/TCGA-OL-A5S0-01Z-00-DX1.49A7AC9D-C186-406C-BA67-2D73DE82E13B.svs'
path2output_pred = f'{path2output}features_test/'
slide_name_pred = 'OL-A5S0-01Z-00-DX1'
Define the command
command = f"python ../scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction_TCGA.py {path2input_pred} {path2output_pred} {slide_name_pred}"
print(command)
python ../scripts/1.ST_prediction/1.1.Feature_extraction/1main_feature_extraction_TCGA.py ../input_data/slides/TCGA-OL-A5S0-01Z-00-DX1.49A7AC9D-C186-406C-BA67-2D73DE82E13B.svs ../output_data/features_test/ OL-A5S0-01Z-00-DX1
Execute the command
# Measure execution time
start_time = time.time()
try:
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True, cwd=os.getcwd())
print("Command Output:\n", result.stdout)
except subprocess.CalledProcessError as e:
print("Error occurred:\n", e.stderr)
# Calculate elapsed time
end_time = time.time()
elapsed_time = end_time - start_time
print(f"Execution Time: {elapsed_time:.2f} seconds")
Command Output: device: cuda Device: cpu [WARNING] Magnification not found, assuming: 40 Downsampling factor: 2 Slide dimensions (level 0): 11940 x 15472, Tile size: 320 Rows: 24, Columns: 18, Total tiles: 432 Processing row: 0/24 Processing row: 1/24 Processing row: 2/24 Processing row: 3/24 Processing row: 4/24 Processing row: 5/24 Processing row: 6/24 Processing row: 7/24 Processing row: 8/24 Processing row: 9/24 Processing row: 10/24 Processing row: 11/24 Processing row: 12/24 Processing row: 13/24 Processing row: 14/24 Processing row: 15/24 Processing row: 16/24 Processing row: 17/24 Processing row: 18/24 Processing row: 19/24 Processing row: 20/24 Processing row: 21/24 Processing row: 22/24 Processing row: 23/24 Figure(4000x2000) Completed processing. n_tiles: 313 tiles.shape: torch.Size([313, 3, 224, 224]) features.shape: (313, 768) Features saved to ../output_data/features_test/OL-A5S0-01Z-00-DX1.pkl Execution Time: 157.17 seconds
Example of Spatial Transcriptomics (ST) Prediction for a TCGA Slide Using a Model with One Inner and One Outer Fold
We start by importing the necessary modules and setting the path to the prediction script.
# Define the path to the prediction script and add it to the system path
script_path = Path("../scripts/1.ST_prediction/1.3.Prediction")
sys.path.append(str(script_path))
# Import the prediction function
from TCGA_Prediction import predict_st_from_trained_model
#Define the path to the test features file
path_to_test_features = "../output_data/features_test/OL-A5S0-01Z-00-DX1.pkl"
# Load the features from the pickle file
features_list = np.load(f"{path_to_test_features}", allow_pickle=True)
# Define the outer and inner cross-validation folds
ik_folds = [0] # Example outer fold index
il_folds = [0] # Example inner fold index
Now, we use the predict_st_from_trained_model function to generate predictions for the test slide.
tcga_st_pred = predict_st_from_trained_model(ik_folds, il_folds,features_list,
path2models = path2output,
genes = genes)
ik_fold: 0
View the Prediction Results
tcga_st_pred.head()
| gene | AL627309.5 | LINC01409 | LINC01128 | LINC00115 | FAM41C | NOC2L | KLHL17 | PLEKHN1 | HES4 | ISG15 | ... | MT-ATP6 | MT-CO3 | MT-ND3 | MT-ND4L | MT-ND4 | MT-ND5 | MT-ND6 | MT-CYB | AC011043.1 | AC007325.4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OL-A5S0-01Z-00-DX1_5120_640 | 0.000000 | 0.063481 | 0.137235 | 0.0 | 0.000000 | 0.366984 | 0.094526 | 0.011786 | 0.242220 | 0.503742 | ... | 1.856757 | 2.162080 | 1.604967 | 0.537832 | 2.073462 | 0.943535 | 0.035123 | 1.772477 | 0.004086 | 0.128883 |
| OL-A5S0-01Z-00-DX1_5760_640 | 0.000000 | 0.090824 | 0.129589 | 0.0 | 0.011592 | 0.437613 | 0.090697 | 0.027083 | 0.272966 | 0.533956 | ... | 1.955625 | 2.249601 | 1.662094 | 0.581792 | 2.147532 | 0.965505 | 0.051561 | 1.850879 | 0.021384 | 0.182696 |
| OL-A5S0-01Z-00-DX1_6400_640 | 0.000000 | 0.059229 | 0.090626 | 0.0 | 0.009585 | 0.364503 | 0.079889 | 0.004146 | 0.299876 | 0.534686 | ... | 1.866759 | 2.171256 | 1.560895 | 0.574450 | 2.032656 | 0.956175 | 0.022169 | 1.752970 | 0.014386 | 0.134413 |
| OL-A5S0-01Z-00-DX1_7040_640 | 0.004623 | 0.069930 | 0.084290 | 0.0 | 0.008578 | 0.404981 | 0.100633 | 0.024949 | 0.336416 | 0.536940 | ... | 1.960141 | 2.249665 | 1.589541 | 0.551702 | 2.068218 | 0.969224 | 0.040065 | 1.793535 | 0.035897 | 0.120231 |
| OL-A5S0-01Z-00-DX1_7680_640 | 0.000000 | 0.035643 | 0.107543 | 0.0 | 0.000000 | 0.335269 | 0.064756 | 0.000000 | 0.224696 | 0.438432 | ... | 1.718369 | 2.042897 | 1.445177 | 0.495116 | 1.933079 | 0.838902 | 0.023798 | 1.642045 | 0.025675 | 0.110878 |
5 rows × 14068 columns
After obtaining thre predictiosn, we perform the smoothing step
#### Smoothing function
def smooth_genes_kdtree(slide_df, genes, radius=2, weights = 'uniform'):
# Extract spatial coordinates and gene data
coordinates = slide_df[['x', 'y']].values
gene_data = slide_df[genes].values
# Build a KDTree for fast radius neighbor searches
tree = cKDTree(coordinates)
# Query the tree for neighbors within the radius for each point
indices = [tree.query_ball_point(point, r=radius) for point in coordinates]
# Prepare an array to hold smoothed gene values
smoothed_gene_data = np.zeros_like(gene_data)
# Compute average values of all genes for neighbors within the radius
for i, neighbors in enumerate(indices):
if neighbors:
# Calculate the mean across all selected genes for these indices
smoothed_gene_data[i] = gene_data[neighbors].mean(axis=0)
if weights != 'uniform':
smoothed_gene_data[i] = (len(neighbors)*smoothed_gene_data[i] + (weights-1)*gene_data[i])/(len(neighbors) + weights -1)
else:
# Handle cases with no neighbors (could handle differently if needed)
smoothed_gene_data[i] = gene_data[i]
# Create a DataFrame for smoothed gene values
smoothed_knn = pd.DataFrame(smoothed_gene_data, columns=genes, index=slide_df.index)
# Optionally, combine original data with smoothed data
result_df = slide_df.copy()
result_df.update(smoothed_knn)
return result_df
## extract x,y coordinates from spot names
def get_x_y_grid(df_pred, tile_size=640):
slide_names=df_pred.index.str.split('_').str[0]
# Split 'spot_id' to extract 'x' and 'y' coordinates
x = df_pred.index.str.split('_').str[-1]
y = df_pred.index.str.split('_').str[-2]
# Convert 'x' and 'y' from strings to floats
x = (x.astype(float)-x.astype(float).min())//tile_size
y = (y.astype(float)-y.astype(float).min())//tile_size
out_df = pd.DataFrame({'slide_file_name':slide_names,'x':x, 'y':y}, index = df_pred.index)
return out_df
grid_df = get_x_y_grid(tcga_st_pred)
tcga_st_pred = grid_df.join(tcga_st_pred)
tcga_st_pred = tcga_st_pred.sort_values(['slide_file_name', 'x', 'y'])
tcga_st_pred_s = smooth_genes_kdtree(tcga_st_pred, genes, radius=2, weights ='uniform')
tcga_st_pred_s.head(5)
| slide_file_name | x | y | AL627309.5 | LINC01409 | LINC01128 | LINC00115 | FAM41C | NOC2L | KLHL17 | ... | MT-ATP6 | MT-CO3 | MT-ND3 | MT-ND4L | MT-ND4 | MT-ND5 | MT-ND6 | MT-CYB | AC011043.1 | AC007325.4 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OL-A5S0-01Z-00-DX1_5120_640 | OL-A5S0-01Z-00-DX1 | 0.0 | 7.0 | 0.000000 | 0.079070 | 0.130132 | 0.0 | 0.023046 | 0.401769 | 0.081746 | ... | 1.902388 | 2.186774 | 1.623865 | 0.564500 | 2.086916 | 0.939488 | 0.041352 | 1.800760 | 0.027332 | 0.150518 |
| OL-A5S0-01Z-00-DX1_5760_640 | OL-A5S0-01Z-00-DX1 | 0.0 | 8.0 | 0.000578 | 0.076432 | 0.112029 | 0.0 | 0.014338 | 0.397474 | 0.078107 | ... | 1.893562 | 2.184277 | 1.594706 | 0.558414 | 2.065148 | 0.933467 | 0.034625 | 1.781440 | 0.029887 | 0.143750 |
| OL-A5S0-01Z-00-DX1_6400_640 | OL-A5S0-01Z-00-DX1 | 0.0 | 9.0 | 0.000514 | 0.070372 | 0.105360 | 0.0 | 0.008933 | 0.391541 | 0.082247 | ... | 1.888205 | 2.191742 | 1.582788 | 0.556548 | 2.052988 | 0.930027 | 0.031429 | 1.775921 | 0.029741 | 0.142698 |
| OL-A5S0-01Z-00-DX1_7040_640 | OL-A5S0-01Z-00-DX1 | 0.0 | 10.0 | 0.000514 | 0.062812 | 0.101876 | 0.0 | 0.011261 | 0.381107 | 0.080334 | ... | 1.872242 | 2.171229 | 1.563104 | 0.543288 | 2.026742 | 0.918676 | 0.024383 | 1.758730 | 0.029152 | 0.123052 |
| OL-A5S0-01Z-00-DX1_7680_640 | OL-A5S0-01Z-00-DX1 | 0.0 | 11.0 | 0.000578 | 0.057530 | 0.102105 | 0.0 | 0.009892 | 0.373124 | 0.075897 | ... | 1.855960 | 2.150274 | 1.543203 | 0.540031 | 2.011223 | 0.906584 | 0.019498 | 1.741664 | 0.033048 | 0.124812 |
5 rows × 14071 columns
Save the smoothed and non-smoothed predictions
tcga_st_pred_s.to_pickle(f'{path2output}smoothed_preds_tcga.pkl')
tcga_st_pred.to_pickle(f'{path2output}preds_tcga.pkl')
# Print Python version
print(f"Python version: {sys.version}")
Python version: 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:23:14) [GCC 10.4.0]
# Print installed packages and their versions
installed_packages = {pkg.key: pkg.version for pkg in pkg_resources.working_set}
for package, version in installed_packages.items():
print(f"{package}=={version}")
simpleitk==2.3.1 spagcn==1.2.7 absl-py==2.1.0 access==1.1.9 ace-tools==0.0 affine==2.4.0 autograd==1.6.2 autograd-gamma==0.5.0 brokenaxes==0.6.2 click-plugins==1.1.1 cligj==0.7.2 cytospace==1.1.0 datatable==1.1.0 deprecation==2.1.0 einops==0.7.0 esda==2.6.0 fiona==1.10.0 formulaic==1.0.1 geopandas==1.0.1 giddy==2.3.5 gseapy==1.1.3 huggingface-hub==0.20.3 igraph==0.11.6 immutabledict==4.2.0 inequality==1.0.1 interface-meta==1.3.0 lapjv==1.3.14 legacy-api-wrap==1.4 leidenalg==0.10.2 libpysal==4.12.0 lifelines==0.28.0 louvain==0.8.2 mapclassify==2.8.0 matplotlib-venn==0.11.10 mgwr==2.2.1 momepy==0.8.0 openslide-python==1.3.1 ortools==9.3.10497 pip==24.1.2 pointpats==2.5.0 protobuf==3.20.1 pykwalify==1.8.0 pyogrio==0.9.0 pypdf2==3.0.1 pyradiomics==3.0.1 pysal==24.7 python-igraph==0.11.6 quantecon==0.7.2 radiomics==0.1 rasterio==1.3.11 rasterstats==0.19.0 ripleyk==0.0.3 safetensors==0.4.2 scanpy==1.10.1 seaborn==0.13.2 segregation==2.5 session-info==1.0.0 snuggs==1.4.7 spaghetti==1.7.6 spams==2.6.5.4 spglm==1.1.0 spint==1.0.7 splot==1.1.6 spopt==0.6.1 spreg==1.6.1 spvcm==0.3.0 texttable==1.7.0 tobler==0.11.3 tokenizers==0.15.2 transformers==4.38.0 automat==22.10.0 babel==2.12.1 bottleneck==1.3.7 configargparse==1.5.5 cython==0.29.36 dendropy==4.6.1 deprecated==1.2.14 edflib-python==1.0.7 flask==2.3.2 flask-cors==4.0.0 gitpython==3.1.31 htseq==2.0.3 heapdict==1.0.1 jinja2==3.1.2 keras-preprocessing==1.1.2 levenshtein==0.21.1 mako==1.2.4 markdown==3.4.3 markupsafe==2.1.3 pillow==9.2.0 pulp==2.7.0 pyjwt==2.7.0 pynacl==1.5.0 pyopengl==3.1.6 pyqt5==5.15.7 pyqt5-sip==12.11.0 pyqtwebengine==5.15.4 pysocks==1.7.1 pyvcf3==1.0.3 pywavelets==1.4.1 pyyaml==6.0 pygments==2.15.1 qdarkstyle==3.2.3 qtawesome==1.2.3 qtpy==2.4.1 rtree==1.0.1 sqlalchemy==2.0.18 secretstorage==3.3.3 send2trash==1.8.2 theano==1.0.5 unidecode==1.3.6 werkzeug==2.3.6 xlsxwriter==3.1.2 aioeasywebdav==2.4.0 aiohttp==3.8.4 aioredis==2.0.1 aiosignal==1.3.1 alabaster==0.7.13 amply==0.1.6 anndata==0.9.1 anyio==3.7.1 appdirs==1.4.4 argcomplete==3.1.1 argh==0.27.2 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 arviz==0.15.1 asn1crypto==1.5.1 astor==0.8.1 astroid==2.15.5 astropy==5.3.1 asttokens==2.2.1 astunparse==1.6.3 async-generator==1.10 async-timeout==4.0.2 atomicwrites==1.4.1 attmap==0.13.2 attrs==23.1.0 autopep8==2.0.4 backcall==0.2.0 backports.functools-lru-cache==1.6.5 basemap==1.3.7 basemap-data==1.3.2 bcrypt==3.2.2 beautifulsoup4==4.12.2 bidict==0.22.1 binaryornot==0.4.4 biom-format==2.1.15 biopython==1.81 bitarray==2.7.6 black==23.3.0 bleach==6.0.0 blinker==1.6.2 bokeh==3.2.0 boltons==23.0.0 boto==2.49.0 boto3==1.28.1 botocore==1.31.1 brotlipy==0.7.0 bz2file==0.98 cached-property==1.5.2 cachetools==5.3.1 certifi==2024.6.2 cffi==1.15.1 cftime==1.6.2 chardet==5.1.0 charset-normalizer==3.2.0 click==8.1.4 clikit==0.6.2 cloudpickle==2.2.1 clyent==1.2.2 colorama==0.4.6 colorcet==3.0.1 coloredlogs==15.0.1 colorful==0.5.4 colormath==3.0.0 colorspacious==1.1.2 comm==0.1.3 commonmark==0.9.1 conda==23.3.1 conda-package-handling==2.0.2 conda-package-streaming==0.8.0 configparser==5.3.0 connection-pool==0.0.3 constantly==15.1.0 contextlib2==21.6.0 contourpy==1.1.0 cookiecutter==2.2.0 crashtest==0.4.1 crc32c==2.3.post0 crcmod==1.7 cryptography==39.0.0 cupy==12.1.0 cvxopt==0.0.0 cvxpy==1.3.2 cxxfilt==0.3.0 cycler==0.11.0 cytoolz==0.12.0 darkdetect==0.8.0 dask==2023.7.0 dask-jobqueue==0.8.2 dataclasses==0.8 datashape==0.5.4 datrie==0.8.2 debugpy==1.6.7 decorator==5.1.1 deepdiff==6.3.1 defusedxml==0.7.1 descartes==1.1.0 diff-match-patch==20230430 dill==0.3.6 dipy==1.7.0 distlib==0.3.6 distributed==2023.7.0 dm-tree==0.1.7 dnspython==2.3.0 docopt==0.6.2 docstring-to-markdown==0.12 docutils==0.20.1 dpath==2.1.6 dropbox==11.36.2 ecos==2.0.11 eeglabio==0.0.2.post4 entrypoints==0.4 et-xmlfile==1.1.0 exceptiongroup==1.1.2 executing==1.2.0 fabric==3.1.0 fastcache==1.1.0 fastjsonschema==2.17.1 fastrlock==0.8 feather-format==0.4.1 filechunkio==1.8 filelock==3.12.2 flake8==6.1.0 flatbuffers==23.5.26 flit-core==3.9.0 fonttools==4.40.0 freetype-py==2.3.0 frozenlist==1.3.3 fsspec==2023.6.0 ftputil==5.0.4 func-timeout==4.3.5 future==0.18.3 gast==0.4.0 gemmi==0.6.4 geneimpacts==0.3.7 gevent==22.10.2 gffutils==0.11.1 gitdb==4.0.10 gitdb2==4.0.2 glob2==0.7 globus-sdk==3.23.0 gmpy2==2.1.2 google-api-core==2.11.1 google-api-python-client==2.92.0 google-auth==2.21.0 google-auth-httplib2==0.1.0 google-auth-oauthlib==0.4.6 google-cloud-core==2.3.3 google-cloud-storage==2.10.0 google-crc32c==1.1.2 google-pasta==0.2.0 google-resumable-media==2.5.0 googleapis-common-protos==1.59.1 greenlet==2.0.2 grpcio==1.51.1 gym==0.26.1 gym-notices==0.0.8 h5io==0.1.8 h5netcdf==1.2.0 h5py==3.8.0 hdf5storage==0.1.19 helpdev==0.7.1 hiredis==2.2.3 holoviews==1.16.2 html5lib==1.1 httplib2==0.22.0 httpstan==4.6.1 humanfriendly==10.0 hyperlink==21.0.0 hypothesis==6.80.1 idna==3.4 ihm==0.43 imagecodecs==2022.8.8 imageio==2.31.1 imageio-ffmpeg==0.4.8 imagesize==1.4.1 importlib-metadata==6.8.0 importlib-resources==6.0.0 incremental==22.10.0 inflection==0.5.1 iniconfig==2.0.0 intervaltree==3.1.0 invoke==2.1.3 ipycanvas==0.13.1 ipyevents==2.0.1 ipykernel==6.29.5 ipympl==0.9.3 ipyparallel==8.6.1 ipython==8.14.0 ipython-genutils==0.2.0 ipyvtklink==0.2.3 ipywidgets==7.7.5 isal==1.1.0 isort==5.12.0 itsdangerous==2.1.2 jaraco.classes==3.2.3 jax==0.3.25 jaxlib==0.3.25 jdcal==1.4.1 jedi==0.18.2 jeepney==0.8.0 jellyfish==1.0.0 jinja2-time==0.2.0 jmespath==1.0.1 joblib==1.3.0 json5==0.9.14 jsonpatch==1.32 jsonpickle==2.2.0 jsonpointer==2.0 jsonschema==4.18.0 jsonschema-specifications==2023.6.1 jupyter==1.0.0 jupyter-client==8.3.0 jupyter-console==6.6.3 jupyter-core==5.3.1 jupyter-events==0.6.3 jupyter-server==2.7.0 jupyter-server-terminals==0.4.4 jupyterlab-pygments==0.2.2 jupyterlab-widgets==1.1.4 keras==2.11.0 keyring==24.2.0 kiwisolver==1.4.4 lazy-loader==0.2 lazy-object-proxy==1.9.0 libmambapy==1.2.0 line-profiler==4.0.3 linkify-it-py==2.0.0 llvmlite==0.40.1 lmdb==1.4.1 locket==1.0.0 logmuse==0.2.6 loguru==0.7.0 lxml==4.9.2 lz4==4.3.2 mamba==1.2.0 markdown-it-py==3.0.0 marshmallow==3.19.0 matplotlib==3.7.2 matplotlib-inline==0.1.6 mccabe==0.7.0 mdit-py-plugins==0.4.0 mdurl==0.1.0 meshio==5.3.4 mffpy==0.8.0 mistune==3.0.0 mizani==0.9.2 mne==1.4.2 mne-qt-browser==0.5.1 mock==5.0.2 modelcif==0.9 more-itertools==9.1.0 mpmath==1.3.0 msgpack==1.0.5 multidict==6.0.4 multipledispatch==0.6.0 munkres==1.1.4 mypy-extensions==1.0.0 mysql-connector-python==8.0.31 natsort==8.4.0 nbclassic==1.0.0 nbclient==0.8.0 nbconvert==7.6.0 nbformat==5.9.0 nest-asyncio==1.5.6 netcdf4==1.6.2 networkx==3.1 nibabel==5.1.0 nilearn==0.10.1 nltk==3.8.1 nose==1.3.7 notebook==6.5.4 notebook-shim==0.2.3 npx==0.1.1 numba==0.57.1 numexpr==2.7.3 numpy==1.24.4 numpydoc==1.5.0 oauth2client==4.1.3 oauthlib==3.2.2 odo==0.5.1 olefile==0.46 opencensus==0.11.2 opencensus-context==0.1.3 opencv-python==4.6.0 openpyxl==3.1.2 opt-einsum==3.3.0 ordered-set==4.1.0 orjson==3.9.2 osqp==0.6.3 overrides==7.3.1 packaging==23.1 palettable==3.3.3 pandas==2.0.3 pandocfilters==1.5.0 panel==1.2.0 param==1.13.0 paramiko==3.2.0 parasail==1.3.4 parso==0.8.3 partd==1.4.0 pastel==0.2.1 path==16.7.1 pathlib2==2.3.7.post1 pathspec==0.11.1 pathtools==0.1.2 patsy==0.5.3 pbr==5.11.1 pep8==1.7.1 peppy==0.35.6 pexpect==4.8.0 pickleshare==0.7.5 pkgutil-resolve-name==1.3.10 plac==1.3.5 platformdirs==3.8.1 plotly==5.15.0 plotnine==0.12.1 pluggy==1.2.0 plumbum==1.8.2 ply==3.11 pooch==1.7.0 poyo==0.5.0 prettytable==3.7.0 prometheus-client==0.17.0 prompt-toolkit==3.0.39 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pyopenssl==23.2.0 pyarrow==10.0.1 pyasn1==0.4.8 pyasn1-modules==0.2.7 pycairo==1.24.0 pycodestyle==2.11.1 pycosat==0.6.4 pycparser==2.21 pycrypto==2.6.1 pyct==0.4.6 pycurl==7.45.1 pydocstyle==6.3.0 pydot==1.4.2 pyerfa==2.0.0.3 pyfaidx==0.7.2.1 pyfasta==0.5.2 pyflakes==3.1.0 pyglet==1.5.27 pygpu==0.7.6 pygraphviz==1.10 pyhamcrest==2.0.4 pylev==1.4.0 pylint==2.17.4 pylint-venv==3.0.2 pyls-spyder==0.4.0 pymatreader==0.0.32 pymongo==4.4.0 pynndescent==0.5.10 pyodbc==4.0.39 pyopencl==2023.1.1 pyparsing==3.0.9 pyproj==3.4.1 pyqtgraph==0.13.3 pyrsistent==0.19.3 pysam==0.21.0 pysftp==0.2.9 pyshp==2.3.1 pysimdjson==5.0.2 pysmi==0.3.4 pytest==7.4.0 pytest-arraydiff==0.5.0 pytest-doctestplus==0.13.0 pytest-openfiles==0.5.0 pytest-remotedata==0.4.0 pytest-runner==6.0.0 python-levenshtein==0.21.1 python-dateutil==2.8.2 python-hostlist==1.21 python-irodsclient==1.1.8 python-json-logger==2.0.7 python-lsp-black==1.3.0 python-lsp-jsonrpc==1.1.2 python-lsp-server==1.9.0 python-picard==0.7 python-slugify==8.0.1 pytoolconfig==1.2.5 pytools==2023.1 pytz==2023.3 pytz-deprecation-shim==0.1.0.post0 pyu2f==0.1.5 pyvista==0.40.0 pyvistaqt==0.0.0 pyviz-comms==2.3.2 pyxdg==0.28 pyzmq==25.1.0 qdldl==0.1.5.post2 qstylizer==0.2.2 qtconsole==5.5.2 rapidfuzz==2.15.1 ray==2.2.0 redis==4.5.5 referencing==0.29.1 regex==2023.6.3 reportlab==4.0.4 requests==2.31.0 requests-oauthlib==1.3.1 reretry==0.11.8 retrying==1.3.3 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rich==13.4.2 rlpycairo==0.2.0 rope==1.9.0 rpds-py==0.8.8 rpy2==3.5.13 rsa==4.9 ruamel.yaml==0.17.32 ruamel.yaml.clib==0.2.7 s3transfer==0.6.1 scikit-image==0.21.0 scikit-learn==1.3.0 scipy==1.11.1 scooby==0.7.2 scs==3.2.3 service-identity==18.1.0 setuptools==68.0.0 setuptools-scm==7.1.0 sh==2.0.4 shapely==2.0.1 simplegeneric==0.8.1 simplejson==3.19.1 sinfo==0.3.1 singledispatch==0.0.0 sip==6.7.9 six==1.16.0 slacker==0.14.0 smart-open==6.3.0 smmap==3.0.5 snakemake==7.30.1 sniffio==1.3.0 snowballstemmer==2.2.0 sortedcollections==2.1.0 sortedcontainers==2.4.0 soupsieve==2.3.2.post1 sphinx==7.0.1 sphinxcontrib-applehelp==1.0.4 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 spyder==5.5.0 spyder-kernels==2.5.2 stack-data==0.6.2 statsmodels==0.14.0 stdlib-list==0.8.0 stone==3.3.1 stopit==1.1.2 svgutils==0.3.4 sympy==1.12 tables==3.7.0 tabulate==0.9.0 tblib==1.7.0 tenacity==8.2.2 tensorboard==2.11.2 tensorboardx==2.5 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow==2.11.0 tensorflow-estimator==2.11.0 tensorflow-probability==0.19.0 termcolor==2.3.0 terminado==0.17.1 terminaltables==3.1.10 testpath==0.6.0 text-unidecode==1.3 textdistance==4.5.0 threadpoolctl==3.1.0 three-merge==0.1.1 throttler==1.2.1 tifffile==2022.10.10 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.8 toolz==0.12.0 toposort==1.10 torch==1.12.1.post201 torchvision==0.13.0a0+8069656 tornado==6.3.2 tqdm==4.65.0 traitlets==5.9.0 twobitreader==3.1.7 typing-extensions==4.7.1 typing-utils==0.1.0 tzdata==2023.3 tzlocal==5.0.1 ubiquerg==0.6.2 uc-micro-py==1.0.1 ujson==5.7.0 umap-learn==0.5.3 unicodecsv==0.14.1 unicodedata2==15.0.0 uritemplate==4.1.1 urllib3==1.26.15 veracitools==0.1.3 virtualenv==20.23.1 vtk==9.2.5 watchdog==3.0.0 wcwidth==0.2.6 webargs==8.2.0 webencodings==0.5.1 websocket-client==1.6.1 whatthepatch==1.0.5 wheel==0.40.0 whichcraft==0.6.1 widgetsnbextension==3.6.4 wrapt==1.15.0 wslink==1.11.1 wurlitzer==3.0.3 xarray==2023.6.0 xarray-einstats==0.5.1 xgboost==1.7.4 xlrd==2.0.1 xlwt==1.3.0 xmlrunner==1.7.7 xmltodict==0.13.0 xopen==1.7.0 xyzservices==2023.5.0 yapf==0.33.0 yarl==1.9.2 yte==1.5.1 zict==3.0.0 zipp==3.15.0 zope.event==5.0 zope.interface==6.0 zstandard==0.19.0