File size: 21,236 Bytes
7ae1978
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2a3a42a1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:44.692728Z",
     "iopub.status.busy": "2025-03-25T06:56:44.692321Z",
     "iopub.status.idle": "2025-03-25T06:56:44.858168Z",
     "shell.execute_reply": "2025-03-25T06:56:44.857826Z"
    }
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "import os\n",
    "sys.path.append(os.path.abspath(os.path.join(os.getcwd(), '../..')))\n",
    "\n",
    "# Path Configuration\n",
    "from tools.preprocess import *\n",
    "\n",
    "# Processing context\n",
    "trait = \"Bladder_Cancer\"\n",
    "cohort = \"GSE162253\"\n",
    "\n",
    "# Input paths\n",
    "in_trait_dir = \"../../input/GEO/Bladder_Cancer\"\n",
    "in_cohort_dir = \"../../input/GEO/Bladder_Cancer/GSE162253\"\n",
    "\n",
    "# Output paths\n",
    "out_data_file = \"../../output/preprocess/Bladder_Cancer/GSE162253.csv\"\n",
    "out_gene_data_file = \"../../output/preprocess/Bladder_Cancer/gene_data/GSE162253.csv\"\n",
    "out_clinical_data_file = \"../../output/preprocess/Bladder_Cancer/clinical_data/GSE162253.csv\"\n",
    "json_path = \"../../output/preprocess/Bladder_Cancer/cohort_info.json\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "26606425",
   "metadata": {},
   "source": [
    "### Step 1: Initial Data Loading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5bc0cbab",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:44.859577Z",
     "iopub.status.busy": "2025-03-25T06:56:44.859430Z",
     "iopub.status.idle": "2025-03-25T06:56:44.983926Z",
     "shell.execute_reply": "2025-03-25T06:56:44.983616Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Background Information:\n",
      "!Series_title\t\"Bacterial effect on gene expression\"\n",
      "!Series_summary\t\"This SuperSeries is composed of the SubSeries listed below.\"\n",
      "!Series_overall_design\t\"Refer to individual Series\"\n",
      "Sample Characteristics Dictionary:\n",
      "{0: ['gender: female', 'mouse strain: C57BL/6J-APCmin/J', 'mouse strain: C57BL/6J'], 1: ['strain: C57BL/6J', 'tissue: intestine'], 2: ['tissue: bladder', 'experiment: exp1', 'experiment: exp2', 'experiment: exp3'], 3: ['experiment: exp1', 'experiment: exp2', 'experiment: exp3', 'treatment: rLon', 'treatment: 536', 'treatment: N/A', 'treatment: PBS'], 4: ['treatment: PAI1', 'treatment: 536', 'treatment: N/A', 'treatment: PBS', 'treatment: rLon', nan]}\n"
     ]
    }
   ],
   "source": [
    "from tools.preprocess import *\n",
    "# 1. Identify the paths to the SOFT file and the matrix file\n",
    "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
    "\n",
    "# 2. Read the matrix file to obtain background information and sample characteristics data\n",
    "background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']\n",
    "clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']\n",
    "background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)\n",
    "\n",
    "# 3. Obtain the sample characteristics dictionary from the clinical dataframe\n",
    "sample_characteristics_dict = get_unique_values_by_row(clinical_data)\n",
    "\n",
    "# 4. Explicitly print out all the background information and the sample characteristics dictionary\n",
    "print(\"Background Information:\")\n",
    "print(background_info)\n",
    "print(\"Sample Characteristics Dictionary:\")\n",
    "print(sample_characteristics_dict)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4532357f",
   "metadata": {},
   "source": [
    "### Step 2: Dataset Analysis and Clinical Feature Extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d438750f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:44.985092Z",
     "iopub.status.busy": "2025-03-25T06:56:44.984978Z",
     "iopub.status.idle": "2025-03-25T06:56:44.989779Z",
     "shell.execute_reply": "2025-03-25T06:56:44.989516Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import os\n",
    "import json\n",
    "from typing import Callable, Optional, Dict, Any\n",
    "\n",
    "# Define variables for dataset assessment\n",
    "is_gene_available = True  # The dataset appears to be about gene expression based on the title\n",
    "\n",
    "# For trait data (bladder cancer vs. control)\n",
    "# Based on the sample characteristics, trait data is not explicitly available\n",
    "# The infection status in row 1 could be used as a trait, but it's not related to bladder cancer\n",
    "trait_row = None  # No direct bladder cancer data\n",
    "\n",
    "# For age and gender data\n",
    "age_row = None  # No age information available\n",
    "gender_row = None  # No gender information available\n",
    "\n",
    "# Define conversion functions (even though we won't use them in this case)\n",
    "def convert_trait(value_str):\n",
    "    # Not used as trait_row is None\n",
    "    return None\n",
    "\n",
    "def convert_age(value_str):\n",
    "    # Not used as age_row is None\n",
    "    return None\n",
    "\n",
    "def convert_gender(value_str):\n",
    "    # Not used as gender_row is None\n",
    "    return None\n",
    "\n",
    "# Save metadata\n",
    "is_trait_available = trait_row is not None\n",
    "validate_and_save_cohort_info(\n",
    "    is_final=False,\n",
    "    cohort=cohort,\n",
    "    info_path=json_path,\n",
    "    is_gene_available=is_gene_available,\n",
    "    is_trait_available=is_trait_available\n",
    ")\n",
    "\n",
    "# Since trait_row is None, we skip the clinical feature extraction step\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd61eb8d",
   "metadata": {},
   "source": [
    "### Step 3: Gene Data Extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fb69f511",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:44.990781Z",
     "iopub.status.busy": "2025-03-25T06:56:44.990678Z",
     "iopub.status.idle": "2025-03-25T06:56:45.163470Z",
     "shell.execute_reply": "2025-03-25T06:56:45.163077Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['1415670_PM_at', '1415671_PM_at', '1415672_PM_at', '1415673_PM_at',\n",
      "       '1415674_PM_a_at', '1415675_PM_at', '1415676_PM_a_at', '1415677_PM_at',\n",
      "       '1415678_PM_at', '1415679_PM_at', '1415680_PM_at', '1415681_PM_at',\n",
      "       '1415682_PM_at', '1415683_PM_at', '1415684_PM_at', '1415685_PM_at',\n",
      "       '1415686_PM_at', '1415687_PM_a_at', '1415688_PM_at', '1415689_PM_s_at'],\n",
      "      dtype='object', name='ID')\n"
     ]
    }
   ],
   "source": [
    "# 1. Use the get_genetic_data function from the library to get the gene_data from the matrix_file previously defined.\n",
    "gene_data = get_genetic_data(matrix_file)\n",
    "\n",
    "# 2. Print the first 20 row IDs (gene or probe identifiers) for future observation.\n",
    "print(gene_data.index[:20])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "40f35ac3",
   "metadata": {},
   "source": [
    "### Step 4: Gene Identifier Review"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c56fe9ac",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:45.165004Z",
     "iopub.status.busy": "2025-03-25T06:56:45.164887Z",
     "iopub.status.idle": "2025-03-25T06:56:45.166706Z",
     "shell.execute_reply": "2025-03-25T06:56:45.166425Z"
    }
   },
   "outputs": [],
   "source": [
    "# These identifiers appear to be Affymetrix probe IDs (format: 11715100_at) rather than standard human gene symbols\n",
    "# These probe IDs typically need to be mapped to human gene symbols for biological interpretation\n",
    "# Standard human gene symbols would look like BRCA1, TP53, etc.\n",
    "\n",
    "requires_gene_mapping = True\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "41770fea",
   "metadata": {},
   "source": [
    "### Step 5: Gene Annotation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "83b517c8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:45.167860Z",
     "iopub.status.busy": "2025-03-25T06:56:45.167758Z",
     "iopub.status.idle": "2025-03-25T06:56:49.629684Z",
     "shell.execute_reply": "2025-03-25T06:56:49.629314Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Gene annotation preview:\n",
      "{'ID': ['1415670_PM_at', '1415671_PM_at', '1415672_PM_at', '1415673_PM_at', '1415674_PM_a_at'], 'GB_ACC': ['BC024686', 'NM_013477', 'NM_020585', 'NM_133900', 'NM_021789'], 'SPOT_ID': [nan, nan, nan, nan, nan], 'Species Scientific Name': ['Mus musculus', 'Mus musculus', 'Mus musculus', 'Mus musculus', 'Mus musculus'], 'Annotation Date': ['Aug 10, 2010', 'Aug 10, 2010', 'Aug 10, 2010', 'Aug 10, 2010', 'Aug 10, 2010'], 'Sequence Type': ['Consensus sequence', 'Consensus sequence', 'Consensus sequence', 'Consensus sequence', 'Consensus sequence'], 'Sequence Source': ['GenBank', 'GenBank', 'GenBank', 'GenBank', 'GenBank'], 'Target Description': ['gb:BC024686.1 /DB_XREF=gi:19354080 /FEA=FLmRNA /CNT=416 /TID=Mm.26422.1 /TIER=FL+Stack /STK=110 /UG=Mm.26422 /LL=54161 /UG_GENE=Copg1 /DEF=Mus musculus, coatomer protein complex, subunit gamma 1, clone MGC:30335 IMAGE:3992144, mRNA, complete cds. /PROD=coatomer protein complex, subunit gamma 1 /FL=gb:AF187079.1 gb:BC024686.1 gb:NM_017477.1 gb:BC024896.1', 'gb:NM_013477.1 /DB_XREF=gi:7304908 /GEN=Atp6v0d1 /FEA=FLmRNA /CNT=197 /TID=Mm.1081.1 /TIER=FL+Stack /STK=114 /UG=Mm.1081 /LL=11972 /DEF=Mus musculus ATPase, H+ transporting, lysosomal 38kDa, V0 subunit D isoform 1 (Atp6v0d1), mRNA. /PROD=ATPase, H+ transporting, lysosomal 38kDa, V0subunit D isoform 1 /FL=gb:U21549.1 gb:U13840.1 gb:BC011075.1 gb:NM_013477.1', 'gb:NM_020585.1 /DB_XREF=gi:10181207 /GEN=AB041568 /FEA=FLmRNA /CNT=213 /TID=Mm.17035.1 /TIER=FL+Stack /STK=102 /UG=Mm.17035 /LL=57437 /DEF=Mus musculus hypothetical protein, MNCb-1213 (AB041568), mRNA. /PROD=hypothetical protein, MNCb-1213 /FL=gb:BC016894.1 gb:NM_020585.1', 'gb:NM_133900.1 /DB_XREF=gi:19527115 /GEN=AI480570 /FEA=FLmRNA /CNT=139 /TID=Mm.10623.1 /TIER=FL+Stack /STK=96 /UG=Mm.10623 /LL=100678 /DEF=Mus musculus expressed sequence AI480570 (AI480570), mRNA. /PROD=expressed sequence AI480570 /FL=gb:BC002251.1 gb:NM_133900.1', 'gb:NM_021789.1 /DB_XREF=gi:11140824 /GEN=Sbdn /FEA=FLmRNA /CNT=163 /TID=Mm.29814.1 /TIER=FL+Stack /STK=95 /UG=Mm.29814 /LL=60409 /DEF=Mus musculus synbindin (Sbdn), mRNA. /PROD=synbindin /FL=gb:NM_021789.1 gb:AF233340.1'], 'Representative Public ID': ['BC024686', 'NM_013477', 'NM_020585', 'NM_133900', 'NM_021789'], 'Gene Title': ['coatomer protein complex, subunit gamma', 'ATPase, H+ transporting, lysosomal V0 subunit D1', 'golgi autoantigen, golgin subfamily a, 7', 'phosphoserine phosphatase', 'trafficking protein particle complex 4'], 'Gene Symbol': ['Copg', 'Atp6v0d1', 'Golga7', 'Psph', 'Trappc4'], 'Entrez Gene': ['54161', '11972', '57437', '100678', '60409'], 'RefSeq Transcript ID': ['NM_017477 /// NM_201244', 'NM_013477', 'NM_001042484 /// NM_020585', 'NM_133900', 'NM_021789'], 'Gene Ontology Biological Process': ['0006810 // transport // inferred from electronic annotation /// 0006886 // intracellular protein transport // inferred from electronic annotation /// 0015031 // protein transport // inferred from electronic annotation /// 0016192 // vesicle-mediated transport // inferred from electronic annotation', '0006810 // transport // inferred from electronic annotation /// 0006811 // ion transport // inferred from electronic annotation /// 0007420 // brain development // inferred from electronic annotation /// 0015986 // ATP synthesis coupled proton transport // inferred from electronic annotation /// 0015992 // proton transport // inferred from electronic annotation', '0006893 // Golgi to plasma membrane transport // not recorded', '0006564 // L-serine biosynthetic process // inferred from electronic annotation /// 0008152 // metabolic process // inferred from electronic annotation /// 0008652 // cellular amino acid biosynthetic process // inferred from electronic annotation /// 0009612 // response to mechanical stimulus // inferred from electronic annotation /// 0031667 // response to nutrient levels // inferred from electronic annotation /// 0033574 // response to testosterone stimulus // inferred from electronic annotation', '0006810 // transport // inferred from electronic annotation /// 0006888 // ER to Golgi vesicle-mediated transport // inferred from electronic annotation /// 0016192 // vesicle-mediated transport // traceable author statement /// 0016192 // vesicle-mediated transport // inferred from electronic annotation /// 0016358 // dendrite development // inferred from direct assay /// 0045212 // neurotransmitter receptor biosynthetic process // traceable author statement'], 'Gene Ontology Cellular Component': ['0000139 // Golgi membrane // inferred from electronic annotation /// 0005737 // cytoplasm // inferred from electronic annotation /// 0005794 // Golgi apparatus // inferred from electronic annotation /// 0005798 // Golgi-associated vesicle // inferred from electronic annotation /// 0016020 // membrane // inferred from electronic annotation /// 0030117 // membrane coat // inferred from electronic annotation /// 0030126 // COPI vesicle coat // inferred from electronic annotation /// 0030663 // COPI coated vesicle membrane // inferred from electronic annotation /// 0031410 // cytoplasmic vesicle // inferred from electronic annotation', '0005769 // early endosome // inferred from direct assay /// 0008021 // synaptic vesicle // not recorded /// 0008021 // synaptic vesicle // inferred from electronic annotation /// 0016020 // membrane // inferred from electronic annotation /// 0016324 // apical plasma membrane // not recorded /// 0016324 // apical plasma membrane // inferred from electronic annotation /// 0019717 // synaptosome // not recorded /// 0019717 // synaptosome // inferred from electronic annotation /// 0033177 // proton-transporting two-sector ATPase complex, proton-transporting domain // inferred from electronic annotation /// 0033179 // proton-transporting V-type ATPase, V0 domain // inferred from electronic annotation /// 0043234 // protein complex // not recorded /// 0043679 // axon terminus // not recorded /// 0043679 // axon terminus // inferred from electronic annotation', '0000139 // Golgi membrane // not recorded /// 0000139 // Golgi membrane // inferred from electronic annotation /// 0005794 // Golgi apparatus // inferred from electronic annotation /// 0016020 // membrane // inferred from electronic annotation', '0019717 // synaptosome // not recorded /// 0019717 // synaptosome // inferred from electronic annotation', '0005783 // endoplasmic reticulum // inferred from electronic annotation /// 0005794 // Golgi apparatus // inferred from electronic annotation /// 0005795 // Golgi stack // inferred from direct assay /// 0005801 // cis-Golgi network // inferred from electronic annotation /// 0005886 // plasma membrane // inferred from electronic annotation /// 0008021 // synaptic vesicle // inferred from direct assay /// 0016020 // membrane // inferred from electronic annotation /// 0030008 // TRAPP complex // inferred from direct assay /// 0030054 // cell junction // inferred from electronic annotation /// 0030425 // dendrite // inferred from direct assay /// 0045202 // synapse // inferred from direct assay /// 0045202 // synapse // inferred from electronic annotation /// 0045211 // postsynaptic membrane // inferred from electronic annotation'], 'Gene Ontology Molecular Function': ['0005198 // structural molecule activity // inferred from electronic annotation /// 0005488 // binding // inferred from electronic annotation /// 0005515 // protein binding // inferred from electronic annotation', '0008553 // hydrogen-exporting ATPase activity, phosphorylative mechanism // inferred from direct assay /// 0015078 // hydrogen ion transmembrane transporter activity // inferred from electronic annotation /// 0032403 // protein complex binding // not recorded /// 0032403 // protein complex binding // inferred from electronic annotation', nan, '0003824 // catalytic activity // inferred from electronic annotation /// 0004647 // phosphoserine phosphatase activity // inferred from electronic annotation /// 0005515 // protein binding // inferred from electronic annotation /// 0016787 // hydrolase activity // inferred from electronic annotation /// 0016791 // phosphatase activity // inferred from electronic annotation', '0005515 // protein binding // inferred from physical interaction /// 0005515 // protein binding // inferred from electronic annotation']}\n"
     ]
    }
   ],
   "source": [
    "# 1. Use the 'get_gene_annotation' function from the library to get gene annotation data from the SOFT file.\n",
    "gene_annotation = get_gene_annotation(soft_file)\n",
    "\n",
    "# 2. Use the 'preview_df' function from the library to preview the data and print out the results.\n",
    "print(\"Gene annotation preview:\")\n",
    "print(preview_df(gene_annotation))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f16e961",
   "metadata": {},
   "source": [
    "### Step 6: Gene Identifier Mapping"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "acfef329",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T06:56:49.630989Z",
     "iopub.status.busy": "2025-03-25T06:56:49.630878Z",
     "iopub.status.idle": "2025-03-25T06:56:49.746373Z",
     "shell.execute_reply": "2025-03-25T06:56:49.746016Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking at the gene annotation and expression data ID formats:\n",
      "Gene annotation ID example: 1415670_PM_at\n",
      "Gene expression ID example: 1415670_PM_at\n",
      "Species in annotation: Mus musculus\n",
      "Number of common IDs between annotation and expression data: 45077\n",
      "Original gene expression data shape: (45077, 45)\n",
      "Dataset contains mouse gene data, not suitable for human bladder cancer study\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1. Identify the relevant columns in the gene annotation DataFrame\n",
    "print(\"Looking at the gene annotation and expression data ID formats:\")\n",
    "print(f\"Gene annotation ID example: {gene_annotation['ID'].iloc[0]}\")\n",
    "print(f\"Gene expression ID example: {gene_data.index[0]}\")\n",
    "\n",
    "# Check species information\n",
    "print(f\"Species in annotation: {gene_annotation['Species Scientific Name'].iloc[0]}\")\n",
    "\n",
    "# Given this is mouse data and not human data, and we're studying human bladder cancer,\n",
    "# this dataset is not appropriate. We should set is_gene_available to False.\n",
    "is_gene_available = False\n",
    "\n",
    "# Check for matching IDs just to confirm our suspicion\n",
    "common_ids = set(gene_annotation['ID'].astype(str)) & set(gene_data.index)\n",
    "print(f\"Number of common IDs between annotation and expression data: {len(common_ids)}\")\n",
    "\n",
    "# Since this is mouse data and not suitable for human bladder cancer study,\n",
    "# we'll create an empty gene_data_mapped DataFrame to indicate no valid mapping\n",
    "gene_data_mapped = pd.DataFrame()\n",
    "\n",
    "# Print information about the result\n",
    "print(f\"Original gene expression data shape: {gene_data.shape}\")\n",
    "print(f\"Dataset contains mouse gene data, not suitable for human bladder cancer study\")\n",
    "\n",
    "# Update gene_data to reflect this issue\n",
    "gene_data = gene_data_mapped\n",
    "\n",
    "# Update metadata to reflect that gene data is not available\n",
    "is_trait_available = trait_row is not None\n",
    "validate_and_save_cohort_info(\n",
    "    is_final=False,\n",
    "    cohort=cohort,\n",
    "    info_path=json_path,\n",
    "    is_gene_available=is_gene_available,\n",
    "    is_trait_available=is_trait_available\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}