File size: 88,301 Bytes
53eb596 |
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 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "2a183a19",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.254323Z",
"iopub.status.busy": "2025-03-25T07:25:02.254099Z",
"iopub.status.idle": "2025-03-25T07:25:02.423328Z",
"shell.execute_reply": "2025-03-25T07:25:02.422884Z"
}
},
"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 = \"Lactose_Intolerance\"\n",
"cohort = \"GSE136395\"\n",
"\n",
"# Input paths\n",
"in_trait_dir = \"../../input/GEO/Lactose_Intolerance\"\n",
"in_cohort_dir = \"../../input/GEO/Lactose_Intolerance/GSE136395\"\n",
"\n",
"# Output paths\n",
"out_data_file = \"../../output/preprocess/Lactose_Intolerance/GSE136395.csv\"\n",
"out_gene_data_file = \"../../output/preprocess/Lactose_Intolerance/gene_data/GSE136395.csv\"\n",
"out_clinical_data_file = \"../../output/preprocess/Lactose_Intolerance/clinical_data/GSE136395.csv\"\n",
"json_path = \"../../output/preprocess/Lactose_Intolerance/cohort_info.json\"\n"
]
},
{
"cell_type": "markdown",
"id": "e0b2f1e9",
"metadata": {},
"source": [
"### Step 1: Initial Data Loading"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "efdb186f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.424710Z",
"iopub.status.busy": "2025-03-25T07:25:02.424562Z",
"iopub.status.idle": "2025-03-25T07:25:02.602599Z",
"shell.execute_reply": "2025-03-25T07:25:02.602020Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Background Information:\n",
"!Series_title\t\"The effects of a novel oral nutritional supplement as compared to standard care on body composition, physical function and skeletal muscle mRNA expression in Dutch older adults with (or at risk of) undernutrition\"\n",
"!Series_summary\t\"In a randomized controlled trial, 82 older adults (>65y) with (or at risk of) undernutrition (n=82) were randomly allocated to 12 weeks of supplementation with a novel supplement (586 kcal, 22 g protein of which 50% whey and 50% casein, 206 mg ursolic acid, 7 g free BCAAs, 11 µg vitamin D) or standard care (600 kcal, 24g protein of which 100% casein, 4 µg vitamin D). Body weight increased significantly in the 12 weeks, both in the intervention group (+1.6 ± 0.2 kg, p<.0001) and in the standard care group (+1.8 ± 0.2 kg, p<.0001). Gait speed during 4m and 400m tests improved over time in the intervention group, whereas the standard care showed no improvements (time*treatment effects 400m: p=0.038 and 4m: p=0.048). Gene sets related to mitochondrial functioning were strongly upregulated in the participants receiving the intervention product. We showed that a novel oral nutritional supplement improves gait speed in older adults via improvements in mitochondrial functioning.\"\n",
"!Series_overall_design\t\"Microarray analysis was performed on pre- and post-treatment skeletal muscle biopsies (m. vastus lateralis) from undernourished older adults.\"\n",
"Sample Characteristics Dictionary:\n",
"{0: ['sex (female=1, male=0): 1', 'sex (female=1, male=0): 0'], 1: ['subjectid: 202', 'subjectid: 203', 'subjectid: 205', 'subjectid: 211', 'subjectid: 212', 'subjectid: 214', 'subjectid: 215', 'subjectid: 219', 'subjectid: 231', 'subjectid: 238', 'subjectid: 243', 'subjectid: 245', 'subjectid: 250', 'subjectid: 252', 'subjectid: 253', 'subjectid: 258', 'subjectid: 259', 'subjectid: 261', 'subjectid: 264', 'subjectid: 265', 'subjectid: 266'], 2: ['age (yrs): 70', 'age (yrs): 66', 'age (yrs): 74', 'age (yrs): 69', 'age (yrs): 83', 'age (yrs): 5', 'age (yrs): 77', 'age (yrs): 75', 'age (yrs): 72', 'age (yrs): 71', 'age (yrs): 68', 'age (yrs): 80'], 3: ['moment of sampling (pre/post intervention): pre-intervention (at baseline)', 'moment of sampling (pre/post intervention): post-intervention (after 12 wks)'], 4: ['time of sampling (hr: min): 11:35', 'time of sampling (hr: min): 10:40', 'time of sampling (hr: min): 10:55', 'time of sampling (hr: min): 10:25', 'time of sampling (hr: min): 10:30', 'time of sampling (hr: min): 11:45', 'time of sampling (hr: min): 10:20', 'time of sampling (hr: min): 11:40', 'time of sampling (hr: min): 10:44', 'time of sampling (hr: min): 11:15', 'time of sampling (hr: min): 11:20', 'time of sampling (hr: min): 12:40', 'time of sampling (hr: min): 11:25', 'time of sampling (hr: min): 12:20', 'time of sampling (hr: min): 11:30', 'time of sampling (hr: min): 11:06', 'time of sampling (hr: min): 11:23', 'time of sampling (hr: min): 11:10', 'time of sampling (hr: min): 12:25', 'time of sampling (hr: min): 10:35', 'time of sampling (hr: min): 11:50', 'time of sampling (hr: min): 11:00', 'time of sampling (hr: min): 12:50', 'time of sampling (hr: min): 10:05', 'time of sampling (hr: min): 12:03'], 5: ['experimental condition: novel oral nutritional supplement', 'experimental condition: standard-care nutritional supplement'], 6: ['tissue: skeletal muscle'], 7: ['sample type: non-fasted morning sample']}\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": "6836c87d",
"metadata": {},
"source": [
"### Step 2: Dataset Analysis and Clinical Feature Extraction"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "755eb01d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.604576Z",
"iopub.status.busy": "2025-03-25T07:25:02.604427Z",
"iopub.status.idle": "2025-03-25T07:25:02.618040Z",
"shell.execute_reply": "2025-03-25T07:25:02.617548Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Clinical Features Preview:\n",
"{0: [1.0, 70.0, 0.0], 1: [0.0, 66.0, 1.0], 2: [nan, 74.0, nan], 3: [nan, 69.0, nan], 4: [nan, 83.0, nan], 5: [nan, nan, nan], 6: [nan, 77.0, nan], 7: [nan, 75.0, nan], 8: [nan, 72.0, nan], 9: [nan, 71.0, nan], 10: [nan, 68.0, nan], 11: [nan, 80.0, nan], 12: [nan, nan, nan], 13: [nan, nan, nan], 14: [nan, nan, nan], 15: [nan, nan, nan], 16: [nan, nan, nan], 17: [nan, nan, nan], 18: [nan, nan, nan], 19: [nan, nan, nan], 20: [nan, nan, nan], 21: [nan, nan, nan], 22: [nan, nan, nan], 23: [nan, nan, nan], 24: [nan, nan, nan]}\n",
"Clinical features saved to ../../output/preprocess/Lactose_Intolerance/clinical_data/GSE136395.csv\n"
]
}
],
"source": [
"# 1. Gene Expression Data Availability\n",
"# Based on the background information, this study involves \"Microarray analysis\" of skeletal muscle biopsies\n",
"# This indicates gene expression data is likely available\n",
"is_gene_available = True\n",
"\n",
"# 2. Variable Availability and Data Type Conversion\n",
"# 2.1 Data Availability\n",
"\n",
"# For trait - we'll use the \"experimental condition\" as our trait row\n",
"# Row 5 shows two values: 'novel oral nutritional supplement' and 'standard-care nutritional supplement'\n",
"trait_row = 5\n",
"\n",
"# For age - present in row 2\n",
"age_row = 2\n",
"\n",
"# For gender - present in row 0\n",
"gender_row = 0\n",
"\n",
"# 2.2 Data Type Conversion Functions\n",
"\n",
"def convert_trait(value):\n",
" \"\"\"Convert experimental condition to binary: 1 for novel supplement, 0 for standard care\"\"\"\n",
" if not isinstance(value, str):\n",
" return None\n",
" \n",
" value_lower = value.lower()\n",
" if 'novel' in value_lower:\n",
" return 1\n",
" elif 'standard' in value_lower:\n",
" return 0\n",
" else:\n",
" return None\n",
"\n",
"def convert_age(value):\n",
" \"\"\"Convert age to continuous value\"\"\"\n",
" if not isinstance(value, str):\n",
" return None\n",
" \n",
" # Extract the numeric part after the colon\n",
" try:\n",
" # Handle format like \"age (yrs): 70\"\n",
" value_parts = value.split(': ')\n",
" if len(value_parts) > 1:\n",
" age_str = value_parts[1].strip()\n",
" age = float(age_str)\n",
" # There appears to be an error in the data where one age is listed as 5\n",
" # This is likely a typo since all other ages are 65+\n",
" if age < 20: # Assume any age under 20 is an error for older adults\n",
" return None\n",
" return age\n",
" return None\n",
" except (ValueError, IndexError):\n",
" return None\n",
"\n",
"def convert_gender(value):\n",
" \"\"\"Convert gender to binary: 0 for female, 1 for male\"\"\"\n",
" if not isinstance(value, str):\n",
" return None\n",
" \n",
" # The format appears to be \"sex (female=1, male=0): 1\" or \"sex (female=1, male=0): 0\"\n",
" # Note: The original data has female=1, male=0, but we need to convert to female=0, male=1\n",
" try:\n",
" value_parts = value.split(': ')\n",
" if len(value_parts) > 1:\n",
" gender_value = value_parts[1].strip()\n",
" # Since in the data female=1 and male=0, we need to flip these values\n",
" if gender_value == '1': # Female in original data\n",
" return 0\n",
" elif gender_value == '0': # Male in original data\n",
" return 1\n",
" return None\n",
" except (ValueError, IndexError):\n",
" return None\n",
"\n",
"# 3. Save Metadata\n",
"# Trait data is available if trait_row is not None\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",
" # Define clinical_data (assuming it was created in a previous step)\n",
" clinical_data = pd.DataFrame.from_dict(\n",
" {i: values for i, values in \n",
" {0: ['sex (female=1, male=0): 1', 'sex (female=1, male=0): 0'], \n",
" 1: ['subjectid: 202', 'subjectid: 203', 'subjectid: 205', 'subjectid: 211', 'subjectid: 212', 'subjectid: 214', 'subjectid: 215', 'subjectid: 219', 'subjectid: 231', 'subjectid: 238', 'subjectid: 243', 'subjectid: 245', 'subjectid: 250', 'subjectid: 252', 'subjectid: 253', 'subjectid: 258', 'subjectid: 259', 'subjectid: 261', 'subjectid: 264', 'subjectid: 265', 'subjectid: 266'], \n",
" 2: ['age (yrs): 70', 'age (yrs): 66', 'age (yrs): 74', 'age (yrs): 69', 'age (yrs): 83', 'age (yrs): 5', 'age (yrs): 77', 'age (yrs): 75', 'age (yrs): 72', 'age (yrs): 71', 'age (yrs): 68', 'age (yrs): 80'], \n",
" 3: ['moment of sampling (pre/post intervention): pre-intervention (at baseline)', 'moment of sampling (pre/post intervention): post-intervention (after 12 wks)'], \n",
" 4: ['time of sampling (hr: min): 11:35', 'time of sampling (hr: min): 10:40', 'time of sampling (hr: min): 10:55', 'time of sampling (hr: min): 10:25', 'time of sampling (hr: min): 10:30', 'time of sampling (hr: min): 11:45', 'time of sampling (hr: min): 10:20', 'time of sampling (hr: min): 11:40', 'time of sampling (hr: min): 10:44', 'time of sampling (hr: min): 11:15', 'time of sampling (hr: min): 11:20', 'time of sampling (hr: min): 12:40', 'time of sampling (hr: min): 11:25', 'time of sampling (hr: min): 12:20', 'time of sampling (hr: min): 11:30', 'time of sampling (hr: min): 11:06', 'time of sampling (hr: min): 11:23', 'time of sampling (hr: min): 11:10', 'time of sampling (hr: min): 12:25', 'time of sampling (hr: min): 10:35', 'time of sampling (hr: min): 11:50', 'time of sampling (hr: min): 11:00', 'time of sampling (hr: min): 12:50', 'time of sampling (hr: min): 10:05', 'time of sampling (hr: min): 12:03'], \n",
" 5: ['experimental condition: novel oral nutritional supplement', 'experimental condition: standard-care nutritional supplement'], \n",
" 6: ['tissue: skeletal muscle'], \n",
" 7: ['sample type: non-fasted morning sample']}.items()\n",
" }, orient='index')\n",
" \n",
" # Extract clinical features\n",
" clinical_features = 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 extracted features\n",
" preview = preview_df(clinical_features)\n",
" print(\"Clinical Features Preview:\")\n",
" print(preview)\n",
" \n",
" # Save clinical features to CSV\n",
" os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n",
" clinical_features.to_csv(out_clinical_data_file, index=False)\n",
" print(f\"Clinical features saved to {out_clinical_data_file}\")\n"
]
},
{
"cell_type": "markdown",
"id": "df05ca96",
"metadata": {},
"source": [
"### Step 3: Gene Data Extraction"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "92748447",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.619714Z",
"iopub.status.busy": "2025-03-25T07:25:02.619601Z",
"iopub.status.idle": "2025-03-25T07:25:02.881179Z",
"shell.execute_reply": "2025-03-25T07:25:02.880530Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Examining matrix file structure...\n",
"Line 0: !Series_title\t\"The effects of a novel oral nutritional supplement as compared to standard care on body composition, physical function and skeletal muscle mRNA expression in Dutch older adults with (or at risk of) undernutrition\"\n",
"Line 1: !Series_geo_accession\t\"GSE136395\"\n",
"Line 2: !Series_status\t\"Public on Apr 06 2021\"\n",
"Line 3: !Series_submission_date\t\"Aug 27 2019\"\n",
"Line 4: !Series_last_update_date\t\"Apr 09 2021\"\n",
"Line 5: !Series_pubmed_id\t\"33799307\"\n",
"Line 6: !Series_summary\t\"In a randomized controlled trial, 82 older adults (>65y) with (or at risk of) undernutrition (n=82) were randomly allocated to 12 weeks of supplementation with a novel supplement (586 kcal, 22 g protein of which 50% whey and 50% casein, 206 mg ursolic acid, 7 g free BCAAs, 11 µg vitamin D) or standard care (600 kcal, 24g protein of which 100% casein, 4 µg vitamin D). Body weight increased significantly in the 12 weeks, both in the intervention group (+1.6 ± 0.2 kg, p<.0001) and in the standard care group (+1.8 ± 0.2 kg, p<.0001). Gait speed during 4m and 400m tests improved over time in the intervention group, whereas the standard care showed no improvements (time*treatment effects 400m: p=0.038 and 4m: p=0.048). Gene sets related to mitochondrial functioning were strongly upregulated in the participants receiving the intervention product. We showed that a novel oral nutritional supplement improves gait speed in older adults via improvements in mitochondrial functioning.\"\n",
"Line 7: !Series_overall_design\t\"Microarray analysis was performed on pre- and post-treatment skeletal muscle biopsies (m. vastus lateralis) from undernourished older adults.\"\n",
"Line 8: !Series_type\t\"Expression profiling by array\"\n",
"Line 9: !Series_contributor\t\"Pol,,Grootswagers\"\n",
"Found table marker at line 68\n",
"First few lines after marker:\n",
"\"ID_REF\"\t\"GSM4047976\"\t\"GSM4047977\"\t\"GSM4047978\"\t\"GSM4047979\"\t\"GSM4047980\"\t\"GSM4047981\"\t\"GSM4047982\"\t\"GSM4047983\"\t\"GSM4047984\"\t\"GSM4047985\"\t\"GSM4047986\"\t\"GSM4047987\"\t\"GSM4047988\"\t\"GSM4047989\"\t\"GSM4047990\"\t\"GSM4047991\"\t\"GSM4047992\"\t\"GSM4047993\"\t\"GSM4047994\"\t\"GSM4047995\"\t\"GSM4047996\"\t\"GSM4047997\"\t\"GSM4047998\"\t\"GSM4047999\"\t\"GSM4048000\"\t\"GSM4048001\"\t\"GSM4048002\"\t\"GSM4048003\"\t\"GSM4048004\"\t\"GSM4048005\"\t\"GSM4048006\"\t\"GSM4048007\"\t\"GSM4048008\"\t\"GSM4048009\"\t\"GSM4048010\"\t\"GSM4048011\"\t\"GSM4048012\"\t\"GSM4048013\"\t\"GSM4048014\"\t\"GSM4048015\"\t\"GSM4048016\"\t\"GSM4048017\"\n",
"16650001\t0.921870808\t0.530152954\t0.756759146\t0.769807736\t1.549294871\t1.854587189\t0.482116543\t0.8096838\t0.814715919\t0.424478151\t0.545187116\t0.405601513\t0.338633937\t0.932038514\t0.361127267\t0.706791783\t0.690730035\t0.492038615\t0.279776649\t0.708476738\t0.921510422\t0.857943113\t2.20404239\t1.610630362\t2.38311589\t0.401240327\t1.493156353\t0.455290228\t0.245919566\t2.863136988\t0.689221987\t0.921552734\t2.556896369\t1.426723247\t0.486754942\t0.345676909\t0.75955785\t1.184668222\t0.69494521\t1.41305724\t0.783314159\t0.742542268\n",
"16650003\t0.579271708\t0.259648234\t0.862950609\t0.895520471\t0.756204821\t0.672755213\t1.101893268\t0.56911549\t0.665188807\t0.619120599\t1.62086805\t1.459663992\t0.201842233\t0.808168887\t1.074059794\t0.582766165\t1.134588929\t0.873584833\t1.087444902\t0.80137227\t0.709094776\t0.911162052\t1.406933772\t1.69050053\t0.449161543\t0.712137285\t0.291182845\t0.787467947\t0.979618206\t0.823769005\t0.32401978\t0.569892914\t1.116726783\t1.159745387\t1.035858585\t0.685783655\t1.193817216\t0.654209904\t0.41715519\t0.603980944\t0.505372597\t0.954429049\n",
"16650005\t0.671714204\t1.142914973\t2.814022146\t1.641632162\t1.502576615\t1.030709501\t0.506760379\t0.921806801\t2.339047239\t0.539733584\t1.468627896\t1.736970671\t1.253040325\t1.431135704\t2.263758435\t1.204947957\t0.787394062\t1.981787297\t3.07513362\t0.908376151\t1.207305452\t0.551538147\t0.622966489\t1.148700777\t2.344214972\t0.977961197\t1.11317389\t1.094055403\t1.00736021\t1.109094543\t1.13644913\t1.653104258\t1.49590451\t1.818820715\t0.980248101\t0.605065468\t1.383320329\t0.623771101\t1.680298052\t1.465487155\t1.0859718\t1.606663443\n",
"16650007\t0.790475998\t1.151186563\t1.461116264\t0.605458323\t0.844674561\t0.47990631\t0.826873896\t0.989969104\t0.563209452\t0.798079605\t0.476845287\t1.143701546\t1.129649557\t0.443205766\t0.79567626\t0.74155806\t0.365106024\t1.72162047\t0.844435089\t0.679170899\t0.577378544\t0.85610594\t0.453788863\t1.009421575\t1.086660912\t0.627059169\t1.740979467\t0.97993658\t0.232732015\t2.121708035\t1.135186397\t0.587805222\t1.062980704\t1.237155655\t0.312292874\t1.108727651\t1.61861305\t0.496639014\t1.521733987\t0.589513214\t1.095906204\t3.16173481\n",
"Total lines examined: 69\n",
"\n",
"Attempting to extract gene data from matrix file...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Successfully extracted gene data with 53617 rows\n",
"First 20 gene IDs:\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 expression data available: True\n"
]
}
],
"source": [
"# 1. Get the file paths for the SOFT file and matrix file\n",
"soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
"\n",
"# Add diagnostic code to check file content and structure\n",
"print(\"Examining matrix file structure...\")\n",
"with gzip.open(matrix_file, 'rt') as file:\n",
" table_marker_found = False\n",
" lines_read = 0\n",
" for i, line in enumerate(file):\n",
" lines_read += 1\n",
" if '!series_matrix_table_begin' in line:\n",
" table_marker_found = True\n",
" print(f\"Found table marker at line {i}\")\n",
" # Read a few lines after the marker to check data structure\n",
" next_lines = [next(file, \"\").strip() for _ in range(5)]\n",
" print(\"First few lines after marker:\")\n",
" for next_line in next_lines:\n",
" print(next_line)\n",
" break\n",
" if i < 10: # Print first few lines to see file structure\n",
" print(f\"Line {i}: {line.strip()}\")\n",
" if i > 100: # Don't read the entire file\n",
" break\n",
" \n",
" if not table_marker_found:\n",
" print(\"Table marker '!series_matrix_table_begin' not found in first 100 lines\")\n",
" print(f\"Total lines examined: {lines_read}\")\n",
"\n",
"# 2. Try extracting gene expression data from the matrix file again with better diagnostics\n",
"try:\n",
" print(\"\\nAttempting to extract gene data from matrix file...\")\n",
" gene_data = get_genetic_data(matrix_file)\n",
" if gene_data.empty:\n",
" print(\"Extracted gene expression data is empty\")\n",
" is_gene_available = False\n",
" else:\n",
" print(f\"Successfully extracted gene data with {len(gene_data.index)} rows\")\n",
" print(\"First 20 gene IDs:\")\n",
" print(gene_data.index[:20])\n",
" is_gene_available = True\n",
"except Exception as e:\n",
" print(f\"Error extracting gene data: {str(e)}\")\n",
" print(\"This dataset appears to have an empty or malformed gene expression matrix\")\n",
" is_gene_available = False\n",
"\n",
"print(f\"\\nGene expression data available: {is_gene_available}\")\n",
"\n",
"# If data extraction failed, try an alternative approach using pandas directly\n",
"if not is_gene_available:\n",
" print(\"\\nTrying alternative approach to read gene expression data...\")\n",
" try:\n",
" with gzip.open(matrix_file, 'rt') as file:\n",
" # Skip lines until we find the marker\n",
" for line in file:\n",
" if '!series_matrix_table_begin' in line:\n",
" break\n",
" \n",
" # Try to read the data directly with pandas\n",
" gene_data = pd.read_csv(file, sep='\\t', index_col=0)\n",
" \n",
" if not gene_data.empty:\n",
" print(f\"Successfully extracted gene data with alternative method: {gene_data.shape}\")\n",
" print(\"First 20 gene IDs:\")\n",
" print(gene_data.index[:20])\n",
" is_gene_available = True\n",
" else:\n",
" print(\"Alternative extraction method also produced empty data\")\n",
" except Exception as e:\n",
" print(f\"Alternative extraction failed: {str(e)}\")\n"
]
},
{
"cell_type": "markdown",
"id": "ee9a645f",
"metadata": {},
"source": [
"### Step 4: Gene Identifier Review"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0ff606cf",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.882984Z",
"iopub.status.busy": "2025-03-25T07:25:02.882835Z",
"iopub.status.idle": "2025-03-25T07:25:02.885332Z",
"shell.execute_reply": "2025-03-25T07:25:02.884907Z"
}
},
"outputs": [],
"source": [
"# Based on examining the gene identifiers such as '16650001', '16650003', etc., these appear to be \n",
"# probe identifiers from an Illumina microarray platform rather than human gene symbols.\n",
"#\n",
"# These numeric identifiers (starting with 1665...) are typical of Illumina BeadArray probes\n",
"# and will need to be mapped to standard human gene symbols for interpretability and\n",
"# cross-study compatibility.\n",
"\n",
"requires_gene_mapping = True\n"
]
},
{
"cell_type": "markdown",
"id": "5a28551f",
"metadata": {},
"source": [
"### Step 5: Gene Annotation"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "da67be7c",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:02.887127Z",
"iopub.status.busy": "2025-03-25T07:25:02.886982Z",
"iopub.status.idle": "2025-03-25T07:25:11.538798Z",
"shell.execute_reply": "2025-03-25T07:25:11.538121Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting gene annotation data from SOFT file...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Successfully extracted gene annotation data with 2305573 rows\n",
"\n",
"Gene annotation preview (first few rows):\n",
"{'ID': ['16657436', '16657440', '16657445', '16657447', '16657450'], 'probeset_id': ['16657436', '16657440', '16657445', '16657447', '16657450'], 'seqname': ['chr1', 'chr1', 'chr1', 'chr1', 'chr1'], 'strand': ['+', '+', '+', '+', '+'], 'start': ['12190', '29554', '69091', '160446', '317811'], 'stop': ['13639', '31109', '70008', '161525', '328581'], 'total_probes': [25.0, 28.0, 8.0, 13.0, 36.0], 'gene_assignment': ['NR_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 // --- // ---', 'ENST00000473358 // 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', 'NM_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', '---', 'AK302511 // 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'], 'mrna_assignment': ['NR_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', 'ENST00000473358 // ENSEMBL // cdna:known chromosome:GRCh37:1:29554:31097:1 gene:ENSG00000243485 gene_biotype:antisense transcript_biotype:antisense // chr1 // 100 // 71 // 20 // 20 // 0', 'NM_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', 'TCONS_00000119-XLOC_000001 // Rinn lincRNA // linc-OR4F16-10 chr1:+:160445-161525 // chr1 // 100 // 100 // 13 // 13 // 0', 'AK302511 // 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'], 'swissprot': ['NR_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', '---', '---', '---', 'AK302511 // 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'], 'unigene': ['NR_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', '---', 'NM_001005484 // Hs.554500 // --- /// ENST00000335137 // Hs.554500 // ---', '---', 'AK302511 // 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'], 'GO_biological_process': ['---', '---', '---', '---', '---'], 'GO_cellular_component': ['---', '---', 'NM_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', '---', '---'], 'GO_molecular_function': ['---', '---', 'NM_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', '---', '---'], 'pathway': ['---', '---', '---', '---', '---'], 'protein_domains': ['---', '---', 'ENST00000335137 // Pfam // IPR000276 // GPCR, rhodopsin-like, 7TM /// ENST00000335137 // Pfam // IPR019424 // 7TM GPCR, olfactory receptor/chemoreceptor Srsx', '---', '---'], 'crosshyb_type': ['3', '3', '3', '3', '3'], 'category': ['main', 'main', 'main', 'main', 'main'], 'GB_ACC': ['NR_046018', nan, 'NM_001005484', nan, 'AK302511'], 'SPOT_ID': [nan, 'ENST00000473358', nan, 'TCONS_00000119-XLOC_000001', nan]}\n",
"\n",
"Column names in gene annotation data:\n",
"['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",
"\n",
"The dataset contains GenBank accessions (GB_ACC) that could be used for gene mapping.\n",
"Number of rows with GenBank accessions: 20942 out of 2305573\n",
"\n",
"The dataset contains genomic regions (SPOT_ID) that could be used for location-based gene mapping.\n",
"Example SPOT_ID format: nan\n"
]
}
],
"source": [
"# 1. Extract gene annotation data from the SOFT file\n",
"print(\"Extracting gene annotation data from SOFT file...\")\n",
"try:\n",
" # Use the library function to extract gene annotation\n",
" gene_annotation = get_gene_annotation(soft_file)\n",
" print(f\"Successfully extracted gene annotation data with {len(gene_annotation.index)} rows\")\n",
" \n",
" # Preview the annotation DataFrame\n",
" print(\"\\nGene annotation preview (first few rows):\")\n",
" print(preview_df(gene_annotation))\n",
" \n",
" # Show column names to help identify which columns we need for mapping\n",
" print(\"\\nColumn names in gene annotation data:\")\n",
" print(gene_annotation.columns.tolist())\n",
" \n",
" # Check for relevant mapping columns\n",
" if 'GB_ACC' in gene_annotation.columns:\n",
" print(\"\\nThe dataset contains GenBank accessions (GB_ACC) that could be used for gene mapping.\")\n",
" # Count non-null values in GB_ACC column\n",
" non_null_count = gene_annotation['GB_ACC'].count()\n",
" print(f\"Number of rows with GenBank accessions: {non_null_count} out of {len(gene_annotation)}\")\n",
" \n",
" if 'SPOT_ID' in gene_annotation.columns:\n",
" print(\"\\nThe dataset contains genomic regions (SPOT_ID) that could be used for location-based gene mapping.\")\n",
" print(\"Example SPOT_ID format:\", gene_annotation['SPOT_ID'].iloc[0])\n",
" \n",
"except Exception as e:\n",
" print(f\"Error processing gene annotation data: {e}\")\n",
" is_gene_available = False\n"
]
},
{
"cell_type": "markdown",
"id": "834b2630",
"metadata": {},
"source": [
"### Step 6: Gene Identifier Mapping"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a6feaa00",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:11.540768Z",
"iopub.status.busy": "2025-03-25T07:25:11.540634Z",
"iopub.status.idle": "2025-03-25T07:25:14.816605Z",
"shell.execute_reply": "2025-03-25T07:25:14.816220Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Creating gene mapping from probes to gene symbols...\n",
"Generated mapping with 53617 rows\n",
"\n",
"Preview of gene mapping:\n",
"{'ID': ['16657436', '16657440', '16657445', '16657447', '16657450'], 'Gene': ['NR_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 // --- // ---', 'ENST00000473358 // 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', 'NM_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', '---', 'AK302511 // 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']}\n",
"\n",
"Gene data shape before mapping: (53617, 42)\n",
"\n",
"Applying gene mapping to convert probe IDs to gene symbols...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Successfully mapped gene data with 81076 genes\n",
"\n",
"First 20 gene symbols in mapped gene expression data:\n",
"Index(['A-', 'A-2', 'A-52', 'A-E', 'A-I', 'A-II', 'A-IV', 'A-V', 'A0', 'A1',\n",
" 'A1-', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18'],\n",
" dtype='object', name='Gene')\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Gene expression data saved to ../../output/preprocess/Lactose_Intolerance/gene_data/GSE136395.csv\n"
]
}
],
"source": [
"# 1. Identify the relevant columns for gene mapping\n",
"# From examining the gene_annotation and gene_data, we need to map:\n",
"# - The 'ID' column in gene_annotation (which contains probes like '16650001')\n",
"# - To gene symbols found in the 'gene_assignment' column\n",
"\n",
"# Extract IDs and gene_assignment for mapping\n",
"print(\"Creating gene mapping from probes to gene symbols...\")\n",
"prob_col = 'ID' # Column containing probe IDs\n",
"gene_col = 'gene_assignment' # Column containing gene symbols/names\n",
"\n",
"# 2. Get gene mapping dataframe\n",
"gene_mapping = get_gene_mapping(gene_annotation, prob_col, gene_col)\n",
"print(f\"Generated mapping with {len(gene_mapping)} rows\")\n",
"\n",
"# Preview the mapping to verify\n",
"print(\"\\nPreview of gene mapping:\")\n",
"print(preview_df(gene_mapping))\n",
"\n",
"# Verify the gene data before mapping\n",
"print(\"\\nGene data shape before mapping:\", gene_data.shape)\n",
"\n",
"# 3. Convert probe-level measurements to gene expression data\n",
"print(\"\\nApplying gene mapping to convert probe IDs to gene symbols...\")\n",
"gene_data = apply_gene_mapping(gene_data, gene_mapping)\n",
"print(f\"Successfully mapped gene data with {len(gene_data.index)} genes\")\n",
"\n",
"# Show example of gene symbols in the resulting dataframe\n",
"print(\"\\nFirst 20 gene symbols in mapped gene expression data:\")\n",
"print(gene_data.index[:20])\n",
"\n",
"# Save gene expression data to file\n",
"os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n",
"gene_data.to_csv(out_gene_data_file)\n",
"print(f\"\\nGene expression data saved to {out_gene_data_file}\")\n"
]
},
{
"cell_type": "markdown",
"id": "7dd805df",
"metadata": {},
"source": [
"### Step 7: Data Normalization and Linking"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f28814fa",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T07:25:14.818013Z",
"iopub.status.busy": "2025-03-25T07:25:14.817892Z",
"iopub.status.idle": "2025-03-25T07:25:17.398224Z",
"shell.execute_reply": "2025-03-25T07:25:17.397861Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Saving normalized gene data...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Normalized gene data saved to ../../output/preprocess/Lactose_Intolerance/gene_data/GSE136395.csv\n",
"\n",
"Extracting clinical data...\n",
"Clinical data saved to ../../output/preprocess/Lactose_Intolerance/clinical_data/GSE136395.csv\n",
"Clinical data shape: (3, 42)\n",
"Trait information available: False\n",
"\n",
"Linking clinical and genetic data...\n",
"Cannot link data: clinical data is not available\n",
"\n",
"Skipping missing value handling and bias evaluation as linked data is not available\n",
"\n",
"Performing final validation...\n",
"Abnormality detected in the cohort: GSE136395. Preprocessing failed.\n",
"A new JSON file was created at: ../../output/preprocess/Lactose_Intolerance/cohort_info.json\n",
"\n",
"Dataset usability for Lactose_Intolerance association studies: False\n",
"Reason: Dataset does not contain required trait information\n"
]
}
],
"source": [
"# 1. Save the normalized gene expression data from the previous step\n",
"print(\"\\nSaving normalized gene data...\")\n",
"os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n",
"gene_data.to_csv(out_gene_data_file)\n",
"print(f\"Normalized gene data saved to {out_gene_data_file}\")\n",
"\n",
"# 2. Extract clinical data from the matrix file\n",
"print(\"\\nExtracting clinical data...\")\n",
"try:\n",
" # Get the file paths again to make sure we have them\n",
" soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
" \n",
" # Extract background information and clinical data\n",
" background_info, clinical_data = get_background_and_clinical_data(\n",
" matrix_file, \n",
" prefixes_a=['!Series_title', '!Series_summary', '!Series_overall_design'],\n",
" prefixes_b=['!Sample_geo_accession', '!Sample_characteristics_ch1']\n",
" )\n",
" \n",
" # Process clinical data using trait information from Step 2\n",
" trait_row = 1 # Based on analysis in step 2 - group (OW/OB vs NW/MONW)\n",
" gender_row = 0 # Gender data\n",
" age_row = 2 # Age data\n",
" \n",
" # Define conversion functions based on Step 2\n",
" def convert_trait(value):\n",
" \"\"\"Convert trait value (binary: 1 for OW/OB, 0 for NW/MONW)\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract value after colon if present\n",
" if ':' in value:\n",
" value = value.split(':', 1)[1].strip()\n",
" \n",
" if 'OW/OB' in value:\n",
" return 1 # Overweight/Obese is associated with higher LDL cholesterol\n",
" elif 'NW' in value or 'MONW' in value:\n",
" return 0 # Normal weight (includes metabolically obese normal weight)\n",
" else:\n",
" return None\n",
"\n",
" def convert_gender(value):\n",
" \"\"\"Convert gender value to binary (0: female, 1: male)\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract value after colon if present\n",
" if ':' in value:\n",
" value = value.split(':', 1)[1].strip()\n",
" \n",
" # Convert gender\n",
" if value.lower() == 'woman':\n",
" return 0\n",
" elif value.lower() == 'man':\n",
" return 1\n",
" else:\n",
" return None\n",
" \n",
" def convert_age(value):\n",
" \"\"\"Convert age value to float\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract value after colon if present\n",
" if ':' in value:\n",
" value = value.split(':', 1)[1].strip()\n",
" \n",
" try:\n",
" return float(value) # Convert to float for continuous variable\n",
" except:\n",
" return None\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",
" # Save the 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)\n",
" print(f\"Clinical data saved to {out_clinical_data_file}\")\n",
" print(f\"Clinical data shape: {selected_clinical_df.shape}\")\n",
" \n",
" # Check if we have valid trait information\n",
" is_trait_available = trait_row is not None and not selected_clinical_df.loc[trait].isnull().all()\n",
" print(f\"Trait information available: {is_trait_available}\")\n",
" \n",
"except Exception as e:\n",
" print(f\"Error extracting clinical data: {e}\")\n",
" is_trait_available = False\n",
" selected_clinical_df = pd.DataFrame()\n",
"\n",
"# 3. Link clinical and genetic data\n",
"print(\"\\nLinking clinical and genetic data...\")\n",
"try:\n",
" if is_trait_available and not selected_clinical_df.empty:\n",
" # Link clinical and genetic data\n",
" linked_data = geo_link_clinical_genetic_data(selected_clinical_df, gene_data)\n",
" print(f\"Created linked data with {linked_data.shape[0]} samples and {linked_data.shape[1]} features\")\n",
" else:\n",
" print(\"Cannot link data: clinical data is not available\")\n",
" linked_data = pd.DataFrame()\n",
" is_trait_available = False\n",
"except Exception as e:\n",
" print(f\"Error linking clinical and genetic data: {e}\")\n",
" is_trait_available = False\n",
" linked_data = pd.DataFrame()\n",
"\n",
"# 4. Handle missing values in the linked data\n",
"if is_trait_available and not linked_data.empty:\n",
" print(\"\\nHandling missing values...\")\n",
" try:\n",
" # Rename the first column to the trait name for consistency\n",
" if linked_data.columns[0] != trait:\n",
" linked_data = linked_data.rename(columns={linked_data.columns[0]: trait})\n",
" \n",
" linked_data = handle_missing_values(linked_data, trait)\n",
" print(f\"After handling missing values: {linked_data.shape[0]} samples and {linked_data.shape[1]} features\")\n",
" except Exception as e:\n",
" print(f\"Error handling missing values: {e}\")\n",
" \n",
" # 5. Determine whether the trait and demographic features are biased\n",
" print(\"\\nEvaluating feature bias...\")\n",
" try:\n",
" is_biased, linked_data = judge_and_remove_biased_features(linked_data, trait)\n",
" print(f\"Trait bias determination: {is_biased}\")\n",
" print(f\"Final linked data shape: {linked_data.shape[0]} samples and {linked_data.shape[1]} features\")\n",
" except Exception as e:\n",
" print(f\"Error evaluating feature bias: {e}\")\n",
" is_biased = True\n",
"else:\n",
" print(\"\\nSkipping missing value handling and bias evaluation as linked data is not available\")\n",
" is_biased = True\n",
"\n",
"# 6. Validate and save cohort information\n",
"print(\"\\nPerforming final validation...\")\n",
"note = \"\"\n",
"if not is_trait_available:\n",
" note = \"Dataset does not contain required trait information\"\n",
"elif is_biased:\n",
" note = \"Dataset has severe bias in the trait distribution\"\n",
"\n",
"is_usable = validate_and_save_cohort_info(\n",
" is_final=True,\n",
" cohort=cohort,\n",
" info_path=json_path,\n",
" is_gene_available=is_gene_available,\n",
" is_trait_available=is_trait_available,\n",
" is_biased=is_biased,\n",
" df=linked_data,\n",
" note=note\n",
")\n",
"\n",
"# 7. Save the linked data if usable\n",
"print(f\"\\nDataset usability for {trait} association studies: {is_usable}\")\n",
"if is_usable:\n",
" os.makedirs(os.path.dirname(out_data_file), exist_ok=True)\n",
" linked_data.to_csv(out_data_file)\n",
" print(f\"Final linked data saved to {out_data_file}\")\n",
"else:\n",
" if note:\n",
" print(f\"Reason: {note}\")\n",
" else:\n",
" print(\"Dataset does not meet quality criteria for the specified trait\")"
]
}
],
"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
}
|