Skip to content

Commit

Permalink
Merge pull request #1058 from Chunmingl/main
Browse files Browse the repository at this point in the history
minor fix - bring back bayes"_r"
  • Loading branch information
gaow authored Sep 15, 2024
2 parents 647b72a + 8e9a48c commit c545320
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/pecotmr_integration/twas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
" library(IRanges)\n",
" library(R6)\n",
" library(pecotmr)\n",
" \n",
" \n",
" LD_meta_file_path = \"${ld_meta_data}\"\n",
" region_block <- unlist(strsplit(\"${_filtered_region_info[3]}\", \"_\\\\s*\"))\n",
" chrom = as.integer(gsub(\"chr\", \"\", region_block[1]))\n",
Expand Down Expand Up @@ -452,7 +452,7 @@
" weight_dbs <- weight_db_list_update[[gene_db]]\n",
" twas_weights_results[[gene_db]] = generate_twas_db(weight_dbs, contexts=NULL,variable_name_obj=c(\"variant_names\"), susie_obj=\"susie_weights_intermediate\",\n",
" twas_weights_table = \"twas_weights\", min_rsq_threshold = ${rsq_threshold}, \n",
" p_val_cutoff = ${p_value_cutoff}, data_type_table=xqtl_type_table)\n",
" p_val_cutoff = ${p_value_cutoff}, data_type_table=xqtl_type_table, region_name=gene_db)\n",
" if (gene_db %in% names(twas_weights_results)){\n",
" # merge and update export_twas_weights_db for imputable genes, merge if same gene's other context results are available \n",
" if (!is.null(twas_weights_results[[gene_db]])){\n",
Expand All @@ -476,7 +476,7 @@
" twas_contexts <- do.call(rbind, lapply(gwas_studies, function(study){\n",
" twas_rs <- twas_analysis(twas_data_qced[[gene]][[\"weights_qced\"]][[context]], twas_data_qced[[gene]][[\"gwas_qced\"]][[study]], \n",
" twas_data_qced[[gene]][[\"LD\"]], rownames(twas_data_qced[[gene]][[\"weights_qced\"]][[context]]))\n",
" context_table <- data.frame(gwas_study=study, method=gsub( \"_.*$\", \"\",names(twas_rs)), twas_z=find_data(twas_rs, c(2, \"z\")),\n",
" context_table <- data.frame(gwas_study=study, method=sub(\"_[^_]+$\", \"\",names(twas_rs)), twas_z=find_data(twas_rs, c(2, \"z\")),\n",
" twas_pval=find_data(twas_rs, c(2, \"pval\")))\n",
" return(context_table)\n",
" }))\n",
Expand All @@ -497,7 +497,7 @@
" function(file){if(twas_weights_results[[file]]$gene == gene) twas_weights_results[[file]]$cv_performance}))\n",
" # loop through each context for all methods\n",
" gene_table <- do.call(rbind, lapply(contexts, function(context){\n",
" methods <- gsub(\"_.*$\", \"\", names(cv_data[[context]]))\n",
" methods <- sub(\"_[^_]+$\", \"\",names(cv_data[[context]]))\n",
" is_imputable = export_twas_weights_db[[\"${_filtered_region_info[3]}\"]][[gene]][[context]]$is_imputable\n",
" selected_method = export_twas_weights_db[[\"${_filtered_region_info[3]}\"]][[gene]][[context]]$selected_model\n",
" if(is.null(selected_method)) selected_method <- NA\n",
Expand Down

0 comments on commit c545320

Please sign in to comment.