File size: 43,164 Bytes
d1894e4 |
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 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "a7820204",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:18.902570Z",
"iopub.status.busy": "2025-03-25T05:25:18.902408Z",
"iopub.status.idle": "2025-03-25T05:25:19.071909Z",
"shell.execute_reply": "2025-03-25T05:25:19.071475Z"
}
},
"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 = \"Glucocorticoid_Sensitivity\"\n",
"cohort = \"GSE50012\"\n",
"\n",
"# Input paths\n",
"in_trait_dir = \"../../input/GEO/Glucocorticoid_Sensitivity\"\n",
"in_cohort_dir = \"../../input/GEO/Glucocorticoid_Sensitivity/GSE50012\"\n",
"\n",
"# Output paths\n",
"out_data_file = \"../../output/preprocess/Glucocorticoid_Sensitivity/GSE50012.csv\"\n",
"out_gene_data_file = \"../../output/preprocess/Glucocorticoid_Sensitivity/gene_data/GSE50012.csv\"\n",
"out_clinical_data_file = \"../../output/preprocess/Glucocorticoid_Sensitivity/clinical_data/GSE50012.csv\"\n",
"json_path = \"../../output/preprocess/Glucocorticoid_Sensitivity/cohort_info.json\"\n"
]
},
{
"cell_type": "markdown",
"id": "a5aba0f6",
"metadata": {},
"source": [
"### Step 1: Initial Data Loading"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "5bc4aa1f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:19.073509Z",
"iopub.status.busy": "2025-03-25T05:25:19.073355Z",
"iopub.status.idle": "2025-03-25T05:25:19.327189Z",
"shell.execute_reply": "2025-03-25T05:25:19.326704Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Background Information:\n",
"!Series_title\t\"Comparison of cellular and transcriptional responses to 1,25-dihydroxyvitamin D3 and glucocorticoids in peripheral blood mononuclear cells\"\n",
"!Series_summary\t\"Glucocorticoids (GC) and 1,25-dihydroxyvitamin D3 (1,25(OH)2 D3) are steroid hormones with anti-inflammatory properties with enhanced effects when combined. We previously showed that transcriptional response to GCs was correlated with inter-individual and inter-ethnic cellular response. Here, we profiled cellular and transcriptional responses to 1,25(OH)2 D3 from the same donors. We studied cellular response to combined treatment with GCs and 1,25(OH)2 D3 in a subset of individuals least responsive to GCs. We found that combination treatment had significantly greater inhibition of proliferation than with either steroid hormone alone. Overlapping differentially expressed (DE) genes between the two hormones were enriched for adaptive and innate immune processes. Non-overlapping differentially expressed genes with 1,25(OH)2 D3 treatment were enriched for pathways involving the electron transport chain, while with GC treatment, non-overlapping genes were enriched for RNA-related processes. These results suggest that 1,25(OH)2 D3 enhances GC anti-inflammatory properties through a number of shared and non-shared transcriptionally-mediated pathways.\"\n",
"!Series_overall_design\t\"Total RNA was obtained from aliquots of peripheral blood mononuclear cells treated with 1,25-dihydroxyvitamin D3 (1,25(OH)2 D3) for 8 and 24 hours. These data were analyzed together with previously published data from expression analysis of PBMC aliquots collected in parallel to these and treated with dexamethasone or vehicle (EtOH).\"\n",
"Sample Characteristics Dictionary:\n",
"{0: ['cell type: peripheral blood mononuclear cells', 'population: African-American', 'population: European-American'], 1: ['population: African-American', 'population: European-American', 'treatment: 1,25-dihydroxyvitamin D'], 2: ['treatment: dexamethasone', 'treatment: vehicle (EtOH)', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 18.89', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 29.99', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 22.84', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 59.62', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 47.72', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 3.43', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 11.97', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 31.77', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 84.49', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 27.58', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): -48.98', 'in vitro lymphocyte vitd sensitivity (lgs - %inhibition by vitd): 39.98'], 3: ['in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 89.43486', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 95.88507', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 95.22036', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 92.86704', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 93.71633', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 96.76962', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 88.55031', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 90.09957', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 94.17097', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 86.97089', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 98.34904', 'in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex): 91.14896', 'duration of treatment (hours): 8', 'duration of treatment (hours): 24'], 4: ['duration of treatment (hours): 8', 'duration of treatment (hours): 24', 'gender: female', 'gender: male'], 5: ['gender: female', 'gender: male', 'age (years): 44.15', 'age (years): 24.72', 'age (years): 32.38', 'age (years): 20.38', 'age (years): 21.24', 'age (years): 22.54', 'age (years): 26.14', 'age (years): 21.56', 'age (years): 21.99', 'age (years): 26.77', 'age (years): 23.59', 'age (years): 23.48'], 6: ['age (years): 44.15342', 'age (years): 24.72329', 'age (years): 32.37808', 'age (years): 20.38082', 'age (years): 21.2411', 'age (years): 22.54247', 'age (years): 26.13973', 'age (years): 21.5616', 'age (years): 21.9863', 'age (years): 26.76712', 'age (years): 23.59452', 'age (years): 23.47945', nan]}\n"
]
}
],
"source": [
"from tools.preprocess import *\n",
"# 1. Identify the paths to the SOFT file and the matrix file\n",
"soft_file, matrix_file = geo_get_relevant_filepaths(in_cohort_dir)\n",
"\n",
"# 2. Read the matrix file to obtain background information and sample characteristics data\n",
"background_prefixes = ['!Series_title', '!Series_summary', '!Series_overall_design']\n",
"clinical_prefixes = ['!Sample_geo_accession', '!Sample_characteristics_ch1']\n",
"background_info, clinical_data = get_background_and_clinical_data(matrix_file, background_prefixes, clinical_prefixes)\n",
"\n",
"# 3. Obtain the sample characteristics dictionary from the clinical dataframe\n",
"sample_characteristics_dict = get_unique_values_by_row(clinical_data)\n",
"\n",
"# 4. Explicitly print out all the background information and the sample characteristics dictionary\n",
"print(\"Background Information:\")\n",
"print(background_info)\n",
"print(\"Sample Characteristics Dictionary:\")\n",
"print(sample_characteristics_dict)\n"
]
},
{
"cell_type": "markdown",
"id": "c387f908",
"metadata": {},
"source": [
"### Step 2: Dataset Analysis and Clinical Feature Extraction"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "994012b8",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:19.328636Z",
"iopub.status.busy": "2025-03-25T05:25:19.328515Z",
"iopub.status.idle": "2025-03-25T05:25:19.344200Z",
"shell.execute_reply": "2025-03-25T05:25:19.343885Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Preview of selected clinical features:\n",
"{'GSM832137': [89.43486, nan, nan], 'GSM832138': [89.43486, nan, nan], 'GSM832139': [89.43486, nan, nan], 'GSM832140': [89.43486, nan, nan], 'GSM832141': [95.88507, nan, nan], 'GSM832142': [95.88507, nan, nan], 'GSM832143': [95.88507, nan, nan], 'GSM832144': [95.88507, nan, nan], 'GSM832145': [95.22036, nan, nan], 'GSM832146': [95.22036, nan, nan], 'GSM832147': [95.22036, nan, nan], 'GSM832148': [95.22036, nan, nan], 'GSM832149': [92.86704, nan, nan], 'GSM832150': [92.86704, nan, nan], 'GSM832151': [92.86704, nan, nan], 'GSM832152': [92.86704, nan, nan], 'GSM832153': [93.71633, nan, nan], 'GSM832154': [93.71633, nan, nan], 'GSM832155': [93.71633, nan, nan], 'GSM832156': [93.71633, nan, nan], 'GSM832157': [96.76962, nan, nan], 'GSM832158': [96.76962, nan, nan], 'GSM832159': [96.76962, nan, nan], 'GSM832160': [96.76962, nan, nan], 'GSM832161': [88.55031, nan, nan], 'GSM832162': [88.55031, nan, nan], 'GSM832163': [88.55031, nan, nan], 'GSM832164': [88.55031, nan, nan], 'GSM832165': [90.09957, nan, nan], 'GSM832166': [90.09957, nan, nan], 'GSM832167': [90.09957, nan, nan], 'GSM832168': [90.09957, nan, nan], 'GSM832169': [94.17097, nan, nan], 'GSM832170': [94.17097, nan, nan], 'GSM832171': [94.17097, nan, nan], 'GSM832172': [94.17097, nan, nan], 'GSM832173': [86.97089, nan, nan], 'GSM832174': [86.97089, nan, nan], 'GSM832175': [86.97089, nan, nan], 'GSM832176': [86.97089, nan, nan], 'GSM832177': [98.34904, nan, nan], 'GSM832178': [98.34904, nan, nan], 'GSM832179': [98.34904, nan, nan], 'GSM832180': [98.34904, nan, nan], 'GSM832181': [91.14896, nan, nan], 'GSM832182': [91.14896, nan, nan], 'GSM832183': [91.14896, nan, nan], 'GSM832184': [91.14896, nan, nan], 'GSM1212354': [8.0, 44.15, 0.0], 'GSM1212355': [24.0, 44.15, 0.0], 'GSM1212356': [8.0, 24.72, 0.0], 'GSM1212357': [24.0, 24.72, 0.0], 'GSM1212358': [8.0, 32.38, 1.0], 'GSM1212359': [24.0, 32.38, 1.0], 'GSM1212360': [8.0, 20.38, 0.0], 'GSM1212361': [24.0, 20.38, 0.0], 'GSM1212362': [8.0, 21.24, 0.0], 'GSM1212363': [24.0, 21.24, 0.0], 'GSM1212364': [8.0, 22.54, 0.0], 'GSM1212365': [24.0, 22.54, 0.0], 'GSM1212366': [24.0, 26.14, 1.0], 'GSM1212367': [8.0, 26.14, 1.0], 'GSM1212368': [24.0, 21.56, 1.0], 'GSM1212369': [8.0, 21.56, 1.0], 'GSM1212370': [24.0, 21.99, 0.0], 'GSM1212371': [8.0, 21.99, 0.0], 'GSM1212372': [24.0, 26.77, 1.0], 'GSM1212373': [8.0, 26.77, 1.0], 'GSM1212374': [24.0, 23.59, 1.0], 'GSM1212375': [8.0, 23.59, 1.0], 'GSM1212376': [24.0, 23.48, 1.0], 'GSM1212377': [8.0, 23.48, 1.0]}\n",
"Clinical data saved to ../../output/preprocess/Glucocorticoid_Sensitivity/clinical_data/GSE50012.csv\n"
]
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import os\n",
"\n",
"# 1. Gene Expression Data Availability\n",
"# Based on the series summary, it mentions transcriptional responses and RNA analysis,\n",
"# which suggests gene expression data is available\n",
"is_gene_available = True\n",
"\n",
"# 2. Variable Availability and Data Type Conversion\n",
"# 2.1 Trait row identification\n",
"# For Glucocorticoid_Sensitivity, looking at row 3 which has \"in vitro lymphocyte gc sensitivity\" \n",
"# This is the appropriate measurement for our trait\n",
"trait_row = 3\n",
"\n",
"# Age data is available in row 5\n",
"age_row = 5\n",
"\n",
"# Gender data is available in row 4\n",
"gender_row = 4\n",
"\n",
"# 2.2 Data Type Conversion functions\n",
"def convert_trait(value):\n",
" \"\"\"Convert glucocorticoid sensitivity values to continuous values.\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract the value after the colon\n",
" if \":\" in value:\n",
" value = value.split(\":\")[1].strip()\n",
" \n",
" # Extract the numeric part from the gc sensitivity value\n",
" if \"in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex)\" in value:\n",
" try:\n",
" return float(value.replace(\"in vitro lymphocyte gc sensitivity (lgs - %inhibition by dex)\", \"\").strip())\n",
" except:\n",
" return None\n",
" \n",
" try:\n",
" return float(value)\n",
" except:\n",
" return None\n",
"\n",
"def convert_age(value):\n",
" \"\"\"Convert age values to continuous values.\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract the value after the colon\n",
" if \":\" in value:\n",
" value = value.split(\":\")[1].strip()\n",
" \n",
" # Extract the numeric part from the age value\n",
" if \"age (years)\" in value:\n",
" try:\n",
" return float(value.replace(\"age (years)\", \"\").strip())\n",
" except:\n",
" return None\n",
" \n",
" try:\n",
" return float(value)\n",
" except:\n",
" return None\n",
"\n",
"def convert_gender(value):\n",
" \"\"\"Convert gender values to binary (0 for female, 1 for male).\"\"\"\n",
" if pd.isna(value):\n",
" return None\n",
" \n",
" # Extract the value after the colon\n",
" if \":\" in value:\n",
" value = value.split(\":\")[1].strip()\n",
" \n",
" # Convert gender to binary\n",
" value = value.lower()\n",
" if \"female\" in value:\n",
" return 0\n",
" elif \"male\" in value:\n",
" return 1\n",
" else:\n",
" return None\n",
"\n",
"# 3. Save Metadata\n",
"# Determine trait data availability\n",
"is_trait_available = trait_row is not None\n",
"\n",
"# Initial filtering and saving metadata\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",
"# Check if clinical data is available (trait_row is not None)\n",
"if trait_row is not None:\n",
" try:\n",
" # Extract clinical features from the clinical_data DataFrame which should be available in the environment\n",
" selected_clinical_df = geo_select_clinical_features(\n",
" clinical_df=clinical_data, # Use the clinical_data variable that should be available\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 dataframe\n",
" preview = preview_df(selected_clinical_df)\n",
" print(\"Preview of selected clinical features:\")\n",
" print(preview)\n",
" \n",
" # Create the output directory if it doesn't exist\n",
" os.makedirs(os.path.dirname(out_clinical_data_file), exist_ok=True)\n",
" \n",
" # Save the dataframe to CSV\n",
" selected_clinical_df.to_csv(out_clinical_data_file)\n",
" print(f\"Clinical data saved to {out_clinical_data_file}\")\n",
" except Exception as e:\n",
" print(f\"Error extracting clinical features: {e}\")\n",
"else:\n",
" print(\"No clinical data available (trait_row is None)\")\n"
]
},
{
"cell_type": "markdown",
"id": "6ec09f9a",
"metadata": {},
"source": [
"### Step 3: Gene Data Extraction"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "063a2c61",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:19.345377Z",
"iopub.status.busy": "2025-03-25T05:25:19.345266Z",
"iopub.status.idle": "2025-03-25T05:25:19.774908Z",
"shell.execute_reply": "2025-03-25T05:25:19.774558Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found data marker at line 70\n",
"Header line: \"ID_REF\"\t\"GSM832137\"\t\"GSM832138\"\t\"GSM832139\"\t\"GSM832140\"\t\"GSM832141\"\t\"GSM832142\"\t\"GSM832143\"\t\"GSM832144\"\t\"GSM832145\"\t\"GSM832146\"\t\"GSM832147\"\t\"GSM832148\"\t\"GSM832149\"\t\"GSM832150\"\t\"GSM832151\"\t\"GSM832152\"\t\"GSM832153\"\t\"GSM832154\"\t\"GSM832155\"\t\"GSM832156\"\t\"GSM832157\"\t\"GSM832158\"\t\"GSM832159\"\t\"GSM832160\"\t\"GSM832161\"\t\"GSM832162\"\t\"GSM832163\"\t\"GSM832164\"\t\"GSM832165\"\t\"GSM832166\"\t\"GSM832167\"\t\"GSM832168\"\t\"GSM832169\"\t\"GSM832170\"\t\"GSM832171\"\t\"GSM832172\"\t\"GSM832173\"\t\"GSM832174\"\t\"GSM832175\"\t\"GSM832176\"\t\"GSM832177\"\t\"GSM832178\"\t\"GSM832179\"\t\"GSM832180\"\t\"GSM832181\"\t\"GSM832182\"\t\"GSM832183\"\t\"GSM832184\"\t\"GSM1212354\"\t\"GSM1212355\"\t\"GSM1212356\"\t\"GSM1212357\"\t\"GSM1212358\"\t\"GSM1212359\"\t\"GSM1212360\"\t\"GSM1212361\"\t\"GSM1212362\"\t\"GSM1212363\"\t\"GSM1212364\"\t\"GSM1212365\"\t\"GSM1212366\"\t\"GSM1212367\"\t\"GSM1212368\"\t\"GSM1212369\"\t\"GSM1212370\"\t\"GSM1212371\"\t\"GSM1212372\"\t\"GSM1212373\"\t\"GSM1212374\"\t\"GSM1212375\"\t\"GSM1212376\"\t\"GSM1212377\"\n",
"First data line: \"ILMN_1343291\"\t14.12073024\t14.1847953\t14.3271103\t14.21074679\t14.35649097\t14.21573196\t14.25949372\t14.26541254\t14.36153392\t14.25490712\t14.28494604\t14.21327393\t14.37099787\t14.37099787\t14.32494472\t14.32079848\t14.26699913\t14.08661628\t14.33650015\t14.33877929\t14.24410318\t14.21573196\t14.34573164\t14.38961689\t14.32959504\t14.31869455\t14.37099787\t14.4243792\t14.31077135\t14.24773914\t14.20496391\t14.29628828\t14.27520624\t14.16802087\t14.22209016\t14.32288942\t14.32079848\t14.29628828\t14.27674846\t14.31077135\t14.20610208\t14.11111632\t14.10822775\t14.40216307\t14.25657841\t14.24534098\t14.21675287\t14.21074679\t14.2520022435986\t14.2024895096374\t14.2849460399787\t14.3937657950042\t14.2767484645838\t14.2317917064486\t14.1943088752250\t14.3979999390661\t14.2654125383898\t14.30720559192\t14.3822498905462\t14.2931971608562\t14.2733919812744\t14.3822498905462\t14.2931971608562\t14.3589008750322\t14.2453409774463\t14.2882495288221\t14.2752062410866\t14.3128310879575\t14.1943088752250\t14.2372610115893\t14.3615339156902\t14.1838257701293\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['ILMN_1343291', 'ILMN_1343295', 'ILMN_1651199', 'ILMN_1651209',\n",
" 'ILMN_1651210', 'ILMN_1651221', 'ILMN_1651228', 'ILMN_1651229',\n",
" 'ILMN_1651230', 'ILMN_1651232', 'ILMN_1651235', 'ILMN_1651236',\n",
" 'ILMN_1651237', 'ILMN_1651238', 'ILMN_1651249', 'ILMN_1651253',\n",
" 'ILMN_1651254', 'ILMN_1651259', 'ILMN_1651260', 'ILMN_1651262'],\n",
" dtype='object', name='ID')\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",
"# 2. First, let's examine the structure of the matrix file to understand its format\n",
"import gzip\n",
"\n",
"# Peek at the first few lines of the file to understand its structure\n",
"with gzip.open(matrix_file, 'rt') as file:\n",
" # Read first 100 lines to find the header structure\n",
" for i, line in enumerate(file):\n",
" if '!series_matrix_table_begin' in line:\n",
" print(f\"Found data marker at line {i}\")\n",
" # Read the next line which should be the header\n",
" header_line = next(file)\n",
" print(f\"Header line: {header_line.strip()}\")\n",
" # And the first data line\n",
" first_data_line = next(file)\n",
" print(f\"First data line: {first_data_line.strip()}\")\n",
" break\n",
" if i > 100: # Limit search to first 100 lines\n",
" print(\"Matrix table marker not found in first 100 lines\")\n",
" break\n",
"\n",
"# 3. Now try to get the genetic data with better error handling\n",
"try:\n",
" gene_data = get_genetic_data(matrix_file)\n",
" print(gene_data.index[:20])\n",
"except KeyError as e:\n",
" print(f\"KeyError: {e}\")\n",
" \n",
" # Alternative approach: manually extract the data\n",
" print(\"\\nTrying alternative approach to read the gene data:\")\n",
" with gzip.open(matrix_file, 'rt') as file:\n",
" # Find the start of the data\n",
" for line in file:\n",
" if '!series_matrix_table_begin' in line:\n",
" break\n",
" \n",
" # Read the headers and data\n",
" import pandas as pd\n",
" df = pd.read_csv(file, sep='\\t', index_col=0)\n",
" print(f\"Column names: {df.columns[:5]}\")\n",
" print(f\"First 20 row IDs: {df.index[:20]}\")\n",
" gene_data = df\n"
]
},
{
"cell_type": "markdown",
"id": "701d3857",
"metadata": {},
"source": [
"### Step 4: Gene Identifier Review"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "58c30aa5",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:19.776232Z",
"iopub.status.busy": "2025-03-25T05:25:19.776106Z",
"iopub.status.idle": "2025-03-25T05:25:19.778298Z",
"shell.execute_reply": "2025-03-25T05:25:19.777990Z"
}
},
"outputs": [],
"source": [
"# These are Illumina probe IDs (starting with \"ILMN_\"), not human gene symbols\n",
"# Illumina probe IDs need to be mapped to official gene symbols for analysis\n",
"\n",
"requires_gene_mapping = True\n"
]
},
{
"cell_type": "markdown",
"id": "ebb1b182",
"metadata": {},
"source": [
"### Step 5: Gene Annotation"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "126f9261",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:19.779507Z",
"iopub.status.busy": "2025-03-25T05:25:19.779400Z",
"iopub.status.idle": "2025-03-25T05:25:20.708672Z",
"shell.execute_reply": "2025-03-25T05:25:20.708326Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Examining SOFT file structure:\n",
"Line 0: ^DATABASE = GeoMiame\n",
"Line 1: !Database_name = Gene Expression Omnibus (GEO)\n",
"Line 2: !Database_institute = NCBI NLM NIH\n",
"Line 3: !Database_web_link = http://www.ncbi.nlm.nih.gov/geo\n",
"Line 4: !Database_email = [email protected]\n",
"Line 5: ^SERIES = GSE50012\n",
"Line 6: !Series_title = Comparison of cellular and transcriptional responses to 1,25-dihydroxyvitamin D3 and glucocorticoids in peripheral blood mononuclear cells\n",
"Line 7: !Series_geo_accession = GSE50012\n",
"Line 8: !Series_status = Public on Aug 21 2013\n",
"Line 9: !Series_submission_date = Aug 20 2013\n",
"Line 10: !Series_last_update_date = Aug 13 2018\n",
"Line 11: !Series_pubmed_id = 24116131\n",
"Line 12: !Series_pubmed_id = 24550213\n",
"Line 13: !Series_summary = Glucocorticoids (GC) and 1,25-dihydroxyvitamin D3 (1,25(OH)2 D3) are steroid hormones with anti-inflammatory properties with enhanced effects when combined. We previously showed that transcriptional response to GCs was correlated with inter-individual and inter-ethnic cellular response. Here, we profiled cellular and transcriptional responses to 1,25(OH)2 D3 from the same donors. We studied cellular response to combined treatment with GCs and 1,25(OH)2 D3 in a subset of individuals least responsive to GCs. We found that combination treatment had significantly greater inhibition of proliferation than with either steroid hormone alone. Overlapping differentially expressed (DE) genes between the two hormones were enriched for adaptive and innate immune processes. Non-overlapping differentially expressed genes with 1,25(OH)2 D3 treatment were enriched for pathways involving the electron transport chain, while with GC treatment, non-overlapping genes were enriched for RNA-related processes. These results suggest that 1,25(OH)2 D3 enhances GC anti-inflammatory properties through a number of shared and non-shared transcriptionally-mediated pathways.\n",
"Line 14: !Series_overall_design = Total RNA was obtained from aliquots of peripheral blood mononuclear cells treated with 1,25-dihydroxyvitamin D3 (1,25(OH)2 D3) for 8 and 24 hours. These data were analyzed together with previously published data from expression analysis of PBMC aliquots collected in parallel to these and treated with dexamethasone or vehicle (EtOH).\n",
"Line 15: !Series_type = Expression profiling by array\n",
"Line 16: !Series_contributor = Sonia,S,Kupfer\n",
"Line 17: !Series_contributor = Joseph,C,Maranville\n",
"Line 18: !Series_contributor = Shaneen,S,Baxter\n",
"Line 19: !Series_contributor = Yong,,Huang\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Gene annotation preview:\n",
"{'ID': ['ILMN_1343048', 'ILMN_1343049', 'ILMN_1343050', 'ILMN_1343052', 'ILMN_1343059'], 'Species': [nan, nan, nan, nan, nan], 'Source': [nan, nan, nan, nan, nan], 'Search_Key': [nan, nan, nan, nan, nan], 'Transcript': [nan, nan, nan, nan, nan], 'ILMN_Gene': [nan, nan, nan, nan, nan], 'Source_Reference_ID': [nan, nan, nan, nan, nan], 'RefSeq_ID': [nan, nan, nan, nan, nan], 'Unigene_ID': [nan, nan, nan, nan, nan], 'Entrez_Gene_ID': [nan, nan, nan, nan, nan], 'GI': [nan, nan, nan, nan, nan], 'Accession': [nan, nan, nan, nan, nan], 'Symbol': ['phage_lambda_genome', 'phage_lambda_genome', 'phage_lambda_genome:low', 'phage_lambda_genome:low', 'thrB'], 'Protein_Product': [nan, nan, nan, nan, 'thrB'], 'Probe_Id': [nan, nan, nan, nan, nan], 'Array_Address_Id': [5090180, 6510136, 7560739, 1450438, 1240647], 'Probe_Type': [nan, nan, nan, nan, nan], 'Probe_Start': [nan, nan, nan, nan, nan], 'SEQUENCE': ['GAATAAAGAACAATCTGCTGATGATCCCTCCGTGGATCTGATTCGTGTAA', 'CCATGTGATACGAGGGCGCGTAGTTTGCATTATCGTTTTTATCGTTTCAA', 'CCGACAGATGTATGTAAGGCCAACGTGCTCAAATCTTCATACAGAAAGAT', 'TCTGTCACTGTCAGGAAAGTGGTAAAACTGCAACTCAATTACTGCAATGC', 'CTTGTGCCTGAGCTGTCAAAAGTAGAGCACGTCGCCGAGATGAAGGGCGC'], 'Chromosome': [nan, nan, nan, nan, nan], 'Probe_Chr_Orientation': [nan, nan, nan, nan, nan], 'Probe_Coordinates': [nan, nan, nan, nan, nan], 'Cytoband': [nan, nan, nan, nan, nan], 'Definition': [nan, nan, nan, nan, nan], 'Ontology_Component': [nan, nan, nan, nan, nan], 'Ontology_Process': [nan, nan, nan, nan, nan], 'Ontology_Function': [nan, nan, nan, nan, nan], 'Synonyms': [nan, nan, nan, nan, nan], 'Obsolete_Probe_Id': [nan, nan, nan, nan, nan], 'GB_ACC': [nan, nan, nan, nan, nan]}\n"
]
}
],
"source": [
"# 1. Let's first examine the structure of the SOFT file before trying to parse it\n",
"import gzip\n",
"\n",
"# Look at the first few lines of the SOFT file to understand its structure\n",
"print(\"Examining SOFT file structure:\")\n",
"try:\n",
" with gzip.open(soft_file, 'rt') as file:\n",
" # Read first 20 lines to understand the file structure\n",
" for i, line in enumerate(file):\n",
" if i < 20:\n",
" print(f\"Line {i}: {line.strip()}\")\n",
" else:\n",
" break\n",
"except Exception as e:\n",
" print(f\"Error reading SOFT file: {e}\")\n",
"\n",
"# 2. Now let's try a more robust approach to extract the gene annotation\n",
"# Instead of using the library function which failed, we'll implement a custom approach\n",
"try:\n",
" # First, look for the platform section which contains gene annotation\n",
" platform_data = []\n",
" with gzip.open(soft_file, 'rt') as file:\n",
" in_platform_section = False\n",
" for line in file:\n",
" if line.startswith('^PLATFORM'):\n",
" in_platform_section = True\n",
" continue\n",
" if in_platform_section and line.startswith('!platform_table_begin'):\n",
" # Next line should be the header\n",
" header = next(file).strip()\n",
" platform_data.append(header)\n",
" # Read until the end of the platform table\n",
" for table_line in file:\n",
" if table_line.startswith('!platform_table_end'):\n",
" break\n",
" platform_data.append(table_line.strip())\n",
" break\n",
" \n",
" # If we found platform data, convert it to a DataFrame\n",
" if platform_data:\n",
" import pandas as pd\n",
" import io\n",
" platform_text = '\\n'.join(platform_data)\n",
" gene_annotation = pd.read_csv(io.StringIO(platform_text), delimiter='\\t', \n",
" low_memory=False, on_bad_lines='skip')\n",
" print(\"\\nGene annotation preview:\")\n",
" print(preview_df(gene_annotation))\n",
" else:\n",
" print(\"Could not find platform table in SOFT file\")\n",
" \n",
" # Try an alternative approach - extract mapping from other sections\n",
" with gzip.open(soft_file, 'rt') as file:\n",
" for line in file:\n",
" if 'ANNOTATION information' in line or 'annotation information' in line:\n",
" print(f\"Found annotation information: {line.strip()}\")\n",
" if line.startswith('!Platform_title') or line.startswith('!platform_title'):\n",
" print(f\"Platform title: {line.strip()}\")\n",
" \n",
"except Exception as e:\n",
" print(f\"Error processing gene annotation: {e}\")\n"
]
},
{
"cell_type": "markdown",
"id": "c32dd89b",
"metadata": {},
"source": [
"### Step 6: Gene Identifier Mapping"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "8bb71788",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:20.710039Z",
"iopub.status.busy": "2025-03-25T05:25:20.709908Z",
"iopub.status.idle": "2025-03-25T05:25:21.950076Z",
"shell.execute_reply": "2025-03-25T05:25:21.949703Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gene mapping dataframe - first 5 rows:\n",
" ID Gene\n",
"0 ILMN_1343048 phage_lambda_genome\n",
"1 ILMN_1343049 phage_lambda_genome\n",
"2 ILMN_1343050 phage_lambda_genome:low\n",
"3 ILMN_1343052 phage_lambda_genome:low\n",
"4 ILMN_1343059 thrB\n",
"Total number of mappings: 44837\n",
"Gene expression data shape after mapping: (21372, 72)\n",
"First 5 gene symbols after mapping:\n",
"Index(['A1BG', 'A1CF', 'A26C3', 'A2BP1', 'A2LD1'], dtype='object', name='Gene')\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gene expression data saved to ../../output/preprocess/Glucocorticoid_Sensitivity/gene_data/GSE50012.csv\n"
]
}
],
"source": [
"# 1. Identify the keys for gene identifiers and gene symbols in the gene annotation\n",
"# From the preview, we can see:\n",
"# - 'ID' column contains the Illumina probe IDs (starting with ILMN_)\n",
"# - 'Symbol' column contains the gene symbols\n",
"\n",
"# 2. Get the gene mapping dataframe\n",
"prob_col = 'ID' # Column containing probe IDs\n",
"gene_col = 'Symbol' # Column containing gene symbols\n",
"\n",
"# Extract the mapping between probe IDs and gene symbols\n",
"mapping_df = get_gene_mapping(gene_annotation, prob_col, gene_col)\n",
"print(f\"Gene mapping dataframe - first 5 rows:\")\n",
"print(mapping_df.head())\n",
"print(f\"Total number of mappings: {len(mapping_df)}\")\n",
"\n",
"# 3. Convert probe-level measurements to gene expression data\n",
"gene_data = apply_gene_mapping(gene_data, mapping_df)\n",
"print(f\"Gene expression data shape after mapping: {gene_data.shape}\")\n",
"print(f\"First 5 gene symbols after mapping:\")\n",
"print(gene_data.index[:5])\n",
"\n",
"# Save the gene expression data to the output 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\"Gene expression data saved to {out_gene_data_file}\")\n"
]
},
{
"cell_type": "markdown",
"id": "d63d10ce",
"metadata": {},
"source": [
"### Step 7: Data Normalization and Linking"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "e2caf44e",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-25T05:25:21.951509Z",
"iopub.status.busy": "2025-03-25T05:25:21.951385Z",
"iopub.status.idle": "2025-03-25T05:25:35.178531Z",
"shell.execute_reply": "2025-03-25T05:25:35.178100Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gene data shape after normalization: (20259, 72)\n",
"Sample gene symbols after normalization: ['A1BG', 'A1BG-AS1', 'A1CF', 'A2M', 'A2ML1', 'A3GALT2', 'A4GALT', 'A4GNT', 'AAA1', 'AAAS']\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gene data saved to ../../output/preprocess/Glucocorticoid_Sensitivity/gene_data/GSE50012.csv\n",
"Clinical data shape: (3, 72)\n",
"Clinical data preview:\n",
" GSM832137 GSM832138 GSM832139 GSM832140 \\\n",
"Glucocorticoid_Sensitivity 89.43486 89.43486 89.43486 89.43486 \n",
"Age NaN NaN NaN NaN \n",
"Gender NaN NaN NaN NaN \n",
"\n",
" GSM832141 GSM832142 GSM832143 GSM832144 \\\n",
"Glucocorticoid_Sensitivity 95.88507 95.88507 95.88507 95.88507 \n",
"Age NaN NaN NaN NaN \n",
"Gender NaN NaN NaN NaN \n",
"\n",
" GSM832145 GSM832146 ... GSM1212368 GSM1212369 \\\n",
"Glucocorticoid_Sensitivity 95.22036 95.22036 ... 24.00 8.00 \n",
"Age NaN NaN ... 21.56 21.56 \n",
"Gender NaN NaN ... 1.00 1.00 \n",
"\n",
" GSM1212370 GSM1212371 GSM1212372 GSM1212373 \\\n",
"Glucocorticoid_Sensitivity 24.00 8.00 24.00 8.00 \n",
"Age 21.99 21.99 26.77 26.77 \n",
"Gender 0.00 0.00 1.00 1.00 \n",
"\n",
" GSM1212374 GSM1212375 GSM1212376 GSM1212377 \n",
"Glucocorticoid_Sensitivity 24.00 8.00 24.00 8.00 \n",
"Age 23.59 23.59 23.48 23.48 \n",
"Gender 1.00 1.00 1.00 1.00 \n",
"\n",
"[3 rows x 72 columns]\n",
"Gene samples: 72\n",
"Clinical samples: 72\n",
"Common samples: 72\n",
"Linked data shape: (72, 20262)\n",
"Linked data preview (first 5 rows, first 5 columns):\n",
" Glucocorticoid_Sensitivity Age Gender A1BG A1BG-AS1\n",
"GSM832137 89.43486 NaN NaN 15.956246 7.895359\n",
"GSM832138 89.43486 NaN NaN 15.847209 7.873267\n",
"GSM832139 89.43486 NaN NaN 15.781695 7.835743\n",
"GSM832140 89.43486 NaN NaN 15.764754 7.877882\n",
"GSM832141 95.88507 NaN NaN 15.795053 7.896896\n",
"\n",
"Missing values before handling:\n",
" Trait (Glucocorticoid_Sensitivity) missing: 0 out of 72\n",
" Genes with >20% missing: 0\n",
" Samples with >5% missing genes: 0\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data shape after handling missing values: (72, 20262)\n",
"Quartiles for 'Glucocorticoid_Sensitivity':\n",
" 25%: 24.0\n",
" 50% (Median): 89.767215\n",
" 75%: 94.17097\n",
"Min: 8.0\n",
"Max: 98.34904\n",
"The distribution of the feature 'Glucocorticoid_Sensitivity' in this dataset is fine.\n",
"\n",
"Quartiles for 'Age':\n",
" 25%: 25.745\n",
" 50% (Median): 25.745\n",
" 75%: 25.745\n",
"Min: 20.38\n",
"Max: 44.15\n",
"The distribution of the feature 'Age' in this dataset is fine.\n",
"\n",
"For the feature 'Gender', the least common label is '1.0' with 12 occurrences. This represents 16.67% of the dataset.\n",
"The distribution of the feature 'Gender' in this dataset is fine.\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Linked data saved to ../../output/preprocess/Glucocorticoid_Sensitivity/GSE50012.csv\n"
]
}
],
"source": [
"# 1. Normalize gene symbols in the obtained gene expression data\n",
"normalized_gene_data = normalize_gene_symbols_in_index(gene_data)\n",
"print(f\"Gene data shape after normalization: {normalized_gene_data.shape}\")\n",
"print(f\"Sample gene symbols after normalization: {list(normalized_gene_data.index[:10])}\")\n",
"\n",
"# Save the normalized gene data\n",
"os.makedirs(os.path.dirname(out_gene_data_file), exist_ok=True)\n",
"normalized_gene_data.to_csv(out_gene_data_file)\n",
"print(f\"Gene data saved to {out_gene_data_file}\")\n",
"\n",
"# 2. Load the previously saved clinical data\n",
"clinical_data = pd.read_csv(out_clinical_data_file, index_col=0)\n",
"print(f\"Clinical data shape: {clinical_data.shape}\")\n",
"print(\"Clinical data preview:\")\n",
"print(clinical_data.head())\n",
"\n",
"# 3. Link clinical and genetic data using proper sample IDs\n",
"# First, transpose gene expression data to have samples as rows\n",
"gene_data_t = normalized_gene_data.T\n",
"\n",
"# The clinical data should have samples as columns - verify sample IDs match\n",
"gene_samples = set(gene_data_t.index)\n",
"clinical_samples = set(clinical_data.columns)\n",
"common_samples = gene_samples.intersection(clinical_samples)\n",
"\n",
"print(f\"Gene samples: {len(gene_samples)}\")\n",
"print(f\"Clinical samples: {len(clinical_samples)}\")\n",
"print(f\"Common samples: {len(common_samples)}\")\n",
"\n",
"# Use the geo_link_clinical_genetic_data function to properly link the data\n",
"linked_data = geo_link_clinical_genetic_data(clinical_data, normalized_gene_data)\n",
"print(f\"Linked data shape: {linked_data.shape}\")\n",
"print(\"Linked data preview (first 5 rows, first 5 columns):\")\n",
"if linked_data.shape[1] >= 5:\n",
" print(linked_data.iloc[:5, :5])\n",
"else:\n",
" print(linked_data.head())\n",
"\n",
"# 4. Handle missing values\n",
"print(\"\\nMissing values before handling:\")\n",
"print(f\" Trait ({trait}) missing: {linked_data[trait].isna().sum()} out of {len(linked_data)}\")\n",
"gene_cols = [col for col in linked_data.columns if col not in [trait, 'Age', 'Gender']]\n",
"if gene_cols:\n",
" missing_genes_pct = linked_data[gene_cols].isna().mean()\n",
" genes_with_high_missing = sum(missing_genes_pct > 0.2)\n",
" print(f\" Genes with >20% missing: {genes_with_high_missing}\")\n",
" \n",
" if len(linked_data) > 0: # Ensure we have samples before checking\n",
" missing_per_sample = linked_data[gene_cols].isna().mean(axis=1)\n",
" samples_with_high_missing = sum(missing_per_sample > 0.05)\n",
" print(f\" Samples with >5% missing genes: {samples_with_high_missing}\")\n",
"\n",
"# Handle missing values\n",
"cleaned_data = handle_missing_values(linked_data, trait)\n",
"print(f\"Data shape after handling missing values: {cleaned_data.shape}\")\n",
"\n",
"# 5. Evaluate bias in trait and demographic features\n",
"trait_biased, cleaned_data = judge_and_remove_biased_features(cleaned_data, trait)\n",
"\n",
"# 6. Final validation and save\n",
"note = \"Dataset contains gene expression data from glucocorticoid sensitivity studies. \"\n",
"if 'Age' in cleaned_data.columns:\n",
" note += \"Age data is available. \"\n",
"if 'Gender' in cleaned_data.columns:\n",
" note += \"Gender data is available. \"\n",
"\n",
"is_gene_available = len(normalized_gene_data) > 0\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=True, \n",
" is_biased=trait_biased, \n",
" df=cleaned_data,\n",
" note=note\n",
")\n",
"\n",
"# 7. Save if usable\n",
"if is_usable and len(cleaned_data) > 0:\n",
" os.makedirs(os.path.dirname(out_data_file), exist_ok=True)\n",
" cleaned_data.to_csv(out_data_file)\n",
" print(f\"Linked data saved to {out_data_file}\")\n",
"else:\n",
" print(\"Data was determined to be unusable or empty and was 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
}
|