OSCR

Thyroid-stimulating hormone receptor mediates peripheral-central neuroimmune crosstalk in autoimmune thyroid diseases.

Code ↔ Paper

7 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 7 matches · 3 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Genetic association and causal inference ↔ MR.R, lines 876–940 · score 0.71 · inverse variance weighted, MR Egger, IVW, filtering, FDR, IDPs
  2. [2] § Methods › Transcriptome-wide integration ↔ xqtl_muti.R, lines 362–415 · score 0.65 · pp h4, eQTL, posterior, colocalization, tissue, GWAS
  3. [3] § Methods › Bulk and single-cell RNA-seq profiling ↔ brain_code/cellchat.R, the whole file · a weak match · score 0.64 · scRNA, Seurat, gene expression, Disease, cell
  4. [4] § Methods › Transcriptome-wide integration ↔ brain_code/cellchat.R, the whole file · a weak match · score 0.60 · gene expression, aggregating, probabilities, PPI, inference, Pathway
  5. [5] § Results › SMR and colocalization analyses prioritize candidate genes for GD and GO ↔ xqtl_muti.R, lines 135–153 · score 0.59 · cerebellar hemisphere, nucleus accumbens, GTEx, blood, tissues, brain
  6. [6] § Results › SMR and colocalization analyses prioritize candidate genes for GD and GO ↔ xqtl_muti.R, lines 362–415 · score 0.56 · pp h4, eQTL, abf, colocalization, GWAS, genes
  7. [7] § Methods › Structural biological analysis and drug screening ↔ brain_code/structure.R, the whole file · a weak match · score 0.52 · CABS flex, RMSF, residues

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 658 lines · 20 KB · no license · 3 matches

  1. #!/usr/bin/env Rscript
  2. # ============================================================================
  3. # 共定位分析脚本 - 自动检测基因组版本 - 跳过已有结果 - 并行版本
  4. # ============================================================================
  5. # 解决包版本冲突
  6. .libPaths(c(
  7. Sys.getenv("R_LIBS_USER"),
  8. .libPaths()
  9. ))
  10. # 确保使用正确版本的Bioconductor包
  11. if (packageVersion("BiocGenerics") < "0.51.2") {
  12. message("WARNING: BiocGenerics version too old, attempting to update...")
  13. if (!require("BiocManager", quietly = TRUE))
  14. install.packages("BiocManager")
  15. BiocManager::install("BiocGenerics", update = TRUE, ask = FALSE)
  16. }
  17. suppressPackageStartupMessages({
  18. library(data.table)
  19. library(stringr)
  20. library(xQTLbiolinks)
  21. library(dplyr)
  22. library(optparse)
  23. library(xQTLbiolinks)
  24. library(coloc)
  25. library(hyprcoloc)
  26. library(data.table)
  27. library(stringr)
  28. library(R.utils)
  29. library(TxDb.Hsapiens.UCSC.hg38.knownGene)
  30. library(VariantAnnotation)
  31. library(parallel)
  32. library(foreach)
  33. library(doParallel)
  34. })
  35. # ============================================================================
  36. # 命令行参数解析
  37. # ============================================================================
  38. option_list <- list(
  39. make_option(c("-i", "--input_dir"), type="character", default="./vcf/converted_gwas",
  40. help="Directory containing GWAS files (*.smr.txt.gz) [default: %default]"),
  41. make_option(c("-o", "--output_dir"), type="character", default="./coloc_result",
  42. help="Output directory [default: %default]"),
  43. make_option(c("-p", "--pvalue"), type="numeric", default=5e-6,
  44. help="P-value threshold for sentinel SNPs [default: %default]"),
  45. make_option(c("-f", "--force"), action="store_true", default=FALSE,
  46. help="Force rerun even if results exist [default: %default]"),
  47. make_option(c("-n", "--ncores"), type="integer", default=6,
  48. help="Number of parallel cores [default: %default]")
  49. )
  50. opt_parser <- OptionParser(option_list=option_list)
  51. opt <- parse_args(opt_parser)
  52. # 创建输出目录
  53. if (!dir.exists(opt$output_dir)) {
  54. dir.create(opt$output_dir, recursive = TRUE)
  55. }
  56. # ============================================================================
  57. # 基因组版本检测函数(从Python移植)
  58. # ============================================================================
  59. detect_genome_version <- function(gwas_df) {
  60. # hg19/GRCh37 锚点 SNP
  61. anchors <- list(
  62. 'rs3131972' = 752721,
  63. 'rs530212009' = 628154,
  64. 'rs13303240' = 928720,
  65. 'rs12124819' = 1022045,
  66. 'rs41285790' = 2507108,
  67. 'rs12082461' = 10007631,
  68. 'rs12119391' = 20002875,
  69. 'rs2236357' = 50002830,
  70. 'rs12039209' = 100000350,
  71. 'rs10915170' = 200000302
  72. )
  73. # 检查是否有位置信息
  74. if (!all(c("SNP", "pos", "chr") %in% colnames(gwas_df))) {
  75. warning("Missing position columns, assuming GRCh38")
  76. return(list(version = "grch37", grch37To38 = TRUE))
  77. }
  78. # 取前100000行进行检测
  79. sample_size <- min(nrow(gwas_df), 100000)
  80. df_sample <- head(gwas_df, sample_size)
  81. # 找到匹配的锚点SNP
  82. matched <- df_sample[df_sample$SNP %in% names(anchors), ]
  83. if (nrow(matched) == 0) {
  84. message("No anchor SNPs found, assuming GRCh38")
  85. return(list(version = "grch37", grch37To38 = TRUE))
  86. }
  87. # 检查位置匹配度
  88. correct_count <- 0
  89. for (i in 1:nrow(matched)) {
  90. snp_id <- matched$SNP[i]
  91. actual_pos <- as.numeric(matched$pos[i])
  92. expected_pos <- anchors[[snp_id]]
  93. if (!is.na(actual_pos) && abs(actual_pos - expected_pos) < 5) {
  94. correct_count <- correct_count + 1
  95. }
  96. }
  97. # 如果有2个以上锚点匹配,判定为GRCh37
  98. is_grch37 <- correct_count >= 2
  99. if (is_grch37) {
  100. message("Detected genome version: GRCh37/hg19 (", correct_count, " anchors matched)")
  101. message("Will convert to GRCh38 for analysis")
  102. return(list(version = "grch37", grch37To38 = TRUE))
  103. } else {
  104. message("Detected genome version: GRCh38/hg38")
  105. return(list(version = "grch38", grch37To38 = FALSE))
  106. }
  107. }
  108. # ============================================================================
  109. # P值清理函数
  110. # ============================================================================
  111. clean_pval <- function(df, p_col) {
  112. df <- df[!is.na(df[[p_col]]), ]
  113. df[[p_col]][df[[p_col]] <= 0] <- 1e-300
  114. df[[p_col]][df[[p_col]] > 1] <- 1
  115. return(df)
  116. }
  117. # ============================================================================
  118. # GTEx 组织列表
  119. # ============================================================================
  120. tissues <- c(
  121. "Brain - Amygdala",
  122. "Brain - Anterior cingulate cortex (BA24)",
  123. "Brain - Caudate (basal ganglia)",
  124. "Brain - Cerebellar Hemisphere",
  125. "Brain - Cerebellum",
  126. "Brain - Cortex",
  127. "Brain - Frontal Cortex (BA9)",
  128. "Brain - Hippocampus",
  129. "Brain - Hypothalamus",
  130. "Brain - Nucleus accumbens (basal ganglia)",
  131. "Brain - Putamen (basal ganglia)",
  132. "Brain - Spinal cord (cervical c-1)",
  133. "Brain - Substantia nigra",
  134. "Whole Blood"
  135. )
  136. # ============================================================================
  137. # 单个组织的分析函数 (用于并行)
  138. # ============================================================================
  139. process_tissue <- function(tissueSiteDetail, gwasDF, sentinelSnpDF, gwas_name,
  140. output_dir, egenes_cache_dir, force_rerun, max_retries = 10) {
  141. # 清理组织名称用于文件名
  142. tissue_clean <- str_replace_all(tissueSiteDetail, " |\\(|\\)", "_")
  143. out_file <- file.path(
  144. output_dir,
  145. paste0(gwas_name, "_", tissue_clean, "_colocResultSig.RDS")
  146. )
  147. # 检查输出文件是否已存在
  148. if (file.exists(out_file) && !force_rerun) {
  149. return(list(
  150. tissue = tissueSiteDetail,
  151. status = "skipped",
  152. message = "Result file already exists",
  153. n_significant = NA
  154. ))
  155. }
  156. # 使用替代方案: 直接下载整个组织的eGenes,然后手动筛选
  157. traitsAll <- NULL
  158. retry_count <- 0
  159. # 方法1: 尝试使用 xQTLanalyze_getTraits (原始方法)
  160. while (is.null(traitsAll) && retry_count < 10) {
  161. traitsAll <- tryCatch({
  162. options(timeout = 300)
  163. xQTLanalyze_getTraits(
  164. sentinelSnpDF,
  165. detectRange = 1e6,
  166. tissueSiteDetail = tissueSiteDetail
  167. )
  168. }, error = function(e) {
  169. retry_count <<- retry_count + 1
  170. if (retry_count < 3) {
  171. Sys.sleep(10)
  172. }
  173. return(NULL)
  174. })
  175. }
  176. # 方法2: 如果方法1失败,使用 xQTLdownload_egene 下载整个组织的eGenes
  177. if (is.null(traitsAll)) {
  178. # 检查是否有缓存的eGenes数据
  179. egenes_cache_file <- file.path(egenes_cache_dir, paste0(tissue_clean, "_eGenes.RDS"))
  180. eGenesAll <- NULL
  181. if (file.exists(egenes_cache_file)) {
  182. tryCatch({
  183. eGenesAll <- readRDS(egenes_cache_file)
  184. }, error = function(e) {
  185. eGenesAll <<- NULL
  186. })
  187. }
  188. # 如果没有缓存或缓存加载失败,则下载
  189. if (is.null(eGenesAll)) {
  190. retry_count <- 0
  191. while (is.null(eGenesAll) && retry_count < max_retries) {
  192. eGenesAll <- tryCatch({
  193. options(timeout = 300)
  194. xQTLdownload_egene(
  195. tissueSiteDetail = tissueSiteDetail
  196. )
  197. }, error = function(e) {
  198. retry_count <<- retry_count + 1
  199. if (retry_count < max_retries) {
  200. Sys.sleep(10)
  201. }
  202. return(NULL)
  203. })
  204. }
  205. # 保存下载的eGenes数据到缓存
  206. if (!is.null(eGenesAll) && nrow(eGenesAll) > 0) {
  207. tryCatch({
  208. saveRDS(eGenesAll, file = egenes_cache_file)
  209. }, error = function(e) NULL)
  210. }
  211. }
  212. if (is.null(eGenesAll) || nrow(eGenesAll) == 0) {
  213. return(list(
  214. tissue = tissueSiteDetail,
  215. status = "failed",
  216. message = "No eGenes found",
  217. n_significant = 0
  218. ))
  219. }
  220. # 手动筛选: 找到在sentinel SNP附近的基因
  221. traitsAll <- data.table()
  222. detectRange <- 1e6
  223. for (i in 1:nrow(sentinelSnpDF)) {
  224. sentinel_chr <- sentinelSnpDF$chrom[i]
  225. sentinel_pos <- sentinelSnpDF$position[i]
  226. sentinel_snp <- sentinelSnpDF$rsid[i]
  227. # 查询该染色体上该位置附近的基因
  228. genesNearby <- tryCatch({
  229. xQTLquery_gene(
  230. chrom = sentinel_chr,
  231. start = max(1, sentinel_pos - detectRange),
  232. end = sentinel_pos + detectRange
  233. )
  234. }, error = function(e) NULL)
  235. if (!is.null(genesNearby) && nrow(genesNearby) > 0) {
  236. # 找到这些基因中哪些是eGenes
  237. eGenesNearby <- eGenesAll[eGenesAll$gencodeId %in% genesNearby$gencodeId, ]
  238. if (nrow(eGenesNearby) > 0) {
  239. # 构建traitsAll格式的数据
  240. traits_i <- data.table(
  241. rsid = sentinel_snp,
  242. chrom = sentinel_chr,
  243. position = sentinel_pos,
  244. gencodeId = eGenesNearby$gencodeId,
  245. geneSymbol = eGenesNearby$geneSymbol
  246. )
  247. traitsAll <- rbind(traitsAll, traits_i)
  248. }
  249. }
  250. }
  251. if (nrow(traitsAll) == 0) {
  252. return(list(
  253. tissue = tissueSiteDetail,
  254. status = "failed",
  255. message = "No eGenes found near sentinel SNPs",
  256. n_significant = 0
  257. ))
  258. }
  259. }
  260. # 查询基因信息(添加重试机制)
  261. genesAll <- NULL
  262. retry_count <- 0
  263. while (is.null(genesAll) && retry_count < max_retries) {
  264. genesAll <- tryCatch({
  265. options(timeout = 300)
  266. xQTLquery_gene(unique(traitsAll$gencodeId))
  267. }, error = function(e) {
  268. retry_count <<- retry_count + 1
  269. if (retry_count < max_retries) {
  270. Sys.sleep(10)
  271. }
  272. return(NULL)
  273. })
  274. }
  275. if (is.null(genesAll) || nrow(genesAll) == 0) {
  276. return(list(
  277. tissue = tissueSiteDetail,
  278. status = "failed",
  279. message = "No genes found",
  280. n_significant = 0
  281. ))
  282. }
  283. # 初始化结果存储
  284. colocResultAll <- data.table()
  285. # 遍历基因
  286. for (i in 1:nrow(genesAll)) {
  287. gene_id <- genesAll[i]$gencodeId
  288. gene_symbol <- genesAll[i]$geneSymbol
  289. # 下载eQTL数据(添加重试机制,尝试两个数据源)
  290. eQTL_i <- NULL
  291. retry_count <- 0
  292. data_sources <- c("liLab", "eQTL_catalogue")
  293. while (is.null(eQTL_i) && retry_count < max_retries) {
  294. # 交替使用两个数据源
  295. current_source <- data_sources[(retry_count %% 2) + 1]
  296. eQTL_i <- tryCatch({
  297. options(timeout = 300)
  298. xQTLdownload_eqtlAllAsso(
  299. gene_id,
  300. geneType = "gencodeId",
  301. tissueLabel = tissueSiteDetail,
  302. withB37VariantId = FALSE,
  303. data_source = current_source
  304. )
  305. }, error = function(e) {
  306. retry_count <<- retry_count + 1
  307. if (retry_count < max_retries) {
  308. Sys.sleep(3)
  309. }
  310. return(NULL)
  311. })
  312. }
  313. if (is.null(eQTL_i) || nrow(eQTL_i) == 0) {
  314. next
  315. }
  316. # 匹配GWAS和eQTL数据
  317. gwasDF_i <- gwasDF[rsid %in% eQTL_i$rsid]
  318. if (nrow(gwasDF_i) == 0) {
  319. next
  320. }
  321. # 合并位置信息
  322. eQTL_i <- merge(eQTL_i, gwasDF_i[, .(rsid, chrom, position)], by = "rsid")
  323. eQTL_i <- eQTL_i[, .(rsid, chrom, position, pValue, maf, beta, se)]
  324. # 清理P值
  325. gwasDF_i <- clean_pval(gwasDF_i, "pValue")
  326. eQTL_i <- clean_pval(eQTL_i, "pValue")
  327. # 运行共定位分析
  328. colocResult_i <- tryCatch({
  329. xQTLanalyze_coloc_diy(
  330. gwasDF = gwasDF_i,
  331. qtlDF = eQTL_i,
  332. method = "Both"
  333. )
  334. }, error = function(e) NULL)
  335. if (!is.null(colocResult_i) && !is.null(colocResult_i$coloc_Out_summary)) {
  336. colocResult_i <- colocResult_i$coloc_Out_summary
  337. colocResult_i <- cbind(
  338. genesAll[i, c("geneSymbol", "gencodeId")],
  339. colocResult_i
  340. )
  341. colocResultAll <- rbind(colocResultAll, colocResult_i)
  342. }
  343. }
  344. # 过滤显著结果 (PP.H4.abf > 0.75)
  345. n_significant <- 0
  346. if (nrow(colocResultAll) > 0) {
  347. colocResultsig <- colocResultAll[PP.H4.abf>0.75 & hypr_posterior>0.5][order(-PP.H4.abf)]
  348. n_significant <- nrow(colocResultsig)
  349. # 保存结果
  350. saveRDS(colocResultsig, file = out_file)
  351. # 可视化(如果有显著结果) - 在并行中跳过可视化以避免问题
  352. # 可视化部分可以在主进程中单独处理
  353. }
  354. return(list(
  355. tissue = tissueSiteDetail,
  356. status = "completed",
  357. message = paste0("Found ", n_significant, " significant colocalization(s)"),
  358. n_significant = n_significant,
  359. out_file = out_file
  360. ))
  361. }
  362. # ============================================================================
  363. # 主分析流程
  364. # ============================================================================
  365. message(paste0(rep("=", 70), collapse = ""))
  366. message("Starting Colocalization Analysis (Parallel Version)")
  367. message("Input directory: ", opt$input_dir)
  368. message("Output directory: ", opt$output_dir)
  369. message("P-value threshold: ", opt$pvalue)
  370. message("Force rerun: ", opt$force)
  371. message("Number of cores: ", opt$ncores)
  372. message(paste0(rep("=", 70), collapse = ""))
  373. # 设置并行环境
  374. n_cores <- min(opt$ncores, detectCores() - 1, length(tissues))
  375. message("Using ", n_cores, " cores for parallel processing")
  376. # 查找所有GWAS文件
  377. gwas_files <- list.files(opt$input_dir, pattern = "smr\\.txt\\.gz$", full.names = TRUE)
  378. if (length(gwas_files) == 0) {
  379. stop("No files matching pattern '*.smr.txt.gz' found in ", opt$input_dir)
  380. }
  381. message("Found ", length(gwas_files), " GWAS file(s) to process")
  382. # 遍历GWAS文件
  383. for (gwas_path in gwas_files) {
  384. gwas_name <- str_replace(basename(gwas_path), "\\.smr\\.txt\\.gz$", "")
  385. message("\n", paste0(rep("=", 70), collapse = ""))
  386. message("Processing GWAS: ", gwas_name)
  387. message(paste0(rep("=", 70), collapse = ""))
  388. # 读取GWAS文件
  389. gwasDF <- NULL
  390. tryCatch({
  391. gwasDF <- fread(gwas_path,
  392. select = c("SNP", "A1", "A2", "freq", "b", "se", "P", "N", "pos", "chr"))
  393. setDT(gwasDF)
  394. message("Loaded ", nrow(gwasDF), " variants from ", basename(gwas_path))
  395. }, error = function(e) {
  396. message("ERROR: Could not read ", gwas_path, " - ", e$message)
  397. })
  398. if (is.null(gwasDF) || nrow(gwasDF) == 0) {
  399. message("Skipping empty or invalid file")
  400. next
  401. }
  402. # 过滤只保留rs开头的SNP
  403. gwasDF <- gwasDF[str_detect(SNP, "^rs")]
  404. message("After filtering rs SNPs: ", nrow(gwasDF), " variants")
  405. # 检测基因组版本
  406. version_info <- detect_genome_version(gwasDF)
  407. # 准备数据格式
  408. gwasDF <- gwasDF[, .(
  409. rsid = SNP,
  410. chrom = as.character(chr),
  411. position = as.integer(pos),
  412. pValue = as.numeric(P),
  413. AF = as.numeric(freq),
  414. beta = as.numeric(b),
  415. se = as.numeric(se)
  416. )]
  417. # 清理P值
  418. gwasDF <- clean_pval(gwasDF, "pValue")
  419. setindex(gwasDF, rsid)
  420. message("Cleaned data: ", nrow(gwasDF), " variants ready for analysis")
  421. # 获取sentinel SNP
  422. message("Identifying sentinel SNPs...")
  423. sentinelSnpDF <- tryCatch({
  424. xQTLanalyze_getSentinelSnp(
  425. gwasDF,
  426. pValueThreshold = opt$pvalue,
  427. centerRange = 1e6,
  428. genomeVersion = version_info$version,
  429. grch37To38 = version_info$grch37To38
  430. )
  431. }, error = function(e) {
  432. message("ERROR in getSentinelSnp: ", e$message)
  433. return(NULL)
  434. })
  435. if (is.null(sentinelSnpDF) || nrow(sentinelSnpDF) == 0) {
  436. message("No sentinel SNPs found, skipping this GWAS file")
  437. next
  438. }
  439. message("Found ", nrow(sentinelSnpDF), " sentinel SNP(s)")
  440. # 创建eGenes缓存目录
  441. egenes_cache_dir <- file.path(opt$output_dir, "egenes_cache")
  442. if (!dir.exists(egenes_cache_dir)) {
  443. dir.create(egenes_cache_dir, recursive = TRUE)
  444. }
  445. # ========================================================================
  446. # 并行处理组织
  447. # ========================================================================
  448. message("\nStarting parallel processing of ", length(tissues), " tissues...")
  449. # 注册并行后端
  450. cl <- makeCluster(n_cores)
  451. registerDoParallel(cl)
  452. # 导出必要的函数和变量到worker节点
  453. clusterExport(cl, c("clean_pval", "process_tissue"), envir = environment())
  454. # 在每个worker上加载必要的包
  455. clusterEvalQ(cl, {
  456. suppressPackageStartupMessages({
  457. library(data.table)
  458. library(stringr)
  459. library(xQTLbiolinks)
  460. library(coloc)
  461. library(hyprcoloc)
  462. })
  463. })
  464. # 并行执行
  465. results <- foreach(
  466. tissueSiteDetail = tissues,
  467. .combine = rbind,
  468. .packages = c("data.table", "stringr", "xQTLbiolinks", "coloc", "hyprcoloc"),
  469. .errorhandling = "pass"
  470. ) %dopar% {
  471. result <- tryCatch({
  472. process_tissue(
  473. tissueSiteDetail = tissueSiteDetail,
  474. gwasDF = gwasDF,
  475. sentinelSnpDF = sentinelSnpDF,
  476. gwas_name = gwas_name,
  477. output_dir = opt$output_dir,
  478. egenes_cache_dir = egenes_cache_dir,
  479. force_rerun = opt$force
  480. )
  481. }, error = function(e) {
  482. list(
  483. tissue = tissueSiteDetail,
  484. status = "error",
  485. message = as.character(e),
  486. n_significant = NA
  487. )
  488. })
  489. # 转换为data.frame以便combine
  490. as.data.frame(result, stringsAsFactors = FALSE)
  491. }
  492. # 停止并行集群
  493. stopCluster(cl)
  494. # 汇总结果
  495. message("\n", paste0(rep("-", 50), collapse = ""))
  496. message("Summary for GWAS: ", gwas_name)
  497. message(paste0(rep("-", 50), collapse = ""))
  498. if (is.data.frame(results)) {
  499. for (i in 1:nrow(results)) {
  500. status_symbol <- switch(
  501. as.character(results$status[i]),
  502. "completed" = "✓",
  503. "skipped" = "○",
  504. "failed" = "✗",
  505. "error" = "!"
  506. )
  507. message(sprintf(" %s %s: %s",
  508. status_symbol,
  509. results$tissue[i],
  510. results$message[i]))
  511. }
  512. # 统计
  513. n_completed <- sum(results$status == "completed")
  514. n_skipped <- sum(results$status == "skipped")
  515. n_failed <- sum(results$status == "failed")
  516. n_error <- sum(results$status == "error")
  517. total_significant <- sum(as.numeric(results$n_significant), na.rm = TRUE)
  518. message("\nStatistics:")
  519. message(" Completed: ", n_completed)
  520. message(" Skipped (already exists): ", n_skipped)
  521. message(" Failed: ", n_failed)
  522. message(" Errors: ", n_error)
  523. message(" Total significant colocalizations: ", total_significant)
  524. }
  525. # ========================================================================
  526. # 后处理:可视化(可选,在主进程中执行)
  527. # ========================================================================
  528. message("\nGenerating visualizations for significant results...")
  529. for (tissueSiteDetail in tissues) {
  530. tissue_clean <- str_replace_all(tissueSiteDetail, " |\\(|\\)", "_")
  531. out_file <- file.path(
  532. opt$output_dir,
  533. paste0(gwas_name, "_", tissue_clean, "_colocResultSig.RDS")
  534. )
  535. if (file.exists(out_file)) {
  536. colocResultsig <- readRDS(out_file)
  537. if (nrow(colocResultsig) > 0) {
  538. outGenes <- tryCatch({
  539. xQTLquery_gene(colocResultsig$gencodeId)
  540. }, error = function(e) NULL)
  541. if (!is.null(outGenes) && nrow(outGenes) > 0) {
  542. outGenes <- merge(
  543. colocResultsig[, .(gencodeId, PP.H4.abf, candidate_snp, SNP.PP.H4)],
  544. outGenes[, .(geneSymbol, gencodeId, entrezGeneId, geneType)],
  545. by = "gencodeId",
  546. sort = FALSE
  547. )
  548. outGenes <- outGenes[geneType == "protein coding"]
  549. if (nrow(outGenes) > 0) {
  550. tryCatch({
  551. xQTLvisual_genesExp(
  552. outGenes$geneSymbol,
  553. tissueSiteDetail = tissueSiteDetail
  554. )
  555. }, error = function(e) {
  556. message(" Warning: Could not create visualization for ", tissueSiteDetail, " - ", e$message)
  557. })
  558. }
  559. }
  560. }
  561. }
  562. }
  563. } # end GWAS loop
  564. message("\n", paste0(rep("=", 70), collapse = ""))
  565. message("Analysis complete!")
  566. message(paste0(rep("=", 70), collapse = ""))

xqtl_muti.R at commit 8aead22, no license · at the source

Overview

Authors: Haiyang Zhang1,2, Shufan Jiang1,2, Tianyi Zhu1,2, Yuting Liu1,2, Jipeng Li1,2, Sijie Fang1,2, Yinwei Li1,2, Jing Sun1,2, Xinheng He3,4, Chuanjun Tong5,6, Zhengrun Gao7,8, Xianqun Fan1,2, Huifang Zhou1,2
  1. State Key Laboratory of Eye Health, Department of Ophthalmology, Shanghai Ninth People’s Hospital, Shanghai Jiao Tong University School of Medicine,Shanghai, China
  2. Present Address: No. 639, Zhizaoju Road, Shanghai, China
  3. The CAS Key Laboratory of Receptor Research and State Key Laboratory of Drug Research, Shanghai Institute of Materia Medica, Chinese Academy of Sciences,Shanghai, China
  4. Present Address: No. 555, Zuchongzhi Road, Shanghai, China
  5. Institute of Neuroscience, Center for Excellence in Brain Science and Intelligence Technology, Chinese Academy of Sciences,Shanghai, China
  6. Present Address: No. 319, Yueyang Road, Shanghai, China
  7. Songjiang Research Institute, Songjiang Hospital affiliated to Shanghai Jiao Tong University School of Medicine,Shanghai, China
  8. Present Address: No. 746, Zhongshan Middle Road, Shanghai, China
Journal: BMC medicine, volume 24, issue 1, article 404
Dates: received 14 November 2025; accepted 21 May 2026; published online 27 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1186/s12916-026-04957-y · PMID 42204533 · PMCID PMC13397711 · OpenAlex W7162543994
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: genetics / omics (modality), fMRI (modality), histology / microscopy (modality), human (organism), mouse (organism), cellular / molecular (subfield)
Methods: Statistics, fMRI & imaging
Keywords: Graves’ disease, Graves’ orbitopathy, resting-state functional magnetic resonance imaging, genome-wide association studies, multi-omics, thyroid-stimulating hormone receptor
MeSH: Graves Disease*, Graves Ophthalmopathy*, Neuroimmunomodulation*, Receptors, Thyrotropin*, Animals, Brain, Genome-Wide Association Study, Humans, Mice (* major topic)
Topic: Ophthalmology and Eye Disorders (Pathology and Forensic Medicine, Medicine), according to OpenAlex
Funding: National Natural Science Foundation of China (National Science Foundation of China) (No. 82388101, 82501351); Shanghai Science and Technology Committee (20D72270800,22YS1400400,257R1402311); shanghai Key clinical Specialty,Shanghai Eye Disease Research Center (2022ZZ01003); Research Center for Eye Disease and Visual Rehabilitation and the Key Project, YuanshenRehabilitationInstitute, Shanghai Jiao Tong University School of Medicine (yskf1-24-0926-2;yskf2-24-0926-2); Shanghai Municipal Commission of Health and FamilyPlanning Project (2022XD006); Project of Shanghai Jiao Tong University (2030-B23)
Citations: not cited yet (Europe PMC); 104 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.

researcher24k/GWAS_TED

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 8aead22330a30fc306331ec5f1bb53e6ca65b6af, 29 January 2026
Languages: R (4), Jupyter (2), Shell (1)
Size: 9 files, 7 scripts
Software Heritage: not archived
Found in: “Data Availability”
Holds: 2 notebooks
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: data.table (2 files), ggplot2 (2 files), tidyverse (2 files), circlize (1 file), ComplexHeatmap (1 file), ggseg (1 file), Matplotlib (1 file), pandas (1 file), rstatix (1 file), Scanpy (1 file), seaborn (1 file), Seurat (1 file), statannotations (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
7 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 7 scripts, each with its path and the digest of its content;
  • 7 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1186/s12916-026-04957-y.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 13 authors, 6 keywords, 9 MeSH terms, 6 funders, 102 references.

Cite

This paper

Zhang, H., Jiang, S., Zhu, T., Liu, Y., Li, J., Fang, S., Li, Y., Sun, J., He, X., Tong, C., Gao, Z., Fan, X., & Zhou, H. (2026). Thyroid-stimulating hormone receptor mediates peripheral-central neuroimmune crosstalk in autoimmune thyroid diseases. BMC medicine, 24(1), 404. https://doi.org/10.1186/s12916-026-04957-y

BibTeX

@article{zhang2026thyroid,
author = {Zhang, Haiyang and Jiang, Shufan and Zhu, Tianyi and Liu, Yuting and Li, Jipeng and Fang, Sijie and Li, Yinwei and Sun, Jing and He, Xinheng and Tong, Chuanjun and Gao, Zhengrun and Fan, Xianqun and Zhou, Huifang},
title = {{Thyroid-stimulating hormone receptor mediates peripheral-central neuroimmune crosstalk in autoimmune thyroid diseases}},
journal = {BMC medicine},
year = {2026},
month = may,
volume = {24},
number = {1},
pages = {404},
publisher = {BioMed Central},
issn = {1741-7015},
doi = {10.1186/s12916-026-04957-y},
url = {https://doi.org/10.1186/s12916-026-04957-y},
pmid = {42204533},
pmcid = {PMC13397711}
}

RIS

TY - JOUR
AU - Zhang, Haiyang
AU - Jiang, Shufan
AU - Zhu, Tianyi
AU - Liu, Yuting
AU - Li, Jipeng
AU - Fang, Sijie
AU - Li, Yinwei
AU - Sun, Jing
AU - He, Xinheng
AU - Tong, Chuanjun
AU - Gao, Zhengrun
AU - Fan, Xianqun
AU - Zhou, Huifang
TI - Thyroid-stimulating hormone receptor mediates peripheral-central neuroimmune crosstalk in autoimmune thyroid diseases
T2 - BMC medicine
J2 - BMC Med
PY - 2026
DA - 2026/05/27
VL - 24
IS - 1
SP - 404
SN - 1741-7015
PB - BioMed Central
DO - 10.1186/s12916-026-04957-y
UR - https://doi.org/10.1186/s12916-026-04957-y
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s12916-026-04957-y",
"type": "article-journal",
"title": "Thyroid-stimulating hormone receptor mediates peripheral-central neuroimmune crosstalk in autoimmune thyroid diseases",
"container-title": "BMC medicine",
"author": [
{
"family": "Zhang",
"given": "Haiyang"
},
{
"family": "Jiang",
"given": "Shufan"
},
{
"family": "Zhu",
"given": "Tianyi"
},
{
"family": "Liu",
"given": "Yuting"
},
{
"family": "Li",
"given": "Jipeng"
},
{
"family": "Fang",
"given": "Sijie"
},
{
"family": "Li",
"given": "Yinwei"
},
{
"family": "Sun",
"given": "Jing"
},
{
"family": "He",
"given": "Xinheng"
},
{
"family": "Tong",
"given": "Chuanjun"
},
{
"family": "Gao",
"given": "Zhengrun"
},
{
"family": "Fan",
"given": "Xianqun"
},
{
"family": "Zhou",
"given": "Huifang"
}
],
"container-title-short": "BMC Med",
"volume": "24",
"issue": "1",
"page": "404",
"DOI": "10.1186/s12916-026-04957-y",
"PMID": "42204533",
"PMCID": "PMC13397711",
"ISSN": "1741-7015",
"publisher": "BioMed Central",
"URL": "https://doi.org/10.1186/s12916-026-04957-y",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
27
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1016/j.cell.2026.05.026 [code]
The critical role of the endogenous immune compartment after CAR T cell therapy in recurrent GBM.
Journal: Cell
In common: statannotations, rstatix, Scanpy, 7 other tools, genetics / omics, 4 references
[2] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: rstatix, circlize, Scanpy, 8 other tools, genetics / omics, mouse, cellular / molecular, 2 references
[3] doi:10.1186/s13059-026-04177-w [code]
Genomic sequence evolution underlying human neocortical interareal diversification.
Journal: Genome biology
In common: rstatix, circlize, Scanpy, 8 other tools, genetics / omics, mouse, cellular / molecular, 1 reference
[4] doi:10.1126/sciadv.aeg3223 [code]
The extreme diversity of retinal amacrine cells has deep evolutionary roots.
Journal: Science advances
In common: rstatix, circlize, Scanpy, 8 other tools, genetics / omics, cellular / molecular, 1 reference
[5] doi:10.1038/s41467-026-71525-6 [code]
Single-nucleus brain transcriptomics reveals microglia dysfunction in multiple system atrophy.
Journal: Nature communications
In common: rstatix, circlize, Scanpy, 7 other tools, genetics / omics, cellular / molecular, 2 references
[6] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: circlize, Scanpy, ComplexHeatmap, 7 other tools, genetics / omics, cellular / molecular, 2 references
[7] doi:10.1038/s41467-026-73007-1 [code]
Single-nucleus epigenomic dysregulation unmasks genetic risk-associated neurodegenerative glia states.
Journal: Nature communications
In common: circlize, Scanpy, ComplexHeatmap, 6 other tools, genetics / omics, cellular / molecular, 3 references
[8] doi:10.1038/s42003-026-10034-0 [code]
Region- and cell type-specific changes in gene expression in the cerebellum after classical fear conditioning.
Journal: Communications biology
In common: rstatix, circlize, Scanpy, 8 other tools, genetics / omics, mouse, cellular / molecular
[9] doi:10.1038/s41467-026-69944-6 [code]
Multi-modal dissection of cell-type specific TDP-43 pathology in the motor cortex.
Journal: Nature communications
In common: circlize, Scanpy, ComplexHeatmap, 6 other tools, genetics / omics, 3 references
[10] doi:10.1038/s41514-026-00391-9 [code]
Region-specific transcriptional signatures of brain aging in the absence of neuropathology at the single-cell level.
Journal: npj aging
In common: circlize, Scanpy, ComplexHeatmap, 7 other tools, histology / microscopy, genetics / omics, cellular / molecular, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.