<jupyter_start><jupyter_text>Generating the MGS coded nuclear imagesBelow, we generate an image in which each nucleus has a value that corresponds to it's mechano-genomic score (MGS) which is a measure of its cell health.<jupyter_code>#import libraries
import sys
sys.path.append("../")
import pandas as pd 
from pathlib import Path
from glob import glob
from tqdm.notebook import tqdm
from src.utlis.visualize_scores import vis_score,color_code_MGS_image
#set paths
tumogenesis_score=pd.read_csv('/home/pathy_s/Documents/Mechanogenomic_Score_Breast_Cancer/MGS_data_and_models/MGS_for_plotting.csv')
grouped = tumogenesis_score.groupby(tumogenesis_score.Image)
path_to_output_segmented_nuclei="/home/pathy_s/Documents/Mechanogenomic_Score_Breast_Cancer/Segmented_labels/"
path_to_rawimages='/home/pathy_s/Documents/Mechanogenomic_Score_Breast_Cancer/Raw_Images/all_cores/'
path_to_output = "/home/pathy_s/Documents/Mechanogenomic_Score_Breast_Cancer/MGS_image/"
#Generate images
Path(path_to_output).mkdir(parents=True, exist_ok=True)
seg_image_dirs = sorted(glob(path_to_output_segmented_nuclei + "*.tif"))
for i in tqdm(range(len(seg_image_dirs))): 
    Image = seg_image_dirs[i].rsplit('/', 1)[-1][:-4]
    color_code_MGS_image(Image,grouped,seg_image_dirs[i],path_to_output)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09709480122324159, 'fraction_numerical': 0.0022935779816513763, 'mean_word_length': 8.35, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '181970', 'license': 'MIT', 'n_tokens_mistral': 494, 'n_tokens_neox': 461, 'n_words': 80, 'path': 'python_notebooks/visualise_scores.ipynb', 'repo_name': 'GVS-Lab/genomic-scoring-breast-cancer-progression', 'size': '1308'}