Skip to content

Commit

Permalink
Merge pull request #880 from rfeng2023/my_branch
Browse files Browse the repository at this point in the history
fix original names as tuples
  • Loading branch information
gaow authored Feb 28, 2024
2 parents 34c7ab7 + 8760192 commit 0b911f5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions code/mnm_analysis/mnm_regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,18 @@
" return id_maps\n",
"\n",
"def custom_join(series):\n",
" # This function will join strings, converting items with commas into tuple representations\n",
" def convert_to_tuple_if_comma(item):\n",
" # Initialize an empty list to hold the processed items\n",
" result = []\n",
" for item in series:\n",
" if ',' in item:\n",
" return '(' + item + ')'\n",
" return item\n",
" \n",
" return ','.join([convert_to_tuple_if_comma(item) for item in series])\n",
" # If the item contains commas, split by comma and convert to tuple\n",
" result.append(tuple(item.split(',')))\n",
" else:\n",
" # If the item does not contain commas, add it directly\n",
" result.append(item)\n",
" # Convert the list of items to a tuple and return\n",
" return tuple(result)\n",
"\n",
"\n",
"def process_pheno_files(pheno_files, cov_files, phenotype_names, pheno_id_files, region_ids, preloaded_id_maps):\n",
" '''\n",
Expand Down Expand Up @@ -854,7 +859,7 @@
" }\n",
" res$total_time_elapsed = proc.time() - st\n",
" if (\"${_meta_info[2]}\" != \"${_meta_info[3]}\") {\n",
" region_name = c(\"${_meta_info[2]}\", ${\",\".join(['\"%s\"' % x for x in _meta_info[3].split(',')])})\n",
" region_name = c(\"${_meta_info[2]}\", c(${\",\".join([(\"c('\"+x+\"')\") if isinstance(x, str) else (\"c\"+ str(x)) for x in _meta_info[3]])}))\n",
" } else {\n",
" region_name = \"${_meta_info[2]}\"\n",
" }\n",
Expand Down Expand Up @@ -1388,7 +1393,7 @@
"sos"
]
],
"version": "0.20.1"
"version": "0.24.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0b911f5

Please sign in to comment.