File size: 89,294 Bytes
9fe78b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "50be79f8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:33.501453Z",
     "iopub.status.busy": "2025-03-25T03:41:33.501339Z",
     "iopub.status.idle": "2025-03-25T03:41:33.670483Z",
     "shell.execute_reply": "2025-03-25T03:41:33.670124Z"
    }
   },
   "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 = \"Psoriasis\"\n",
    "cohort = \"GSE158448\"\n",
    "\n",
    "# Input paths\n",
    "in_trait_dir = \"../../input/GEO/Psoriasis\"\n",
    "in_cohort_dir = \"../../input/GEO/Psoriasis/GSE158448\"\n",
    "\n",
    "# Output paths\n",
    "out_data_file = \"../../output/preprocess/Psoriasis/GSE158448.csv\"\n",
    "out_gene_data_file = \"../../output/preprocess/Psoriasis/gene_data/GSE158448.csv\"\n",
    "out_clinical_data_file = \"../../output/preprocess/Psoriasis/clinical_data/GSE158448.csv\"\n",
    "json_path = \"../../output/preprocess/Psoriasis/cohort_info.json\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5efeb8c2",
   "metadata": {},
   "source": [
    "### Step 1: Initial Data Loading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "090c1717",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:33.672444Z",
     "iopub.status.busy": "2025-03-25T03:41:33.672274Z",
     "iopub.status.idle": "2025-03-25T03:41:33.904424Z",
     "shell.execute_reply": "2025-03-25T03:41:33.904015Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Background Information:\n",
      "!Series_title\t\"Multiple IL-17 family cytokines signaling through IL-17RA drive inflammatory pathways in psoriasis\"\n",
      "!Series_summary\t\"The IL-23/IL-17 immune axis is of central importance in psoriasis. However, the contribution of IL-17 family cytokines other than IL-17A to drive skin inflammation in psoriasis has not been fully established. To further elucidate the role of individual IL-17 family cytokines in psoriasis, we investigated their expression and localization in psoriasis skin at the mRNA and protein level. Moreover, we investigated the gene expression signatures induced by individual IL-17 family cytokines in human skin ex vivo as well as modulation of responses induced by the combination of IL-17 family cytokines in human keratinocytes by brodalumab, a human monoclonal antibody targeting the IL-17RA, versus the IL-17A blocking antibody ixekizumab.     We demonstrate that IL-17A, IL-17AF, IL-17F and IL-17C are expressed at increased levels in psoriasis lesional skin and induce inflammatory gene expression signatures in human skin ex vivo that correlate with those observed in psoriasis. Furthermore, we show that brodalumab, in contrast to ixekizumab, fully blocks gene expression responses induced by the combination of IL-17A, IL-17AF, IL-17F and IL-17C in human keratinocytes.     These findings suggest that inhibition of several IL-17 family cytokines, e.g. by targeting of the IL-17RA receptor, could be a favored mechanism to obtain a profound suppression of the inflammatory processes in psoriasis and thereby achieve high levels of skin clearance and sustained efficacy in patients with psoriasis.\"\n",
      "!Series_overall_design\t\"60 human skin samples separated into 11 groups treated with Il17 variants and 1 untreated control group\"\n",
      "Sample Characteristics Dictionary:\n",
      "{0: ['sample_id: 01', 'sample_id: 02', 'sample_id: 03', 'sample_id: 04', 'sample_id: 05', 'sample_id: 06', 'sample_id: 07', 'sample_id: 08', 'sample_id: 09', 'sample_id: 10', 'sample_id: 11', 'sample_id: 12', 'sample_id: 13', 'sample_id: 14', 'sample_id: 15', 'sample_id: 16', 'sample_id: 17', 'sample_id: 18', 'sample_id: 19', 'sample_id: 20', 'sample_id: 21', 'sample_id: 22', 'sample_id: 23', 'sample_id: 24', 'sample_id: 25', 'sample_id: 26', 'sample_id: 27', 'sample_id: 28', 'sample_id: 29', 'sample_id: 30'], 1: ['donor_id: 2', 'donor_id: 3', 'donor_id: 4', 'donor_id: 6', 'donor_id: 7', 'donor_id: 8', 'donor_id: 9', 'donor_id: 11', 'donor_id: 12', 'donor_id: 14', 'donor_id: 16', 'donor_id: 17', 'donor_id: 19', 'donor_id: 20', 'donor_id: 21', 'donor_id: 22', 'donor_id: 23', 'donor_id: 24', 'donor_id: 25', 'donor_id: 28', 'donor_id: 30', 'donor_id: 31', 'donor_id: 32', 'donor_id: 33', 'donor_id: 35', 'donor_id: 37', 'donor_id: 38', 'donor_id: 39', 'donor_id: 41', 'donor_id: 42'], 2: ['rna_integrity: 9.1', 'rna_integrity: 9.4', 'rna_integrity: 9', 'rna_integrity: 9.2', 'rna_integrity: 8.4', 'rna_integrity: 8.9', 'rna_integrity: 9.3', 'rna_integrity: 8.6', 'rna_integrity: 8.8', 'rna_integrity: 9.5', 'rna_integrity: 8', 'rna_integrity: 8.7', 'rna_integrity: 9.6', 'rna_integrity: 9.7', 'rna_integrity: 9.8', 'rna_integrity: 8.3', 'rna_integrity: 7.3'], 3: ['batch: batch_1', 'batch: batch_2', 'batch: batch_3', 'batch: batch_4'], 4: ['treatment: untreated', 'treatment: IL17A_1_ng_ml', 'treatment: IL17A_10_ng_ml', 'treatment: IL17A_100_ng_ml', 'treatment: IL17AF_10_ng_ml', 'treatment: IL17AF_100_ng_ml', 'treatment: IL17F_10_ng_ml', 'treatment: IL17F_100_ng_ml', 'treatment: IL17C_10_ng_ml', 'treatment: IL17C_100_ng_ml', 'treatment: IL17E_10_ng_ml', 'treatment: IL17E_100_ng_ml']}\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": "e62b5d83",
   "metadata": {},
   "source": [
    "### Step 2: Dataset Analysis and Clinical Feature Extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4d4efd30",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:33.906257Z",
     "iopub.status.busy": "2025-03-25T03:41:33.906107Z",
     "iopub.status.idle": "2025-03-25T03:41:33.916240Z",
     "shell.execute_reply": "2025-03-25T03:41:33.915918Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preview of the selected clinical features:\n",
      "{0: [0.0], 1: [1.0], 2: [1.0], 3: [1.0], 4: [1.0], 5: [1.0], 6: [1.0], 7: [1.0], 8: [1.0], 9: [1.0], 10: [1.0], 11: [1.0], 12: [nan], 13: [nan], 14: [nan], 15: [nan], 16: [nan], 17: [nan], 18: [nan], 19: [nan], 20: [nan], 21: [nan], 22: [nan], 23: [nan], 24: [nan], 25: [nan], 26: [nan], 27: [nan], 28: [nan], 29: [nan]}\n",
      "Clinical data saved to ../../output/preprocess/Psoriasis/clinical_data/GSE158448.csv\n"
     ]
    }
   ],
   "source": [
    "# Analyze the data availability and define conversion functions\n",
    "\n",
    "# 1. Gene Expression Data Availability\n",
    "# From the background information, this appears to be a gene expression study related to IL-17 cytokines in psoriasis\n",
    "# The study design mentions \"60 human skin samples\" which likely contains gene expression data\n",
    "is_gene_available = True\n",
    "\n",
    "# 2. Variable Availability and Data Type Conversion\n",
    "\n",
    "# 2.1 Data Availability for trait, age, and gender\n",
    "# Trait data: We can infer this from the 'treatment' field (row 4)\n",
    "trait_row = 4  # The treatment field indicates whether samples are from patients with specific treatments\n",
    "\n",
    "# Age data: Not available in the sample characteristics\n",
    "age_row = None\n",
    "\n",
    "# Gender data: Not available in the sample characteristics \n",
    "gender_row = None\n",
    "\n",
    "# 2.2 Data Type Conversion Functions\n",
    "\n",
    "def convert_trait(value):\n",
    "    \"\"\"\n",
    "    Convert treatment values to binary indicating whether it's untreated (0) or treated (1)\n",
    "    \"\"\"\n",
    "    if not isinstance(value, str):\n",
    "        return None\n",
    "    \n",
    "    # Extract the value after the colon\n",
    "    if ':' in value:\n",
    "        value = value.split(':', 1)[1].strip()\n",
    "    \n",
    "    if 'untreated' in value.lower():\n",
    "        return 0  # Untreated sample\n",
    "    elif 'IL17' in value:\n",
    "        return 1  # Treated with some form of IL17\n",
    "    else:\n",
    "        return None  # Unknown\n",
    "\n",
    "# Since age and gender data are not available, we don't need conversion functions for them\n",
    "convert_age = None\n",
    "convert_gender = None\n",
    "\n",
    "# 3. Save Metadata - Initial Filtering\n",
    "# Check if both gene and trait data are 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",
    ")\n",
    "\n",
    "# 4. Clinical Feature Extraction\n",
    "if trait_row is not None:\n",
    "    # Create a DataFrame from the sample characteristics dictionary provided in the task\n",
    "    # The sample characteristics dictionary was already provided in the task output\n",
    "    sample_characteristics = {\n",
    "        0: ['sample_id: 01', 'sample_id: 02', 'sample_id: 03', 'sample_id: 04', 'sample_id: 05', 'sample_id: 06', 'sample_id: 07', 'sample_id: 08', 'sample_id: 09', 'sample_id: 10', 'sample_id: 11', 'sample_id: 12', 'sample_id: 13', 'sample_id: 14', 'sample_id: 15', 'sample_id: 16', 'sample_id: 17', 'sample_id: 18', 'sample_id: 19', 'sample_id: 20', 'sample_id: 21', 'sample_id: 22', 'sample_id: 23', 'sample_id: 24', 'sample_id: 25', 'sample_id: 26', 'sample_id: 27', 'sample_id: 28', 'sample_id: 29', 'sample_id: 30'], \n",
    "        1: ['donor_id: 2', 'donor_id: 3', 'donor_id: 4', 'donor_id: 6', 'donor_id: 7', 'donor_id: 8', 'donor_id: 9', 'donor_id: 11', 'donor_id: 12', 'donor_id: 14', 'donor_id: 16', 'donor_id: 17', 'donor_id: 19', 'donor_id: 20', 'donor_id: 21', 'donor_id: 22', 'donor_id: 23', 'donor_id: 24', 'donor_id: 25', 'donor_id: 28', 'donor_id: 30', 'donor_id: 31', 'donor_id: 32', 'donor_id: 33', 'donor_id: 35', 'donor_id: 37', 'donor_id: 38', 'donor_id: 39', 'donor_id: 41', 'donor_id: 42'], \n",
    "        2: ['rna_integrity: 9.1', 'rna_integrity: 9.4', 'rna_integrity: 9', 'rna_integrity: 9.2', 'rna_integrity: 8.4', 'rna_integrity: 8.9', 'rna_integrity: 9.3', 'rna_integrity: 8.6', 'rna_integrity: 8.8', 'rna_integrity: 9.5', 'rna_integrity: 8', 'rna_integrity: 8.7', 'rna_integrity: 9.6', 'rna_integrity: 9.7', 'rna_integrity: 9.8', 'rna_integrity: 8.3', 'rna_integrity: 7.3'], \n",
    "        3: ['batch: batch_1', 'batch: batch_2', 'batch: batch_3', 'batch: batch_4'], \n",
    "        4: ['treatment: untreated', 'treatment: IL17A_1_ng_ml', 'treatment: IL17A_10_ng_ml', 'treatment: IL17A_100_ng_ml', 'treatment: IL17AF_10_ng_ml', 'treatment: IL17AF_100_ng_ml', 'treatment: IL17F_10_ng_ml', 'treatment: IL17F_100_ng_ml', 'treatment: IL17C_10_ng_ml', 'treatment: IL17C_100_ng_ml', 'treatment: IL17E_10_ng_ml', 'treatment: IL17E_100_ng_ml']\n",
    "    }\n",
    "    \n",
    "    # Convert to DataFrame\n",
    "    clinical_data = pd.DataFrame.from_dict(sample_characteristics, orient='index')\n",
    "    \n",
    "    # Extract clinical features\n",
    "    selected_clinical_df = geo_select_clinical_features(\n",
    "        clinical_df=clinical_data,\n",
    "        trait=trait,\n",
    "        trait_row=trait_row,\n",
    "        convert_trait=convert_trait,\n",
    "        age_row=age_row,\n",
    "        convert_age=convert_age,\n",
    "        gender_row=gender_row,\n",
    "        convert_gender=convert_gender\n",
    "    )\n",
    "    \n",
    "    # Preview the data\n",
    "    print(\"Preview of the selected clinical features:\")\n",
    "    print(preview_df(selected_clinical_df))\n",
    "    \n",
    "    # Save clinical data\n",
    "    os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n",
    "    selected_clinical_df.to_csv(out_clinical_data_file, index=False)\n",
    "    print(f\"Clinical data saved to {out_clinical_data_file}\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5effcc84",
   "metadata": {},
   "source": [
    "### Step 3: Gene Data Extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b4b255d4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:33.917736Z",
     "iopub.status.busy": "2025-03-25T03:41:33.917628Z",
     "iopub.status.idle": "2025-03-25T03:41:34.298211Z",
     "shell.execute_reply": "2025-03-25T03:41:34.297822Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "First 20 gene/probe identifiers:\n",
      "Index(['16650001', '16650003', '16650005', '16650007', '16650009', '16650011',\n",
      "       '16650013', '16650015', '16650017', '16650019', '16650021', '16650023',\n",
      "       '16650025', '16650027', '16650029', '16650031', '16650033', '16650035',\n",
      "       '16650037', '16650041'],\n",
      "      dtype='object', name='ID')\n",
      "\n",
      "Gene data dimensions: 53617 genes × 60 samples\n"
     ]
    }
   ],
   "source": [
    "# 1. Re-identify the SOFT and matrix files to ensure we have the correct paths\n",
    "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
    "\n",
    "# 2. Extract the gene expression data from the matrix file\n",
    "gene_data = get_genetic_data(matrix_file)\n",
    "\n",
    "# 3. Print the first 20 row IDs (gene or probe identifiers)\n",
    "print(\"\\nFirst 20 gene/probe identifiers:\")\n",
    "print(gene_data.index[:20])\n",
    "\n",
    "# 4. Print the dimensions of the gene expression data\n",
    "print(f\"\\nGene data dimensions: {gene_data.shape[0]} genes × {gene_data.shape[1]} samples\")\n",
    "\n",
    "# Note: we keep is_gene_available as True since we successfully extracted gene expression data\n",
    "is_gene_available = True\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "882cc686",
   "metadata": {},
   "source": [
    "### Step 4: Gene Identifier Review"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2bda3662",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:34.299847Z",
     "iopub.status.busy": "2025-03-25T03:41:34.299725Z",
     "iopub.status.idle": "2025-03-25T03:41:34.302019Z",
     "shell.execute_reply": "2025-03-25T03:41:34.301660Z"
    }
   },
   "outputs": [],
   "source": [
    "# These identifiers appear to be numeric probe IDs, not human gene symbols\n",
    "# They are likely platform-specific identifiers that need to be mapped to gene symbols\n",
    "\n",
    "# Looking at the format (purely numeric IDs starting with \"1665\"), these are \n",
    "# not standard human gene symbols which typically have alphabetic characters\n",
    "\n",
    "# They are most likely probe IDs from a microarray platform that need to be \n",
    "# converted to standard gene symbols\n",
    "\n",
    "requires_gene_mapping = True\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7460c7d5",
   "metadata": {},
   "source": [
    "### Step 5: Gene Annotation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0ba4215b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:34.303531Z",
     "iopub.status.busy": "2025-03-25T03:41:34.303428Z",
     "iopub.status.idle": "2025-03-25T03:41:44.465339Z",
     "shell.execute_reply": "2025-03-25T03:41:44.464896Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preview of SOFT file content:\n",
      "^DATABASE = GeoMiame\n",
      "!Database_name = Gene Expression Omnibus (GEO)\n",
      "!Database_institute = NCBI NLM NIH\n",
      "!Database_web_link = http://www.ncbi.nlm.nih.gov/geo\n",
      "!Database_email = [email protected]\n",
      "^SERIES = GSE158448\n",
      "!Series_title = Multiple IL-17 family cytokines signaling through IL-17RA drive inflammatory pathways in psoriasis\n",
      "!Series_geo_accession = GSE158448\n",
      "!Series_status = Public on Apr 07 2021\n",
      "!Series_submission_date = Sep 23 2020\n",
      "!Series_last_update_date = Apr 10 2021\n",
      "!Series_pubmed_id = 33792895\n",
      "!Series_summary = The IL-23/IL-17 immune axis is of central importance in psoriasis. However, the contribution of IL-17 family cytokines other than IL-17A to drive skin inflammation in psoriasis has not been fully established. To further elucidate the role of individual IL-17 family cytokines in psoriasis, we investigated their expression and localization in psoriasis skin at the mRNA and protein level. Moreover, we investigated the gene expression signatures induced by individual IL-17 family cytokines in human skin ex vivo as well as modulation of responses induced by the combination of IL-17 family cytokines in human keratinocytes by brodalumab, a human monoclonal antibody targeting the IL-17RA, versus the IL-17A blocking antibody ixekizumab.     We demonstrate that IL-17A, IL-17AF, IL-17F and IL-17C are expressed at increased levels in psoriasis lesional skin and induce inflammatory gene expression signatures in human skin ex vivo that correlate with those observed in psoriasis. Furthermore, we show that brodalumab, in contrast to ixekizumab, fully blocks gene expression responses induced by the combination of IL-17A, IL-17AF, IL-17F and IL-17C in human keratinocytes.     These findings suggest that inhibition of several IL-17 family cytokines, e.g. by targeting of the IL-17RA receptor, could be a favored mechanism to obtain a profound suppression of the inflammatory processes in psoriasis and thereby achieve high levels of skin clearance and sustained efficacy in patients with psoriasis.\n",
      "!Series_overall_design = 60 human skin samples separated into 11 groups treated with Il17 variants and 1 untreated control group\n",
      "!Series_type = Expression profiling by array\n",
      "!Series_contributor = Maxim,A,Tollenaere\n",
      "!Series_contributor = Josephine,,Hebsgaard\n",
      "!Series_contributor = David,A,Ewald\n",
      "!Series_contributor = Paola,,Lovato\n",
      "!Series_contributor = Sandra,,Garcet\n",
      "!Series_contributor = Xuan,,Li\n",
      "...\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Gene annotation dataframe using default method:\n",
      "Shape: (3270697, 20)\n",
      "Columns: ['ID', 'probeset_id', 'seqname', 'strand', 'start', 'stop', 'total_probes', 'gene_assignment', 'mrna_assignment', 'swissprot', 'unigene', 'GO_biological_process', 'GO_cellular_component', 'GO_molecular_function', 'pathway', 'protein_domains', 'crosshyb_type', 'category', 'GB_ACC', 'SPOT_ID']\n",
      "         ID probeset_id seqname strand  start   stop  total_probes  \\\n",
      "0  16657436    16657436    chr1      +  12190  13639          25.0   \n",
      "1  16657440    16657440    chr1      +  29554  31109          28.0   \n",
      "2  16657445    16657445    chr1      +  69091  70008           8.0   \n",
      "\n",
      "                                     gene_assignment  \\\n",
      "0  NR_046018 // DDX11L1 // DEAD/H (Asp-Glu-Ala-As...   \n",
      "1  ENST00000473358 // MIR1302-11 // microRNA 1302...   \n",
      "2  NM_001005484 // OR4F5 // olfactory receptor, f...   \n",
      "\n",
      "                                     mrna_assignment  \\\n",
      "0  NR_046018 // RefSeq // Homo sapiens DEAD/H (As...   \n",
      "1  ENST00000473358 // ENSEMBL // cdna:known chrom...   \n",
      "2  NM_001005484 // RefSeq // Homo sapiens olfacto...   \n",
      "\n",
      "                                           swissprot  \\\n",
      "0  NR_046018 // B7ZGW9 /// NR_046018 // B7ZGX0 //...   \n",
      "1                                                ---   \n",
      "2                                                ---   \n",
      "\n",
      "                                             unigene GO_biological_process  \\\n",
      "0  NR_046018 // Hs.714157 // testis| normal| adul...                   ---   \n",
      "1                                                ---                   ---   \n",
      "2  NM_001005484 // Hs.554500 // --- /// ENST00000...                   ---   \n",
      "\n",
      "                               GO_cellular_component  \\\n",
      "0                                                ---   \n",
      "1                                                ---   \n",
      "2  NM_001005484 // GO:0005886 // plasma membrane ...   \n",
      "\n",
      "                               GO_molecular_function pathway  \\\n",
      "0                                                ---     ---   \n",
      "1                                                ---     ---   \n",
      "2  NM_001005484 // GO:0004930 // G-protein couple...     ---   \n",
      "\n",
      "                                     protein_domains crosshyb_type category  \\\n",
      "0                                                ---             3     main   \n",
      "1                                                ---             3     main   \n",
      "2  ENST00000335137 // Pfam // IPR000276 // GPCR, ...             3     main   \n",
      "\n",
      "         GB_ACC          SPOT_ID  \n",
      "0     NR_046018              NaN  \n",
      "1           NaN  ENST00000473358  \n",
      "2  NM_001005484              NaN  \n",
      "\n",
      "Searching for platform annotation section in SOFT file...\n",
      "^PLATFORM = GPL17692\n",
      "!platform_table_begin\n",
      "ID\tprobeset_id\tseqname\tstrand\tstart\tstop\ttotal_probes\tgene_assignment\tmrna_assignment\tswissprot\tunigene\tGO_biological_process\tGO_cellular_component\tGO_molecular_function\tpathway\tprotein_domains\tcrosshyb_type\tcategory\tGB_ACC\tSPOT_ID\n",
      "16657436\t16657436\tchr1\t+\t12190\t13639\t25\tNR_046018 // DDX11L1 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 // 1p36.33 // 100287102 /// NR_034090 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// NR_051985 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// NR_045117 // DDX11L10 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 10 // 16p13.3 // 100287029 /// NR_024004 // DDX11L2 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 // 2q13 // 84771 /// NR_024005 // DDX11L2 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 // 2q13 // 84771 /// NR_051986 // DDX11L5 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 5 // 9p24.3 // 100287596 /// ENST00000456328 // DDX11L1 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 // 1p36.33 // 100287102 /// ENST00000559159 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// ENST00000562189 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// ENST00000513886 // DDX11L10 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 10 // 16p13.3 // 100287029 /// ENST00000515242 // DDX11L1 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 // 1p36.33 // 100287102 /// ENST00000518655 // DDX11L1 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 // 1p36.33 // 100287102 /// ENST00000515173 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// ENST00000545636 // DDX11L10 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 10 // 16p13.3 // 100287029 /// ENST00000450305 // DDX11L1 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 // 1p36.33 // 100287102 /// ENST00000560040 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// ENST00000430178 // DDX11L10 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 10 // 16p13.3 // 100287029 /// ENST00000538648 // DDX11L9 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 // 15q26.3 // 100288486 /// ENST00000535848 // DDX11L2 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 // --- // --- /// ENST00000457993 // DDX11L2 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 // --- // --- /// ENST00000437401 // DDX11L2 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 // --- // --- /// ENST00000426146 // DDX11L5 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 5 // --- // --- /// ENST00000445777 // DDX11L16 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 16 // --- // --- /// ENST00000507418 // DDX11L16 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 16 // --- // --- /// ENST00000507418 // DDX11L16 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 16 // --- // --- /// ENST00000507418 // DDX11L16 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 16 // --- // --- /// ENST00000507418 // DDX11L16 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 16 // --- // --- /// ENST00000421620 // DDX11L5 // DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 5 // --- // ---\tNR_046018 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 1 (DDX11L1), non-coding RNA. // chr1 // 100 // 100 // 25 // 25 // 0 /// NR_034090 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 (DDX11L9), transcript variant 1, non-coding RNA. // chr1 // 96 // 100 // 24 // 25 // 0 /// NR_051985 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 9 (DDX11L9), transcript variant 2, non-coding RNA. // chr1 // 96 // 100 // 24 // 25 // 0 /// NR_045117 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 10 (DDX11L10), non-coding RNA. // chr1 // 92 // 96 // 22 // 24 // 0 /// NR_024004 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 (DDX11L2), transcript variant 1, non-coding RNA. // chr1 // 83 // 96 // 20 // 24 // 0 /// NR_024005 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 2 (DDX11L2), transcript variant 2, non-coding RNA. // chr1 // 83 // 96 // 20 // 24 // 0 /// NR_051986 // RefSeq // Homo sapiens DEAD/H (Asp-Glu-Ala-Asp/His) box helicase 11 like 5 (DDX11L5), non-coding RNA. // chr1 // 50 // 96 // 12 // 24 // 0 /// TCONS_l2_00010384-XLOC_l2_005087 // Broad TUCP // linc-SNRNP25-2 chr16:+:61554-64041 // chr1 // 92 // 96 // 22 // 24 // 0 /// TCONS_l2_00010385-XLOC_l2_005087 // Broad TUCP // linc-SNRNP25-2 chr16:+:61554-64090 // chr1 // 92 // 96 // 22 // 24 // 0 /// TCONS_l2_00030644-XLOC_l2_015857 // Broad TUCP // linc-TMLHE chrX:-:155255810-155257756 // chr1 // 50 // 96 // 12 // 24 // 0 /// TCONS_l2_00028588-XLOC_l2_014685 // Broad TUCP // linc-DOCK8-2 chr9:+:11235-13811 // chr1 // 50 // 64 // 8 // 16 // 0 /// TCONS_l2_00030643-XLOC_l2_015857 // Broad TUCP // linc-TMLHE chrX:-:155255810-155257756 // chr1 // 50 // 64 // 8 // 16 // 0 /// ENST00000456328 // ENSEMBL // cdna:known chromosome:GRCh37:1:11869:14409:1 gene:ENSG00000223972 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000559159 // ENSEMBL // cdna:known chromosome:GRCh37:15:102516761:102519296:-1 gene:ENSG00000248472 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 96 // 100 // 24 // 25 // 0 /// ENST00000562189 // ENSEMBL // cdna:known chromosome:GRCh37:15:102516761:102519296:-1 gene:ENSG00000248472 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 96 // 100 // 24 // 25 // 0 /// ENST00000513886 // ENSEMBL // cdna:known chromosome:GRCh37:16:61555:64090:1 gene:ENSG00000233614 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 92 // 96 // 22 // 24 // 0 /// AK125998 // GenBank // Homo sapiens cDNA FLJ44010 fis, clone TESTI4024344. // chr1 // 50 // 96 // 12 // 24 // 0 /// BC070227 // GenBank // Homo sapiens similar to DEAD/H (Asp-Glu-Ala-Asp/His) box polypeptide 11 isoform 1, mRNA (cDNA clone IMAGE:6103207). // chr1 // 100 // 44 // 11 // 11 // 0 /// ENST00000515242 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:11872:14412:1 gene:ENSG00000223972 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000518655 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:11874:14409:1 gene:ENSG00000223972 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000515173 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:15:102516758:102519298:-1 gene:ENSG00000248472 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 96 // 100 // 24 // 25 // 0 /// ENST00000545636 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:16:61553:64093:1 gene:ENSG00000233614 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 92 // 96 // 22 // 24 // 0 /// ENST00000450305 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:12010:13670:1 gene:ENSG00000223972 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 100 // 68 // 17 // 17 // 0 /// ENST00000560040 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:15:102517497:102518994:-1 gene:ENSG00000248472 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 94 // 68 // 16 // 17 // 0 /// ENST00000430178 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:16:61861:63351:1 gene:ENSG00000233614 gene_biotype:pseudogene transcript_biotype:transcribed_unprocessed_pseudogene // chr1 // 88 // 64 // 14 // 16 // 0 /// ENST00000538648 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:15:102517351:102517622:-1 gene:ENSG00000248472 gene_biotype:pseudogene transcript_biotype:pseudogene // chr1 // 100 // 16 // 4 // 4 // 0 /// ENST00000535848 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:2:114356606:114359144:-1 gene:ENSG00000236397 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 83 // 96 // 20 // 24 // 0 /// ENST00000457993 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:2:114356613:114358838:-1 gene:ENSG00000236397 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 85 // 80 // 17 // 20 // 0 /// ENST00000437401 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:2:114356613:114358838:-1 gene:ENSG00000236397 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 80 // 80 // 16 // 20 // 0 /// ENST00000426146 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:9:11987:14522:1 gene:ENSG00000236875 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 50 // 96 // 12 // 24 // 0 /// ENST00000445777 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:X:155255323:155257848:-1 gene:ENSG00000227159 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 50 // 96 // 12 // 24 // 0 /// ENST00000507418 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:X:155255329:155257542:-1 gene:ENSG00000227159 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 50 // 64 // 8 // 16 // 0 /// ENST00000421620 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:9:12134:13439:1 gene:ENSG00000236875 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 12 // 3 // 3 // 0 /// GENSCAN00000003613 // ENSEMBL // cdna:genscan chromosome:GRCh37:15:102517021:102518980:-1 transcript_biotype:protein_coding // chr1 // 100 // 52 // 13 // 13 // 0 /// GENSCAN00000026650 // ENSEMBL // cdna:genscan chromosome:GRCh37:1:12190:14149:1 transcript_biotype:protein_coding // chr1 // 100 // 52 // 13 // 13 // 0 /// GENSCAN00000029586 // ENSEMBL // cdna:genscan chromosome:GRCh37:16:61871:63830:1 transcript_biotype:protein_coding // chr1 // 100 // 48 // 12 // 12 // 0 /// ENST00000535849 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:12:92239:93430:-1 gene:ENSG00000256263 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 38 // 32 // 3 // 8 // 1 /// ENST00000575871 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:HG858_PATCH:62310:63501:1 gene:ENSG00000262195 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 38 // 32 // 3 // 8 // 1 /// ENST00000572276 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:HSCHR12_1_CTG1:62310:63501:1 gene:ENSG00000263289 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 38 // 32 // 3 // 8 // 1 /// GENSCAN00000048516 // ENSEMBL // cdna:genscan chromosome:GRCh37:HG858_PATCH:62740:64276:1 transcript_biotype:protein_coding // chr1 // 25 // 48 // 3 // 12 // 1 /// GENSCAN00000048612 // ENSEMBL // cdna:genscan chromosome:GRCh37:HSCHR12_1_CTG1:62740:64276:1 transcript_biotype:protein_coding // chr1 // 25 // 48 // 3 // 12 // 1\tNR_046018 // B7ZGW9 /// NR_046018 // B7ZGX0 /// NR_046018 // B7ZGX2 /// NR_046018 // B7ZGX3 /// NR_046018 // B7ZGX5 /// NR_046018 // B7ZGX6 /// NR_046018 // B7ZGX7 /// NR_046018 // B7ZGX8 /// NR_046018 // B7ZGX9 /// NR_046018 // B7ZGY0 /// NR_034090 // B7ZGW9 /// NR_034090 // B7ZGX0 /// NR_034090 // B7ZGX2 /// NR_034090 // B7ZGX3 /// NR_034090 // B7ZGX5 /// NR_034090 // B7ZGX6 /// NR_034090 // B7ZGX7 /// NR_034090 // B7ZGX8 /// NR_034090 // B7ZGX9 /// NR_034090 // B7ZGY0 /// NR_051985 // B7ZGW9 /// NR_051985 // B7ZGX0 /// NR_051985 // B7ZGX2 /// NR_051985 // B7ZGX3 /// NR_051985 // B7ZGX5 /// NR_051985 // B7ZGX6 /// NR_051985 // B7ZGX7 /// NR_051985 // B7ZGX8 /// NR_051985 // B7ZGX9 /// NR_051985 // B7ZGY0 /// NR_045117 // B7ZGW9 /// NR_045117 // B7ZGX0 /// NR_045117 // B7ZGX2 /// NR_045117 // B7ZGX3 /// NR_045117 // B7ZGX5 /// NR_045117 // B7ZGX6 /// NR_045117 // B7ZGX7 /// NR_045117 // B7ZGX8 /// NR_045117 // B7ZGX9 /// NR_045117 // B7ZGY0 /// NR_024005 // B7ZGW9 /// NR_024005 // B7ZGX0 /// NR_024005 // B7ZGX2 /// NR_024005 // B7ZGX3 /// NR_024005 // B7ZGX5 /// NR_024005 // B7ZGX6 /// NR_024005 // B7ZGX7 /// NR_024005 // B7ZGX8 /// NR_024005 // B7ZGX9 /// NR_024005 // B7ZGY0 /// NR_051986 // B7ZGW9 /// NR_051986 // B7ZGX0 /// NR_051986 // B7ZGX2 /// NR_051986 // B7ZGX3 /// NR_051986 // B7ZGX5 /// NR_051986 // B7ZGX6 /// NR_051986 // B7ZGX7 /// NR_051986 // B7ZGX8 /// NR_051986 // B7ZGX9 /// NR_051986 // B7ZGY0 /// AK125998 // Q6ZU42 /// AK125998 // B7ZGW9 /// AK125998 // B7ZGX0 /// AK125998 // B7ZGX2 /// AK125998 // B7ZGX3 /// AK125998 // B7ZGX5 /// AK125998 // B7ZGX6 /// AK125998 // B7ZGX7 /// AK125998 // B7ZGX8 /// AK125998 // B7ZGX9 /// AK125998 // B7ZGY0\tNR_046018 // Hs.714157 // testis| normal| adult /// NR_034090 // Hs.644359 // blood| normal| adult /// NR_051985 // Hs.644359 // blood| normal| adult /// NR_045117 // Hs.592089 // brain| glioma /// NR_024004 // Hs.712940 // bladder| bone marrow| brain| embryonic tissue| intestine| mammary gland| muscle| pharynx| placenta| prostate| skin| spleen| stomach| testis| thymus| breast (mammary gland) tumor| gastrointestinal tumor| glioma| non-neoplasia| normal| prostate cancer| skin tumor| soft tissue/muscle tissue tumor|embryoid body| adult /// NR_024005 // Hs.712940 // bladder| bone marrow| brain| embryonic tissue| intestine| mammary gland| muscle| pharynx| placenta| prostate| skin| spleen| stomach| testis| thymus| breast (mammary gland) tumor| gastrointestinal tumor| glioma| non-neoplasia| normal| prostate cancer| skin tumor| soft tissue/muscle tissue tumor|embryoid body| adult /// NR_051986 // Hs.719844 // brain| normal /// ENST00000456328 // Hs.714157 // testis| normal| adult /// ENST00000559159 // Hs.644359 // blood| normal| adult /// ENST00000562189 // Hs.644359 // blood| normal| adult /// ENST00000513886 // Hs.592089 // brain| glioma /// ENST00000515242 // Hs.714157 // testis| normal| adult /// ENST00000518655 // Hs.714157 // testis| normal| adult /// ENST00000515173 // Hs.644359 // blood| normal| adult /// ENST00000545636 // Hs.592089 // brain| glioma /// ENST00000450305 // Hs.714157 // testis| normal| adult /// ENST00000560040 // Hs.644359 // blood| normal| adult /// ENST00000430178 // Hs.592089 // brain| glioma /// ENST00000538648 // Hs.644359 // blood| normal| adult\t---\t---\t---\t---\t---\t3\tmain\tNR_046018\n",
      "16657440\t16657440\tchr1\t+\t29554\t31109\t28\tENST00000473358 // MIR1302-11 // microRNA 1302-11 // --- // 100422919 /// ENST00000473358 // MIR1302-10 // microRNA 1302-10 // --- // 100422834 /// ENST00000473358 // MIR1302-9 // microRNA 1302-9 // --- // 100422831 /// ENST00000473358 // MIR1302-2 // microRNA 1302-2 // --- // 100302278\tENST00000473358 // ENSEMBL // cdna:known chromosome:GRCh37:1:29554:31097:1 gene:ENSG00000243485 gene_biotype:antisense transcript_biotype:antisense // chr1 // 100 // 71 // 20 // 20 // 0\t---\t---\t---\t---\t---\t---\t---\t3\tmain\t\tENST00000473358\n",
      "16657445\t16657445\tchr1\t+\t69091\t70008\t8\tNM_001005484 // OR4F5 // olfactory receptor, family 4, subfamily F, member 5 // 1p36.33 // 79501 /// ENST00000335137 // OR4F5 // olfactory receptor, family 4, subfamily F, member 5 // 1p36.33 // 79501\tNM_001005484 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 5 (OR4F5), mRNA. // chr1 // 100 // 100 // 8 // 8 // 0 /// ENST00000335137 // ENSEMBL // cdna:known chromosome:GRCh37:1:69091:70008:1 gene:ENSG00000186092 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 8 // 8 // 0\t---\tNM_001005484 // Hs.554500 // --- /// ENST00000335137 // Hs.554500 // ---\t---\tNM_001005484 // GO:0005886 // plasma membrane // traceable author statement  /// NM_001005484 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// ENST00000335137 // GO:0005886 // plasma membrane // traceable author statement  /// ENST00000335137 // GO:0016021 // integral to membrane // inferred from electronic annotation\tNM_001005484 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// NM_001005484 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// ENST00000335137 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// ENST00000335137 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation\t---\tENST00000335137 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000335137 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx\t3\tmain\tNM_001005484\n",
      "16657447\t16657447\tchr1\t+\t160446\t161525\t13\t---\tTCONS_00000119-XLOC_000001 // Rinn lincRNA // linc-OR4F16-10 chr1:+:160445-161525 // chr1 // 100 // 100 // 13 // 13 // 0\t---\t---\t---\t---\t---\t---\t---\t3\tmain\t\tTCONS_00000119-XLOC_000001\n",
      "16657450\t16657450\tchr1\t+\t317811\t328581\t36\tAK302511 // LOC100132062 // uncharacterized LOC100132062 // 5q35.3 // 100132062 /// AK294489 // LOC729737 // uncharacterized LOC729737 // 1p36.33 // 729737 /// AK303380 // LOC100132062 // uncharacterized LOC100132062 // 5q35.3 // 100132062 /// AK316554 // LOC100132062 // uncharacterized LOC100132062 // 5q35.3 // 100132062 /// AK316556 // LOC100132062 // uncharacterized LOC100132062 // 5q35.3 // 100132062 /// AK302573 // LOC729737 // uncharacterized LOC729737 // 1p36.33 // 729737 /// AK123446 // LOC441124 // uncharacterized LOC441124 // 1q42.11 // 441124 /// ENST00000425496 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000425496 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000425496 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000425496 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000456623 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000456623 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000456623 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000456623 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000418377 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000418377 // LOC100288102 // uncharacterized LOC100288102 // 1q42.11 // 100288102 /// ENST00000418377 // LOC731275 // uncharacterized LOC731275 // 1q43 // 731275 /// ENST00000534867 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000534867 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000534867 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000534867 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000544678 // LOC100653346 // uncharacterized LOC100653346 // --- // 100653346 /// ENST00000544678 // LOC100653241 // uncharacterized LOC100653241 // --- // 100653241 /// ENST00000544678 // LOC100652945 // uncharacterized LOC100652945 // --- // 100652945 /// ENST00000544678 // LOC100508632 // uncharacterized LOC100508632 // --- // 100508632 /// ENST00000544678 // LOC100132050 // uncharacterized LOC100132050 // 7p11.2 // 100132050 /// ENST00000544678 // LOC100128326 // putative uncharacterized protein FLJ44672-like // 7p11.2 // 100128326 /// ENST00000419160 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000419160 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000419160 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000419160 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000432964 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000432964 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000432964 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000432964 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000423728 // LOC100506479 // uncharacterized LOC100506479 // --- // 100506479 /// ENST00000423728 // LOC100289306 // uncharacterized LOC100289306 // 7p11.2 // 100289306 /// ENST00000423728 // LOC100287894 // uncharacterized LOC100287894 // 7q11.21 // 100287894 /// ENST00000423728 // FLJ45445 // uncharacterized LOC399844 // 19p13.3 // 399844 /// ENST00000457364 // LOC100653346 // uncharacterized LOC100653346 // --- // 100653346 /// ENST00000457364 // LOC100653241 // uncharacterized LOC100653241 // --- // 100653241 /// ENST00000457364 // LOC100652945 // uncharacterized LOC100652945 // --- // 100652945 /// ENST00000457364 // LOC100508632 // uncharacterized LOC100508632 // --- // 100508632 /// ENST00000457364 // LOC100132050 // uncharacterized LOC100132050 // 7p11.2 // 100132050 /// ENST00000457364 // LOC100128326 // putative uncharacterized protein FLJ44672-like // 7p11.2 // 100128326 /// ENST00000438516 // LOC100653346 // uncharacterized LOC100653346 // --- // 100653346 /// ENST00000438516 // LOC100653241 // uncharacterized LOC100653241 // --- // 100653241 /// ENST00000438516 // LOC100652945 // uncharacterized LOC100652945 // --- // 100652945 /// ENST00000438516 // LOC100508632 // uncharacterized LOC100508632 // --- // 100508632 /// ENST00000438516 // LOC100132050 // uncharacterized LOC100132050 // 7p11.2 // 100132050 /// ENST00000438516 // LOC100128326 // putative uncharacterized protein FLJ44672-like // 7p11.2 // 100128326\tAK302511 // GenBank // Homo sapiens cDNA FLJ61476 complete cds. // chr1 // 92 // 33 // 11 // 12 // 0 /// AK294489 // GenBank // Homo sapiens cDNA FLJ52615 complete cds. // chr1 // 77 // 36 // 10 // 13 // 0 /// AK303380 // GenBank // Homo sapiens cDNA FLJ53527 complete cds. // chr1 // 100 // 14 // 5 // 5 // 0 /// AK316554 // GenBank // Homo sapiens cDNA, FLJ79453 complete cds. // chr1 // 100 // 11 // 4 // 4 // 0 /// AK316556 // GenBank // Homo sapiens cDNA, FLJ79455 complete cds. // chr1 // 100 // 11 // 4 // 4 // 0 /// AK302573 // GenBank // Homo sapiens cDNA FLJ52612 complete cds. // chr1 // 80 // 14 // 4 // 5 // 0 /// TCONS_l2_00002815-XLOC_l2_001399 // Broad TUCP // linc-PLD5-5 chr1:-:243219130-243221165 // chr1 // 92 // 33 // 11 // 12 // 0 /// TCONS_l2_00001802-XLOC_l2_001332 // Broad TUCP // linc-TP53BP2-3 chr1:-:224139117-224140327 // chr1 // 100 // 14 // 5 // 5 // 0 /// TCONS_l2_00001804-XLOC_l2_001332 // Broad TUCP // linc-TP53BP2-3 chr1:-:224139117-224142371 // chr1 // 100 // 14 // 5 // 5 // 0 /// TCONS_00000120-XLOC_000002 // Rinn lincRNA // linc-OR4F16-9 chr1:+:320161-321056 // chr1 // 100 // 11 // 4 // 4 // 0 /// TCONS_l2_00002817-XLOC_l2_001399 // Broad TUCP // linc-PLD5-5 chr1:-:243220177-243221150 // chr1 // 100 // 6 // 2 // 2 // 0 /// TCONS_00000437-XLOC_000658 // Rinn lincRNA // linc-ZNF692-6 chr1:-:139789-140339 // chr1 // 100 // 6 // 2 // 2 // 0 /// AK299469 // GenBank // Homo sapiens cDNA FLJ52610 complete cds. // chr1 // 100 // 33 // 12 // 12 // 0 /// AK302889 // GenBank // Homo sapiens cDNA FLJ54896 complete cds. // chr1 // 100 // 22 // 8 // 8 // 0 /// AK123446 // GenBank // Homo sapiens cDNA FLJ41452 fis, clone BRSTN2010363. // chr1 // 100 // 19 // 7 // 7 // 0 /// ENST00000425496 // ENSEMBL // cdna:known chromosome:GRCh37:1:324756:328453:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 33 // 13 // 12 // 0 /// ENST00000456623 // ENSEMBL // cdna:known chromosome:GRCh37:1:324515:326852:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 33 // 12 // 12 // 0 /// ENST00000418377 // ENSEMBL // cdna:known chromosome:GRCh37:1:243219131:243221165:-1 gene:ENSG00000214837 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 92 // 33 // 11 // 12 // 0 /// ENST00000534867 // ENSEMBL // cdna:known chromosome:GRCh37:1:324438:325896:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 28 // 10 // 10 // 0 /// ENST00000544678 // ENSEMBL // cdna:known chromosome:GRCh37:5:180751053:180752511:1 gene:ENSG00000238035 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 22 // 8 // 8 // 0 /// ENST00000419160 // ENSEMBL // cdna:known chromosome:GRCh37:1:322732:324955:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 17 // 6 // 6 // 0 /// ENST00000432964 // ENSEMBL // cdna:known chromosome:GRCh37:1:320162:321056:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 11 // 4 // 4 // 0 /// ENST00000423728 // ENSEMBL // cdna:known chromosome:GRCh37:1:320162:324461:1 gene:ENSG00000237094 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 11 // 4 // 4 // 0 /// BC092421 // GenBank // Homo sapiens cDNA clone IMAGE:30378758. // chr1 // 100 // 33 // 12 // 12 // 0 /// ENST00000426316 // ENSEMBL // cdna:known chromosome:GRCh37:1:317811:328455:1 gene:ENSG00000240876 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 8 // 3 // 3 // 0 /// ENST00000465971 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:7:128291239:128292388:1 gene:ENSG00000243302 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 31 // 11 // 11 // 0 /// ENST00000535314 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:7:128291243:128292355:1 gene:ENSG00000243302 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 31 // 11 // 11 // 0 /// ENST00000423372 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:134901:139379:-1 gene:ENSG00000237683 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 90 // 28 // 9 // 10 // 0 /// ENST00000435839 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:137283:139620:-1 gene:ENSG00000237683 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 90 // 28 // 9 // 10 // 0 /// ENST00000537461 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:138239:139697:-1 gene:ENSG00000237683 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 19 // 7 // 7 // 0 /// ENST00000494149 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:135247:138039:-1 gene:ENSG00000237683 gene_biotype:pseudogene transcript_biotype:processed_pseudogene // chr1 // 100 // 8 // 3 // 3 // 0 /// ENST00000514436 // ENSEMBL // cdna:pseudogene chromosome:GRCh37:1:326096:328112:1 gene:ENSG00000250575 gene_biotype:pseudogene transcript_biotype:unprocessed_pseudogene // chr1 // 100 // 8 // 3 // 3 // 0 /// ENST00000457364 // ENSEMBL // cdna:known chromosome:GRCh37:5:180751371:180755068:1 gene:ENSG00000238035 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 28 // 11 // 10 // 0 /// ENST00000438516 // ENSEMBL // cdna:known chromosome:GRCh37:5:180751130:180753467:1 gene:ENSG00000238035 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 28 // 10 // 10 // 0 /// ENST00000526704 // ENSEMBL // ensembl_havana_lincrna:lincRNA chromosome:GRCh37:11:129531:139099:-1 gene:ENSG00000230724 gene_biotype:lincRNA transcript_biotype:processed_transcript // chr1 // 93 // 42 // 14 // 15 // 0 /// ENST00000540375 // ENSEMBL // ensembl_havana_lincrna:lincRNA chromosome:GRCh37:11:127115:131056:-1 gene:ENSG00000230724 gene_biotype:lincRNA transcript_biotype:processed_transcript // chr1 // 100 // 28 // 11 // 10 // 0 /// ENST00000457006 // ENSEMBL // ensembl_havana_lincrna:lincRNA chromosome:GRCh37:11:128960:131297:-1 gene:ENSG00000230724 gene_biotype:lincRNA transcript_biotype:processed_transcript // chr1 // 90 // 28 // 9 // 10 // 0 /// ENST00000427071 // ENSEMBL // ensembl_havana_lincrna:lincRNA chromosome:GRCh37:11:130207:131297:-1 gene:ENSG00000230724 gene_biotype:lincRNA transcript_biotype:processed_transcript // chr1 // 100 // 25 // 9 // 9 // 0 /// ENST00000542435 // ENSEMBL // ensembl_havana_lincrna:lincRNA chromosome:GRCh37:11:129916:131374:-1 gene:ENSG00000230724 gene_biotype:lincRNA transcript_biotype:processed_transcript // chr1 // 100 // 22 // 8 // 8 // 0\tAK302511 // B4DYM5 /// AK294489 // B4DGA0 /// AK294489 // Q6ZSN7 /// AK303380 // B4E0H4 /// AK303380 // Q6ZQS4 /// AK303380 // A8E4K2 /// AK316554 // B4E3X0 /// AK316554 // Q6ZSN7 /// AK316556 // B4E3X2 /// AK316556 // Q6ZSN7 /// AK302573 // B7Z7W4 /// AK302573 // Q6ZQS4 /// AK302573 // A8E4K2 /// AK299469 // B7Z5V7 /// AK299469 // Q6ZSN7 /// AK302889 // B7Z846 /// AK302889 // Q6ZSN7 /// AK123446 // B3KVU4\tAK302511 // Hs.732199 // ascites| blood| brain| connective tissue| embryonic tissue| eye| intestine| kidney| larynx| lung| ovary| placenta| prostate| stomach| testis| thymus| uterus| chondrosarcoma| colorectal tumor| gastrointestinal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor| fetus| adult /// AK294489 // Hs.534942 // blood| brain| embryonic tissue| intestine| lung| mammary gland| mouth| ovary| pancreas| pharynx| placenta| spleen| stomach| testis| thymus| trachea| breast (mammary gland) tumor| colorectal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor|embryoid body| blastocyst| fetus| adult /// AK294489 // Hs.734488 // blood| brain| esophagus| intestine| kidney| lung| mammary gland| mouth| placenta| prostate| testis| thymus| thyroid| uterus| breast (mammary gland) tumor| colorectal tumor| esophageal tumor| head and neck tumor| kidney tumor| leukemia| lung tumor| normal| adult /// AK303380 // Hs.732199 // ascites| blood| brain| connective tissue| embryonic tissue| eye| intestine| kidney| larynx| lung| ovary| placenta| prostate| stomach| testis| thymus| uterus| chondrosarcoma| colorectal tumor| gastrointestinal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor| fetus| adult /// AK316554 // Hs.732199 // ascites| blood| brain| connective tissue| embryonic tissue| eye| intestine| kidney| larynx| lung| ovary| placenta| prostate| stomach| testis| thymus| uterus| chondrosarcoma| colorectal tumor| gastrointestinal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor| fetus| adult /// AK316556 // Hs.732199 // ascites| blood| brain| connective tissue| embryonic tissue| eye| intestine| kidney| larynx| lung| ovary| placenta| prostate| stomach| testis| thymus| uterus| chondrosarcoma| colorectal tumor| gastrointestinal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor| fetus| adult /// AK302573 // Hs.534942 // blood| brain| embryonic tissue| intestine| lung| mammary gland| mouth| ovary| pancreas| pharynx| placenta| spleen| stomach| testis| thymus| trachea| breast (mammary gland) tumor| colorectal tumor| head and neck tumor| leukemia| lung tumor| normal| ovarian tumor|embryoid body| blastocyst| fetus| adult /// AK302573 // Hs.734488 // blood| brain| esophagus| intestine| kidney| lung| mammary gland| mouth| placenta| prostate| testis| thymus| thyroid| uterus| breast (mammary gland) tumor| colorectal tumor| esophageal tumor| head and neck tumor| kidney tumor| leukemia| lung tumor| normal| adult /// AK123446 // Hs.520589 // bladder| blood| bone| brain| embryonic tissue| intestine| kidney| liver| lung| lymph node| ovary| pancreas| parathyroid| placenta| testis| thyroid| uterus| colorectal tumor| glioma| head and neck tumor| kidney tumor| leukemia| liver tumor| normal| ovarian tumor| uterine tumor|embryoid body| fetus| adult /// ENST00000425496 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000425496 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult /// ENST00000456623 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000456623 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult /// ENST00000534867 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000534867 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult /// ENST00000419160 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000419160 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult /// ENST00000432964 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000432964 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult /// ENST00000423728 // Hs.356758 // blood| bone| brain| cervix| connective tissue| embryonic tissue| intestine| kidney| lung| mammary gland| mouth| pancreas| pharynx| placenta| prostate| spleen| stomach| testis| trachea| uterus| vascular| breast (mammary gland) tumor| chondrosarcoma| colorectal tumor| gastrointestinal tumor| glioma| head and neck tumor| leukemia| lung tumor| normal| uterine tumor| adult /// ENST00000423728 // Hs.733048 // ascites| bladder| blood| brain| embryonic tissue| eye| intestine| kidney| larynx| liver| lung| mammary gland| mouth| pancreas| placenta| prostate| skin| stomach| testis| thymus| thyroid| trachea| uterus| bladder carcinoma| breast (mammary gland) tumor| colorectal tumor| gastrointestinal tumor| head and neck tumor| kidney tumor| leukemia| liver tumor| lung tumor| normal| pancreatic tumor| prostate cancer| retinoblastoma| skin tumor| soft tissue/muscle tissue tumor| uterine tumor|embryoid body| blastocyst| fetus| adult\t---\t---\t---\t---\t---\t3\tmain\tAK302511\n",
      "16657469\t16657469\tchr1\t+\t329790\t342507\t27\tBC118988 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// ENST00000279067 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// ENST00000425473 // LINC00266-1 // long intergenic non-protein coding RNA 266-1 // 20q13.33 // 140849 /// ENST00000424587 // LOC100508047 // uncharacterized LOC100508047 // --- // 100508047\tBC118988 // GenBank // Homo sapiens chromosome 20 open reading frame 69, mRNA (cDNA clone MGC:141807 IMAGE:40035995), complete cds. // chr1 // 54 // 89 // 13 // 24 // 0 /// TCONS_l2_00002388-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:646721-655580 // chr1 // 100 // 67 // 18 // 18 // 0 /// TCONS_l2_00001926-XLOC_l2_000004 // Broad TUCP // linc-OR4F16-1 chr1:+:329783-334271 // chr1 // 100 // 59 // 16 // 16 // 0 /// TCONS_l2_00001927-XLOC_l2_000004 // Broad TUCP // linc-OR4F16-1 chr1:+:334139-342806 // chr1 // 100 // 59 // 16 // 16 // 0 /// TCONS_l2_00002389-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:655437-659930 // chr1 // 100 // 59 // 16 // 16 // 0 /// TCONS_l2_00003949-XLOC_l2_001561 // Broad TUCP // linc-BMS1-9 chr10:+:38742108-38755311 // chr1 // 56 // 100 // 15 // 27 // 0 /// TCONS_l2_00025304-XLOC_l2_012836 // Broad TUCP // linc-PDCD2-1 chr6:-:131909-144885 // chr1 // 52 // 100 // 14 // 27 // 0 /// TCONS_l2_00002372-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:129080-133566 // chr1 // 88 // 59 // 14 // 16 // 0 /// TCONS_l2_00016828-XLOC_l2_008724 // Broad TUCP // linc-HNF1B-4 chr20:+:62921737-62934707 // chr1 // 54 // 89 // 13 // 24 // 0 /// TCONS_l2_00002380-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:235855-267253 // chr1 // 100 // 33 // 9 // 9 // 0 /// TCONS_l2_00003950-XLOC_l2_001561 // Broad TUCP // linc-BMS1-9 chr10:+:38742265-38764837 // chr1 // 56 // 67 // 10 // 18 // 0 /// TCONS_l2_00002386-XLOC_l2_000726 // Broad TUCP // linc-OR4F29-1 chr1:-:637315-655530 // chr1 // 100 // 22 // 6 // 6 // 0 /// TCONS_l2_00002814-XLOC_l2_001398 // Broad TUCP // linc-PLD5-4 chr1:-:243211038-243215554 // chr1 // 56 // 59 // 9 // 16 // 0 /// TCONS_l2_00002811-XLOC_l2_001398 // Broad TUCP // linc-PLD5-4 chr1:-:243192813-243211127 // chr1 // 100 // 15 // 4 // 4 // 0 /// TCONS_l2_00016829-XLOC_l2_008724 // Broad TUCP // linc-HNF1B-4 chr20:+:62926293-62944485 // chr1 // 67 // 22 // 4 // 6 // 0 /// TCONS_l2_00002371-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:110952-129173 // chr1 // 67 // 22 // 4 // 6 // 0 /// ENST00000279067 // ENSEMBL // cdna:known chromosome:GRCh37:20:62921738:62934912:1 gene:ENSG00000149656 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 54 // 89 // 13 // 24 // 0 /// ENST00000425473 // ENSEMBL // cdna:known chromosome:GRCh37:20:62926294:62944485:1 gene:ENSG00000149656 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 67 // 22 // 4 // 6 // 0 /// ENST00000424587 // ENSEMBL // cdna:known chromosome:GRCh37:1:235856:267253:-1 gene:ENSG00000228463 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 33 // 9 // 9 // 0 /// ENST00000455464 // ENSEMBL // cdna:known chromosome:GRCh37:1:334140:342806:1 gene:ENSG00000224813 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 100 // 59 // 16 // 16 // 0 /// ENST00000441245 // ENSEMBL // cdna:known chromosome:GRCh37:1:637316:655530:-1 gene:ENSG00000230021 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 100 // 22 // 6 // 6 // 0 /// ENST00000471248 // ENSEMBL // cdna:known chromosome:GRCh37:1:110953:129173:-1 gene:ENSG00000238009 gene_biotype:antisense transcript_biotype:antisense // chr1 // 67 // 22 // 4 // 6 // 0\t---\t---\t---\t---\t---\t---\t---\t3\tmain\tBC118988\n",
      "16657473\t16657473\tchr1\t+\t367640\t368634\t25\tENST00000426406 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000426406 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000426406 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// ENST00000332831 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000332831 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000332831 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// ENST00000456475 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// ENST00000456475 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// ENST00000456475 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// NM_001005277 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// NM_001005221 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759 /// NM_001005224 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// NM_001005504 // OR4F21 // olfactory receptor, family 4, subfamily F, member 21 // 8p23.3 // 441308 /// ENST00000320901 // OR4F21 // olfactory receptor, family 4, subfamily F, member 21 // 8p23.3 // 441308 /// BC137547 // OR4F3 // olfactory receptor, family 4, subfamily F, member 3 // 5q35.3 // 26683 /// BC137547 // OR4F16 // olfactory receptor, family 4, subfamily F, member 16 // 1p36.33 // 81399 /// BC137547 // OR4F29 // olfactory receptor, family 4, subfamily F, member 29 // 1p36.33 // 729759\tENST00000426406 // ENSEMBL // cdna:known chromosome:GRCh37:1:367640:368634:1 gene:ENSG00000235249 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000332831 // ENSEMBL // cdna:known chromosome:GRCh37:1:621059:622053:-1 gene:ENSG00000185097 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000456475 // ENSEMBL // cdna:known chromosome:GRCh37:5:180794269:180795263:1 gene:ENSG00000230178 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 100 // 100 // 25 // 25 // 0 /// NM_001005277 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 16 (OR4F16), mRNA. // chr1 // 100 // 68 // 17 // 17 // 0 /// NM_001005221 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 29 (OR4F29), mRNA. // chr1 // 100 // 68 // 17 // 17 // 0 /// NM_001005224 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 3 (OR4F3), mRNA. // chr1 // 100 // 68 // 17 // 17 // 0 /// NM_001005504 // RefSeq // Homo sapiens olfactory receptor, family 4, subfamily F, member 21 (OR4F21), mRNA. // chr1 // 94 // 68 // 16 // 17 // 0 /// ENST00000320901 // ENSEMBL // cdna:known chromosome:GRCh37:8:116049:117043:-1 gene:ENSG00000176269 gene_biotype:protein_coding transcript_biotype:protein_coding // chr1 // 94 // 68 // 16 // 17 // 0 /// BC137547 // GenBank // Homo sapiens olfactory receptor, family 4, subfamily F, member 3, mRNA (cDNA clone MGC:169170 IMAGE:9021547), complete cds. // chr1 // 100 // 100 // 25 // 25 // 0 /// ENST00000521196 // ENSEMBL // cdna:known chromosome:GRCh37:11:86612:87605:-1 gene:ENSG00000224777 gene_biotype:pseudogene transcript_biotype:processed_transcript // chr1 // 76 // 68 // 13 // 17 // 0\tBC137547 // Q6IEY1\tENST00000426406 // Hs.632360 // muscle| normal /// ENST00000426406 // Hs.722724 // --- /// ENST00000332831 // Hs.632360 // muscle| normal /// ENST00000332831 // Hs.722724 // --- /// ENST00000456475 // Hs.632360 // muscle| normal /// ENST00000456475 // Hs.722724 // --- /// NM_001005277 // Hs.632360 // muscle| normal /// NM_001005224 // Hs.722724 // --- /// NM_001005504 // Hs.690459 // --- /// ENST00000320901 // Hs.690459 // --- /// BC137547 // Hs.632360 // muscle| normal /// BC137547 // Hs.722724 // ---\t---\tENST00000426406 // GO:0005886 // plasma membrane // traceable author statement  /// ENST00000426406 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// ENST00000332831 // GO:0005886 // plasma membrane // traceable author statement  /// ENST00000332831 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// ENST00000456475 // GO:0005886 // plasma membrane // traceable author statement  /// ENST00000456475 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// NM_001005221 // GO:0005886 // plasma membrane // traceable author statement  /// NM_001005221 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// NM_001005504 // GO:0005886 // plasma membrane // traceable author statement  /// NM_001005504 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// ENST00000320901 // GO:0005886 // plasma membrane // traceable author statement  /// ENST00000320901 // GO:0016021 // integral to membrane // inferred from electronic annotation  /// BC137547 // GO:0005886 // plasma membrane // traceable author statement  /// BC137547 // GO:0016021 // integral to membrane // inferred from electronic annotation\tENST00000426406 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// ENST00000426406 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// ENST00000332831 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// ENST00000332831 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// ENST00000456475 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// ENST00000456475 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// NM_001005221 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// NM_001005221 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// NM_001005504 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// NM_001005504 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// ENST00000320901 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// ENST00000320901 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation  /// BC137547 // GO:0004930 // G-protein coupled receptor activity // inferred from electronic annotation  /// BC137547 // GO:0004984 // olfactory receptor activity // inferred from electronic annotation\t---\tENST00000426406 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000426406 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx /// ENST00000332831 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000332831 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx /// ENST00000456475 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000456475 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx /// ENST00000320901 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000320901 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx\t3\tmain\t\tENST00000426406\n",
      "16657476\t16657476\tchr1\t+\t459656\t461954\t27\tENST00000424587 // LOC100508047 // uncharacterized LOC100508047 // --- // 100508047\tTCONS_00000121-XLOC_000003 // Rinn lincRNA // linc-SAMD11-9 chr1:+:459655-461954 // chr1 // 100 // 100 // 27 // 27 // 0 /// TCONS_00000442-XLOC_000663 // Rinn lincRNA // linc-ZNF692-2 chr1:-:521368-523833 // chr1 // 96 // 100 // 26 // 27 // 0 /// TCONS_l2_00002380-XLOC_l2_000720 // Broad TUCP // linc-ZNF692-5 chr1:-:235855-267253 // chr1 // 61 // 67 // 11 // 18 // 0 /// ENST00000424587 // ENSEMBL // cdna:known chromosome:GRCh37:1:235856:267253:-1 gene:ENSG00000228463 gene_biotype:processed_transcript transcript_biotype:processed_transcript // chr1 // 61 // 67 // 11 // 18 // 0 /// ENST00000441866 // ENSEMBL // havana:lincRNA chromosome:GRCh37:1:459656:461954:1 gene:ENSG00000236743 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 100 // 100 // 27 // 27 // 0 /// ENST00000417636 // ENSEMBL // havana:lincRNA chromosome:GRCh37:1:521369:523833:-1 gene:ENSG00000231709 gene_biotype:lincRNA transcript_biotype:lincRNA // chr1 // 96 // 100 // 26 // 27 // 0\t---\t---\t---\t---\t---\t---\t---\t3\tmain\t\tENST00000424587\n",
      "16657480\t16657480\tchr1\t+\t523009\t532878\t12\t---\tTCONS_00000124-XLOC_000004 // Rinn lincRNA // linc-SAMD11-8 chr1:+:529832-530595 // chr1 // 100 // 50 // 6 // 6 // 0\t---\t---\t---\t---\t---\t---\t---\t1\tmain\t\tTCONS_00000124-XLOC_000004\n"
     ]
    }
   ],
   "source": [
    "# 1. First get the file paths using geo_get_relevant_filepaths function\n",
    "soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
    "\n",
    "# 2. Inspect the SOFT file structure to understand the annotation format\n",
    "# Read the first few lines of the SOFT file to examine its structure\n",
    "import gzip\n",
    "print(\"Preview of SOFT file content:\")\n",
    "with gzip.open(soft_file, 'rt') as f:\n",
    "    for i, line in enumerate(f):\n",
    "        print(line.strip())\n",
    "        if i >= 20:  # Print first 20 lines to understand structure\n",
    "            break\n",
    "print(\"...\\n\")\n",
    "\n",
    "# 3. Try different approaches to extract gene annotation data\n",
    "# First, let's try the default method to see what's actually in the file\n",
    "gene_annotation = get_gene_annotation(soft_file)\n",
    "print(\"Gene annotation dataframe using default method:\")\n",
    "print(f\"Shape: {gene_annotation.shape}\")\n",
    "print(f\"Columns: {gene_annotation.columns.tolist()}\")\n",
    "print(gene_annotation.head(3))\n",
    "\n",
    "# 4. Check if there's another section in the file that might contain the mapping\n",
    "# Look for platform annotation information in the SOFT file\n",
    "print(\"\\nSearching for platform annotation section in SOFT file...\")\n",
    "with gzip.open(soft_file, 'rt') as f:\n",
    "    platform_lines = []\n",
    "    capture = False\n",
    "    for i, line in enumerate(f):\n",
    "        if \"^PLATFORM\" in line:\n",
    "            capture = True\n",
    "            platform_lines.append(line.strip())\n",
    "        elif capture and line.startswith(\"!platform_table_begin\"):\n",
    "            platform_lines.append(line.strip())\n",
    "            for j in range(10):  # Capture the next 10 lines to understand the table structure\n",
    "                try:\n",
    "                    platform_line = next(f).strip()\n",
    "                    platform_lines.append(platform_line)\n",
    "                except StopIteration:\n",
    "                    break\n",
    "            break\n",
    "    \n",
    "    print(\"\\n\".join(platform_lines))\n",
    "\n",
    "# Maintain gene availability status as True based on previous steps\n",
    "is_gene_available = True\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "90fe5b9a",
   "metadata": {},
   "source": [
    "### Step 6: Gene Identifier Mapping"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9adb713f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:44.466677Z",
     "iopub.status.busy": "2025-03-25T03:41:44.466557Z",
     "iopub.status.idle": "2025-03-25T03:41:45.316559Z",
     "shell.execute_reply": "2025-03-25T03:41:45.316123Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Sample of the gene mapping dataframe:\n",
      "         ID                                               Gene\n",
      "0  16657436  NR_046018 // DDX11L1 // DEAD/H (Asp-Glu-Ala-As...\n",
      "1  16657440  ENST00000473358 // MIR1302-11 // microRNA 1302...\n",
      "2  16657445  NM_001005484 // OR4F5 // olfactory receptor, f...\n",
      "3  16657447                                                ---\n",
      "4  16657450  AK302511 // LOC100132062 // uncharacterized LO...\n",
      "Shape of mapping dataframe: (53617, 2)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "After mapping to gene symbols:\n",
      "Gene expression data dimensions: 81076 genes × 60 samples\n",
      "\n",
      "Sample of gene expression data (first 5 genes, first 3 samples):\n",
      "      GSM4800737  GSM4800738  GSM4800739\n",
      "Gene                                    \n",
      "A-     12.128679   12.520490   12.287928\n",
      "A-2     1.807653    1.736914    1.684175\n",
      "A-52    3.715036    3.666027    3.689625\n",
      "A-E     1.212786    0.902884    1.320547\n",
      "A-I     3.026220    2.757676    2.957934\n"
     ]
    }
   ],
   "source": [
    "# 1. From the gene annotation preview, we need to determine which columns to use\n",
    "# Looking at the gene annotation data, we can see:\n",
    "# - The 'ID' column contains the probe identifiers (e.g., 16657436) which match our gene expression data\n",
    "# - The 'gene_assignment' column appears to contain gene symbols and other gene information\n",
    "\n",
    "# 2. Extract the mapping information from the annotation dataframe\n",
    "# We need the ID column (probe identifiers) and gene_assignment column (which contains gene names)\n",
    "mapping_df = get_gene_mapping(gene_annotation, prob_col='ID', gene_col='gene_assignment')\n",
    "\n",
    "# Print a sample of the mapping dataframe to verify\n",
    "print(\"\\nSample of the gene mapping dataframe:\")\n",
    "print(mapping_df.head())\n",
    "print(f\"Shape of mapping dataframe: {mapping_df.shape}\")\n",
    "\n",
    "# 3. Apply the gene mapping to convert probe-level measurements to gene expression data\n",
    "gene_data = apply_gene_mapping(expression_df=gene_data, mapping_df=mapping_df)\n",
    "\n",
    "# Print information about the resulting gene expression data\n",
    "print(\"\\nAfter mapping to gene symbols:\")\n",
    "print(f\"Gene expression data dimensions: {gene_data.shape[0]} genes × {gene_data.shape[1]} samples\")\n",
    "print(\"\\nSample of gene expression data (first 5 genes, first 3 samples):\")\n",
    "print(gene_data.iloc[:5, :3])\n",
    "\n",
    "# Maintain gene availability status\n",
    "is_gene_available = True if gene_data.shape[0] > 0 else False\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "574d2a13",
   "metadata": {},
   "source": [
    "### Step 7: Data Normalization and Linking"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "9f5c8b0c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-25T03:41:45.317883Z",
     "iopub.status.busy": "2025-03-25T03:41:45.317775Z",
     "iopub.status.idle": "2025-03-25T03:42:00.609190Z",
     "shell.execute_reply": "2025-03-25T03:42:00.608631Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Normalizing gene symbols...\n",
      "Gene data shape after normalization: 23274 genes × 60 samples\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Normalized gene expression data saved to ../../output/preprocess/Psoriasis/gene_data/GSE158448.csv\n",
      "Extracting clinical features from the original source...\n",
      "Extracted clinical features preview:\n",
      "{'GSM4800737': [0.0], 'GSM4800738': [0.0], 'GSM4800739': [0.0], 'GSM4800740': [0.0], 'GSM4800741': [0.0], 'GSM4800742': [1.0], 'GSM4800743': [1.0], 'GSM4800744': [1.0], 'GSM4800745': [1.0], 'GSM4800746': [1.0], 'GSM4800747': [1.0], 'GSM4800748': [1.0], 'GSM4800749': [1.0], 'GSM4800750': [1.0], 'GSM4800751': [1.0], 'GSM4800752': [1.0], 'GSM4800753': [1.0], 'GSM4800754': [1.0], 'GSM4800755': [1.0], 'GSM4800756': [1.0], 'GSM4800757': [1.0], 'GSM4800758': [1.0], 'GSM4800759': [1.0], 'GSM4800760': [1.0], 'GSM4800761': [1.0], 'GSM4800762': [1.0], 'GSM4800763': [1.0], 'GSM4800764': [1.0], 'GSM4800765': [1.0], 'GSM4800766': [1.0], 'GSM4800767': [1.0], 'GSM4800768': [1.0], 'GSM4800769': [1.0], 'GSM4800770': [1.0], 'GSM4800771': [1.0], 'GSM4800772': [1.0], 'GSM4800773': [1.0], 'GSM4800774': [1.0], 'GSM4800775': [1.0], 'GSM4800776': [1.0], 'GSM4800777': [1.0], 'GSM4800778': [1.0], 'GSM4800779': [1.0], 'GSM4800780': [1.0], 'GSM4800781': [1.0], 'GSM4800782': [1.0], 'GSM4800783': [1.0], 'GSM4800784': [1.0], 'GSM4800785': [1.0], 'GSM4800786': [1.0], 'GSM4800787': [1.0], 'GSM4800788': [1.0], 'GSM4800789': [1.0], 'GSM4800790': [1.0], 'GSM4800791': [1.0], 'GSM4800792': [1.0], 'GSM4800793': [1.0], 'GSM4800794': [1.0], 'GSM4800795': [1.0], 'GSM4800796': [1.0]}\n",
      "Clinical data shape: (1, 60)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Clinical features saved to ../../output/preprocess/Psoriasis/clinical_data/GSE158448.csv\n",
      "Linking clinical and genetic data...\n",
      "Linked data shape: (60, 23275)\n",
      "Handling missing values...\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data shape after handling missing values: (60, 23275)\n",
      "\n",
      "Checking for bias in feature variables:\n",
      "For the feature 'Psoriasis', the least common label is '0.0' with 5 occurrences. This represents 8.33% of the dataset.\n",
      "The distribution of the feature 'Psoriasis' in this dataset is fine.\n",
      "\n",
      "A new JSON file was created at: ../../output/preprocess/Psoriasis/cohort_info.json\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Linked data saved to ../../output/preprocess/Psoriasis/GSE158448.csv\n",
      "Final dataset shape: (60, 23275)\n"
     ]
    }
   ],
   "source": [
    "# 1. Check if gene data is available after mapping\n",
    "if gene_data.shape[0] == 0:\n",
    "    print(\"Error: Gene expression matrix is empty after mapping.\")\n",
    "    # Mark the dataset as not usable due to lack of gene expression data\n",
    "    is_usable = validate_and_save_cohort_info(\n",
    "        is_final=True,\n",
    "        cohort=cohort,\n",
    "        info_path=json_path,\n",
    "        is_gene_available=False,  # No usable gene data\n",
    "        is_trait_available=True,\n",
    "        is_biased=True,\n",
    "        df=pd.DataFrame(),\n",
    "        note=\"Failed to map probe IDs to gene symbols. The annotation format may not be compatible with the extraction methods.\"\n",
    "    )\n",
    "    print(\"Dataset deemed not usable due to lack of gene expression data.\")\n",
    "else:\n",
    "    # Only proceed with normalization if we have gene data\n",
    "    print(\"Normalizing gene symbols...\")\n",
    "    gene_data_normalized = normalize_gene_symbols_in_index(gene_data)\n",
    "    print(f\"Gene data shape after normalization: {gene_data_normalized.shape[0]} genes × {gene_data_normalized.shape[1]} samples\")\n",
    "\n",
    "    # Save the normalized gene data\n",
    "    os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n",
    "    gene_data_normalized.to_csv(out_gene_data_file)\n",
    "    print(f\"Normalized gene expression data saved to {out_gene_data_file}\")\n",
    "    \n",
    "    # Extract clinical features from the original data source\n",
    "    print(\"Extracting clinical features from the original source...\")\n",
    "    # Get background information and clinical data again\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",
    "    # Extract clinical features\n",
    "    selected_clinical_df = geo_select_clinical_features(\n",
    "        clinical_df=clinical_data,\n",
    "        trait=trait,\n",
    "        trait_row=trait_row,\n",
    "        convert_trait=convert_trait,\n",
    "        age_row=age_row,\n",
    "        convert_age=convert_age,\n",
    "        gender_row=gender_row,\n",
    "        convert_gender=convert_gender\n",
    "    )\n",
    "    \n",
    "    print(\"Extracted clinical features preview:\")\n",
    "    print(preview_df(selected_clinical_df))\n",
    "    print(f\"Clinical data shape: {selected_clinical_df.shape}\")\n",
    "    \n",
    "    # Save the extracted clinical features\n",
    "    os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n",
    "    selected_clinical_df.to_csv(out_clinical_data_file)\n",
    "    print(f\"Clinical features saved to {out_clinical_data_file}\")\n",
    "    \n",
    "    # Link clinical and genetic data\n",
    "    print(\"Linking clinical and genetic data...\")\n",
    "    linked_data = geo_link_clinical_genetic_data(selected_clinical_df, gene_data_normalized)\n",
    "    print(f\"Linked data shape: {linked_data.shape}\")\n",
    "    \n",
    "    # Check if the linked data has adequate data\n",
    "    if linked_data.shape[0] == 0 or linked_data.shape[1] <= 4:  # 4 is an arbitrary small number\n",
    "        print(\"Error: Linked data has insufficient samples or features.\")\n",
    "        is_usable = validate_and_save_cohort_info(\n",
    "            is_final=True,\n",
    "            cohort=cohort,\n",
    "            info_path=json_path,\n",
    "            is_gene_available=True,\n",
    "            is_trait_available=True,\n",
    "            is_biased=True,\n",
    "            df=linked_data,\n",
    "            note=\"Failed to properly link gene expression data with clinical features.\"\n",
    "        )\n",
    "        print(\"Dataset deemed not usable due to linking failure.\")\n",
    "    else:\n",
    "        # Handle missing values systematically\n",
    "        print(\"Handling missing values...\")\n",
    "        linked_data_clean = handle_missing_values(linked_data, trait_col=trait)\n",
    "        print(f\"Data shape after handling missing values: {linked_data_clean.shape}\")\n",
    "        \n",
    "        # Check if there are still samples after missing value handling\n",
    "        if linked_data_clean.shape[0] == 0:\n",
    "            print(\"Error: No samples remain after handling missing values.\")\n",
    "            is_usable = validate_and_save_cohort_info(\n",
    "                is_final=True,\n",
    "                cohort=cohort,\n",
    "                info_path=json_path,\n",
    "                is_gene_available=True,\n",
    "                is_trait_available=True,\n",
    "                is_biased=True,\n",
    "                df=pd.DataFrame(),\n",
    "                note=\"All samples were removed during missing value handling.\"\n",
    "            )\n",
    "            print(\"Dataset deemed not usable as all samples were filtered out.\")\n",
    "        else:\n",
    "            # Check if the dataset is biased\n",
    "            print(\"\\nChecking for bias in feature variables:\")\n",
    "            is_biased, linked_data_final = judge_and_remove_biased_features(linked_data_clean, trait)\n",
    "            \n",
    "            # Conduct final quality validation\n",
    "            is_usable = validate_and_save_cohort_info(\n",
    "                is_final=True,\n",
    "                cohort=cohort,\n",
    "                info_path=json_path,\n",
    "                is_gene_available=True,\n",
    "                is_trait_available=True,\n",
    "                is_biased=is_biased,\n",
    "                df=linked_data_final,\n",
    "                note=\"Dataset contains gene expression data for Crohn's Disease patients, examining response to Infliximab treatment.\"\n",
    "            )\n",
    "            \n",
    "            # Save linked data if usable\n",
    "            if is_usable:\n",
    "                os.makedirs(os.path.dirname(out_data_file), exist_ok=True)\n",
    "                linked_data_final.to_csv(out_data_file)\n",
    "                print(f\"Linked data saved to {out_data_file}\")\n",
    "                print(f\"Final dataset shape: {linked_data_final.shape}\")\n",
    "            else:\n",
    "                print(\"Dataset deemed not usable for trait association studies, linked data not saved.\")"
   ]
  }
 ],
 "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
}