OSCR

Sex- and site-specific reference data for size-invariant properties using multi-stack HRpQCT.

Code ↔ Paper

10 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 10 matches
  1. [1] § Materials and methods › Statistical analysis ↔ 01_CODE/src/hrpqct_database/dataclasses_hrpqct.py, lines 409–490 · score 0.95 · trabecular bone volume, cortical porosity, trabecular thickness, trabecular separation, Tb.vBMD, Tot.vBMD
  2. [2] § Materials and methods › Statistical analysis ↔ 01_CODE/src/hrpqct_database/db_converter.py, lines 98–157 · score 0.94 · Tot.Ar, cortical porosity, trabecular thickness, trabecular separation, Tb.vBMD, trabecular bone volume
  3. [3] § Materials and methods › Cohort ↔ 03_EVALUATION/01_demographics/frax.R, lines 59–137 · score 0.80 · hip fracture risk, major osteoporotic, demographics, Mann, Whitney, Wilcoxon
  4. [4] § Results › Descriptive statistics ↔ 03_EVALUATION/03_correlation-matrix/correlation-matrix-database.ipynb, lines 580–668 · score 0.73 · Tb.vBMD, tb da, ct po, Tot.vBMD, tb sp, matrix
  5. [5] § Results › Descriptive statistics ↔ 03_EVALUATION/03_correlation-matrix/correlation-matrix-database.ipynb, lines 279–396 · score 0.68 · Rel.Ct.Th, tb sp, Tot.vBMD, ct po, Ct.vBMD, FN
  6. [6] § Results › Descriptive statistics ↔ 01_CODE/src/hrpqct_database/dataclasses_hrpqct.py, lines 409–490 · score 0.67 · trabecular bone volume, trabecular thickness, trabecular separation, Tb.vBMD, tb sp, tb bv
  7. [7] § Results › Descriptive statistics ↔ 01_CODE/src/hrpqct_database/db_converter.py, lines 1330–1385 · score 0.66 · trabecular thickness, trabecular separation, Tb.vBMD, trabecular bone volume, tb sp, tb bv
  8. [8] § Results › Radar plots ↔ 01_CODE/src/hrpqct_database/statistics_hrpqct.py, lines 494–528 · score 0.64 · Rel.Ct.Th, tb da, Tot.vBMD, Ct.vBMD, tb bv, app
  9. [9] § Results › Descriptive statistics ↔ 03_EVALUATION/04_rate-change/descriptive_statistics_paper.ipynb, lines 310–364 · score 0.63 · tb sp, Tot.vBMD, ct po, Ct.vBMD, app, male
  10. [10] § Results › Radar plots ↔ 03_EVALUATION/03_correlation-matrix/correlation-matrix-database.ipynb, lines 580–668 · score 0.63 · Rel.Ct.Th, tb da, Tot.vBMD, Ct.vBMD, tb bv, radar

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

Jupyter notebook · 671 lines · 22 KB · GPL-3.0 · 3 matches

  1. # %% [markdown]
  2. # ### HR-pQCT parameters: correlation matrices
  3. #
  4. # Author: Simone Poncioni, MSB
  5. #
  6. # Date: 31.03.2025
  7. #
  8. # Data: HR-pQCT database of the University of Bern, Switzerland
  9. # %%
  10. # Create a user library directory if it doesn't exist
  11. user_lib <- "~/R/library"
  12. dir.create(user_lib, recursive = TRUE, showWarnings = FALSE)
  13. # Tell R to use this directory for new packages
  14. .libPaths(c(user_lib, .libPaths()))
  15. # Function to safely install and load packages
  16. install_and_load <- function(pkg) {
  17. if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
  18. install.packages(pkg, lib = user_lib)
  19. library(pkg, character.only = TRUE)
  20. }
  21. }
  22. # Install and load all required packages
  23. pkgs <- c("Hmisc", "corrplot", "ggplot2", "RColorBrewer",
  24. "pdftools", "png", "IRdisplay", "magick", "paletteer")
  25. # Apply the function to each package
  26. invisible(sapply(pkgs, install_and_load))
  27. # %%
  28. # Filtering, correlation, and plotting functions
  29. # Code ideas from:
  30. # https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html
  31. # https://www.sthda.com/english/wiki/visualize-correlation-matrix-using-correlogram
  32. filter_dataframe <- function(df, keeps, drops_c) {
  33. df_filtered <- df[, grepl(keeps, names(df))]
  34. df_filtered <- df_filtered[, colSums(is.na(df_filtered)) < nrow(df_filtered)]
  35. drops_c <- paste(drops_f, drops_specific, sep = "|")
  36. drops <- grep(drops_c, names(df_filtered), value = TRUE)
  37. df_filtered <- df_filtered[, !(names(df_filtered) %in% drops)]
  38. df_filtered <- na.omit(df_filtered)
  39. return(df_filtered)
  40. }
  41. correlation_p_matrix <- function(mat, ...) {
  42. mat <- as.matrix(mat)
  43. n <- ncol(mat)
  44. p.mat <- matrix(NA, n, n)
  45. diag(p.mat) <- 0
  46. for (i in 1:(n - 1)) {
  47. for (j in (i + 1):n) {
  48. tmp <- cor.test(mat[, i], mat[, j], alternative="two.sided", method="pearson", ...)
  49. p.mat[i, j] <- p.mat[j, i] <- tmp$p.value
  50. }
  51. }
  52. colnames(p.mat) <- rownames(p.mat) <- colnames(mat)
  53. return(p.mat)
  54. }
  55. # %%
  56. generate_corrplot <- function(df, filename, plot_title, basepath) {
  57. df_filtered <- filter_dataframe(df, keeps, drops_c)
  58. # Split all column names before '[' and take the first part
  59. colnames(df_filtered) <- sub("\\[.*", "", colnames(df_filtered))
  60. corrmatrix <- cor(as.matrix(df_filtered))
  61. p.mat <- correlation_p_matrix(df_filtered)
  62. # Clean column names by removing "Tibia: " prefix
  63. cleaned_colnames <- gsub("Tibia: ", "", colnames(corrmatrix))
  64. colnames(corrmatrix) <- cleaned_colnames
  65. rownames(corrmatrix) <- cleaned_colnames
  66. colnames(p.mat) <- cleaned_colnames
  67. rownames(p.mat) <- cleaned_colnames
  68. # print p.mat
  69. print.char.matrix(p.mat, quote = FALSE)
  70. fname <- file.path(basepath, filename)
  71. pdf(file = fname, width = 12, height = 12)
  72. # Reduce bottom margin (first value in mar)
  73. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  74. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  75. col <- colorRampPalette(pal_colors)
  76. corrplot(corrmatrix, method = "color", col = col(200),
  77. type = "upper", order = "AOE",
  78. addCoef.col = "black", # Color of the p-values
  79. number.font = 1, # Use normal font for p-values
  80. # Increase text sizes
  81. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  82. cl.cex = 1.25, # Larger color legend text
  83. number.cex = 1.25, # Larger correlation coefficients
  84. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  85. diag = FALSE,
  86. # Fill more of the plot area
  87. mar = c(0, 0, 0, 0), # Remove internal margins in corrplot
  88. # Change color legend position to right side to save vertical space
  89. cl.pos = "r",
  90. # Reduce color legend ratio
  91. cl.ratio = 0.2,
  92. cl.align = "c" # Center the color legend
  93. )
  94. # Larger plot title positioned closer to the top of the plot
  95. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  96. dev.off()
  97. png_path <- sub(".pdf$", ".png", fname)
  98. image <- image_read(fname)
  99. image_write(image, path = png_path, format = "png")
  100. display_png(file = png_path)
  101. }
  102. # %%
  103. # Import dataframe
  104. # df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_2025-01-28.csv', check.names = FALSE)
  105. df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_expanded_2025-06-16_16-18.csv', check.names = FALSE)
  106. # Remove non-numeric columns
  107. df_numeric <- df[sapply(df, is.numeric)]
  108. # %%
  109. # General settings
  110. basepath = "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/03_correlation-matrix"
  111. drops_f = "Measurement number|side|Time difference Frax & HRpQCT \\[days\\]"
  112. # %%
  113. # Tibia: Cortical parameters
  114. drops_specific = "Radius|Tb."
  115. keeps = "Tibia|Ct..\\."
  116. filename = "tibia_cort_correlation_matrix.pdf"
  117. plot_title = "Tibia: Cortical parameters (p<0.005)"
  118. generate_corrplot(df, filename, plot_title, basepath)
  119. # %%
  120. # Tibia: Trabecular parameters
  121. drops_specific = "Radius|Ct."
  122. keeps = "Tibia|Tb..\\."
  123. filename = "tibia_trab_correlation_matrix.pdf"
  124. plot_title = "Tibia: Trabecular parameters (p<0.005)"
  125. generate_corrplot(df, filename, plot_title, basepath)
  126. # %%
  127. # Radius: Cortical parameters
  128. drops_specific = "Tibia|Tb."
  129. keeps = "Radius|Ct..\\."
  130. filename = "radius_cort_correlation_matrix.pdf"
  131. plot_title = "Radius: Cortical parameters (p<0.005)"
  132. generate_corrplot(df, filename, plot_title, basepath)
  133. # %%
  134. # Radius: Trabecular parameters
  135. drops_specific = "Tibia|Ct."
  136. keeps = "Radius|Tb..\\."
  137. filename = "radius_trab_correlation_matrix.pdf"
  138. plot_title = "Radius: Trabecular parameters (p<0.005)"
  139. generate_corrplot(df, filename, plot_title, basepath)
  140. # %%
  141. # Create correlogram on radar-specific parameters
  142. # Import dataframe
  143. df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_full_2025-01-28.csv', check.names = FALSE)
  144. # Remove non-numeric columns
  145. df_numeric <- df[sapply(df, is.numeric)]
  146. # Create dataframes with specific columns for Radius and Tibia
  147. # Define mapping of original column names to standardized names
  148. radius_cols <- c(
  149. "Radius: Tt.vBMD [mg HA/cmm]" = "Tot.vBMD",
  150. "Radius: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  151. "Radius: Tb.BV/TV [1]" = "Tb.BVTV",
  152. "Radius: Relative cortical thickness [-]" = "Rel.Ct.Th",
  153. "Radius: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  154. "Radius: poncioni_yield_force" = "sigma[y]",
  155. "Radius: Fmax at failure [N]" = "F[max]",
  156. "Radius: Ct.Th [mm]" = "Ct.Th",
  157. "Radius: Ct.Po [1]" = "Ct.Po",
  158. "Radius: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  159. "Radius: Tb.N [1/mm]" = "Tb.N",
  160. "Radius: Tb.Sp [mm]" = "Tb.Sp",
  161. "Radius: Tb.Th [mm]" = "Tb.Th"
  162. )
  163. tibia_cols <- c(
  164. "Tibia: Tt.vBMD [mg HA/cmm]" = "Tot.vBMD",
  165. "Tibia: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  166. "Tibia: Tb.BV/TV [1]" = "Tb.BVTV",
  167. "Tibia: Relative cortical thickness [-]" = "Rel.Ct.Th",
  168. "Tibia: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  169. "Tibia: poncioni_yield_force" = "sigma[y]",
  170. "Tibia: Fmax at failure [N]" = "F[max]",
  171. "Tibia: Ct.Th [mm]" = "Ct.Th",
  172. "Tibia: Ct.Po [1]" = "Ct.Po",
  173. "Tibia: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  174. "Tibia: Tb.N [1/mm]" = "Tb.N",
  175. "Tibia: Tb.Sp [mm]" = "Tb.Sp",
  176. "Tibia: Tb.Th [mm]" = "Tb.Th"
  177. )
  178. # Extract and rename radius data
  179. radius_df <- df[, names(radius_cols)]
  180. colnames(radius_df) <- radius_cols
  181. radius_df$Site <- "Radius"
  182. # Extract and rename tibia data
  183. tibia_df <- df[, names(tibia_cols)]
  184. colnames(tibia_df) <- tibia_cols
  185. tibia_df$Site <- "Tibia"
  186. # Combine the dataframes
  187. combined_df <- rbind(radius_df, tibia_df)
  188. # Remove rows with NA values
  189. combined_df <- na.omit(combined_df)
  190. # General settings
  191. basepath <- "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/correlation-matrix/"
  192. filename <- "hr_pqct_selected_parameters_correlation_matrix.pdf"
  193. plot_title <- "HR-pQCT key parameters correlation (p<0.005)"
  194. # Generate correlogram for the combined dataframe
  195. generate_combined_corrplot <- function(df, filename, plot_title, basepath) {
  196. # Remove the Site column
  197. df_filtered <- df[, !names(df) %in% c("Site")]
  198. # Calculate correlation matrix and p-values
  199. corrmatrix <- cor(as.matrix(df_filtered))
  200. p.mat <- correlation_p_matrix(df_filtered)
  201. # Create the output file
  202. fname <- file.path(basepath, filename)
  203. pdf(file = fname, width = 12, height = 12)
  204. # Set up plot parameters
  205. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  206. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  207. col <- colorRampPalette(pal_colors)
  208. # Create the correlogram
  209. corrplot(corrmatrix, method = "color", col = col(200),
  210. type = "upper", order = "AOE",
  211. addCoef.col = "black",
  212. number.font = 1,
  213. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  214. cl.cex = 1.25,
  215. number.cex = 1.25,
  216. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  217. diag = FALSE,
  218. mar = c(0, 0, 0, 0),
  219. cl.pos = "r",
  220. cl.ratio = 0.2,
  221. cl.align = "c"
  222. )
  223. # Add title
  224. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  225. dev.off()
  226. # Create PNG version for display
  227. png_path <- sub("\\.pdf$", ".png", fname)
  228. image <- image_read(fname)
  229. image_write(image, path = png_path, format = "png")
  230. display_png(file = png_path)
  231. }
  232. # Generate the correlogram with just the selected parameters
  233. generate_combined_corrplot(combined_df, filename, plot_title, basepath)
  234. # %%
  235. # Create correlogram on radar-specific parameters
  236. # Import dataframe
  237. df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_full_2025-01-28.csv', check.names = FALSE)
  238. # only keep study name Nodaratis
  239. df <- df[df$Study == "Nodaratis", ]
  240. # Remove non-numeric columns
  241. df_numeric <- df[sapply(df, is.numeric)]
  242. # Create dataframes with specific columns for Radius and Tibia
  243. # Define mapping of original column names to standardized names
  244. radius_cols <- c(
  245. "Radius: Tt.vBMD [mg HA/cmm]" = "Tot.vBMD",
  246. "Radius: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  247. "Radius: Tb.BV/TV [1]" = "Tb.BVTV",
  248. "Radius: Relative cortical thickness [-]" = "Rel.Ct.Th",
  249. "Radius: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  250. "Radius: poncioni_yield_force" = "sigma[y]",
  251. "Radius: Fmax at failure [N]" = "F[max]",
  252. "Radius: Ct.Th [mm]" = "Ct.Th",
  253. "Radius: Ct.Po [1]" = "Ct.Po",
  254. "Radius: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  255. "Radius: Tb.N [1/mm]" = "Tb.N",
  256. "Radius: Tb.Sp [mm]" = "Tb.Sp",
  257. "Radius: Tb.Th [mm]" = "Tb.Th"
  258. )
  259. tibia_cols <- c(
  260. "Tibia: Tt.vBMD [mg HA/cmm]" = "Tot.vBMD",
  261. "Tibia: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  262. "Tibia: Tb.BV/TV [1]" = "Tb.BVTV",
  263. "Tibia: Relative cortical thickness [-]" = "Rel.Ct.Th",
  264. "Tibia: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  265. "Tibia: poncioni_yield_force" = "sigma[y]",
  266. "Tibia: Fmax at failure [N]" = "F[max]",
  267. "Tibia: Ct.Th [mm]" = "Ct.Th",
  268. "Tibia: Ct.Po [1]" = "Ct.Po",
  269. "Tibia: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  270. "Tibia: Tb.N [1/mm]" = "Tb.N",
  271. "Tibia: Tb.Sp [mm]" = "Tb.Sp",
  272. "Tibia: Tb.Th [mm]" = "Tb.Th"
  273. )
  274. # Extract and rename radius data
  275. radius_df <- df[, names(radius_cols)]
  276. colnames(radius_df) <- radius_cols
  277. radius_df$Site <- "Radius"
  278. # Extract and rename tibia data
  279. tibia_df <- df[, names(tibia_cols)]
  280. colnames(tibia_df) <- tibia_cols
  281. tibia_df$Site <- "Tibia"
  282. # Combine the dataframes
  283. combined_df <- rbind(radius_df, tibia_df)
  284. combined_df$Fn.BMD <- df$`Femoral neck BMD (g/cm2)`
  285. # Remove rows with NA values
  286. combined_df <- na.omit(combined_df)
  287. # General settings
  288. basepath <- "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/correlation-matrix/"
  289. filename <- "hr_pqct_selected_parameters_correlation_matrix_nodaratis.pdf"
  290. plot_title <- "HR-pQCT key parameters correlation (p<0.005)"
  291. # Generate correlogram for the combined dataframe
  292. generate_combined_corrplot <- function(df, filename, plot_title, basepath) {
  293. # Remove the Site column
  294. df_filtered <- df[, !names(df) %in% c("Site")]
  295. # Calculate correlation matrix and p-values
  296. corrmatrix <- cor(as.matrix(df_filtered))
  297. p.mat <- correlation_p_matrix(df_filtered)
  298. # Create the output file
  299. fname <- file.path(basepath, filename)
  300. pdf(file = fname, width = 12, height = 12)
  301. # Set up plot parameters
  302. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  303. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  304. col <- colorRampPalette(pal_colors)
  305. # Create the correlogram
  306. corrplot(corrmatrix, method = "color", col = col(200),
  307. type = "upper", order = "AOE",
  308. addCoef.col = "black",
  309. number.font = 1,
  310. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  311. cl.cex = 1.25,
  312. number.cex = 1.25,
  313. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  314. diag = FALSE,
  315. mar = c(0, 0, 0, 0),
  316. cl.pos = "r",
  317. cl.ratio = 0.2,
  318. cl.align = "c"
  319. )
  320. # Add title
  321. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  322. dev.off()
  323. # Create PNG version for display
  324. png_path <- sub("\\.pdf$", ".png", fname)
  325. image <- image_read(fname)
  326. image_write(image, path = png_path, format = "png")
  327. display_png(file = png_path)
  328. }
  329. # Generate the correlogram with just the selected parameters
  330. generate_combined_corrplot(combined_df, filename, plot_title, basepath)
  331. # %%
  332. ### ONLY EVALUATE THE TIBIA
  333. # Create correlogram on radar-specific parameters (tibia only)
  334. # Import dataframe
  335. df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_full_2025-01-28.csv', check.names = FALSE)
  336. # only keep study name Nodaratis
  337. # df <- df[df$Study == "Nodaratis", ]
  338. # Remove non-numeric columns
  339. df_numeric <- df[sapply(df, is.numeric)]
  340. # Create dataframe with specific columns for Tibia
  341. # Define mapping of original column names to standardized names
  342. tibia_cols <- c(
  343. "Tibia: Tt.vBMD [mg HA/cmm]" = "Tot.vBMD",
  344. "Tibia: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  345. "Tibia: Tb.BV/TV [1]" = "Tb.BVTV",
  346. "Tibia: Relative cortical thickness [-]" = "Rel.Ct.Th",
  347. "Tibia: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  348. "Tibia: poncioni_yield_force" = "sigma[y]",
  349. "Tibia: Fmax at failure [N]" = "F[max]",
  350. "Tibia: Ct.Th [mm]" = "Ct.Th",
  351. "Tibia: Ct.Po [1]" = "Ct.Po",
  352. "Tibia: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  353. "Tibia: Tb.N [1/mm]" = "Tb.N",
  354. "Tibia: Tb.Sp [mm]" = "Tb.Sp",
  355. "Tibia: Tb.Th [mm]" = "Tb.Th"
  356. )
  357. # Extract and rename tibia data
  358. tibia_df <- df[, names(tibia_cols)]
  359. colnames(tibia_df) <- tibia_cols
  360. # Add femoral neck BMD
  361. tibia_df$Fn.BMD <- df$`Femoral neck BMD (g/cm2)`
  362. # Remove rows with NA values
  363. tibia_df <- na.omit(tibia_df)
  364. # General settings
  365. basepath <- "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/correlation-matrix/"
  366. filename <- "hr_pqct_parameters_correlation_matrix_nodaratis_tibia.pdf"
  367. plot_title <- "HR-pQCT parameters correlation (p<0.005)"
  368. # Generate correlogram for the tibia dataframe
  369. generate_tibia_corrplot <- function(df, filename, plot_title, basepath) {
  370. # Calculate correlation matrix and p-values
  371. corrmatrix <- cor(as.matrix(df))
  372. p.mat <- correlation_p_matrix(df)
  373. # Create the output file
  374. fname <- file.path(basepath, filename)
  375. pdf(file = fname, width = 12, height = 12)
  376. # Set up plot parameters
  377. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  378. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  379. col <- colorRampPalette(pal_colors)
  380. # Create the correlogram
  381. corrplot(corrmatrix, method = "color", col = col(200),
  382. type = "upper", order = "AOE",
  383. addCoef.col = "black",
  384. number.font = 1,
  385. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  386. cl.cex = 1.25,
  387. number.cex = 1.25,
  388. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  389. diag = FALSE,
  390. mar = c(0, 0, 0, 0),
  391. cl.pos = "r",
  392. cl.ratio = 0.2,
  393. cl.align = "c"
  394. )
  395. # Add title
  396. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  397. dev.off()
  398. # Create PNG version for display
  399. png_path <- sub("\\.pdf$", ".png", fname)
  400. image <- image_read(fname)
  401. image_write(image, path = png_path, format = "png")
  402. display_png(file = png_path)
  403. }
  404. # Generate the correlogram with just the tibia parameters
  405. generate_tibia_corrplot(tibia_df, filename, plot_title, basepath)
  406. # %%
  407. ### ONLY EVALUATE THE TIBIA
  408. # Create correlogram on radar-specific parameters (tibia only)
  409. # Import dataframe
  410. df <- read.csv('/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/00_DB/HR-pQCT_database_expanded_2025-06-16_16-18.csv', check.names = FALSE)
  411. # only keep study name Nodaratis
  412. # df <- df[df$Study == "Nodaratis", ]
  413. # Remove non-numeric columns
  414. df_numeric <- df[sapply(df, is.numeric)]
  415. # Create dataframe with specific columns for Tibia
  416. # Define mapping of original column names to standardized names
  417. tibia_cols <- c(
  418. "Tibia: Tot.vBMD [mg HA/cmm]" = "Tot.vBMD",
  419. "Tibia: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  420. "Tibia: Tb.BV/TV [1]" = "Tb.BVTV",
  421. "Tibia: Relative cortical thickness [-]" = "Rel.Ct.Th",
  422. "Tibia: y.Force [N]" = "y.Force",
  423. "Tibia: y.Stress [MPa]" = "y.Stress",
  424. "Tibia: Ct.Th [mm]" = "Ct.Th",
  425. "Tibia: Ct.Po [1]" = "Ct.Po",
  426. "Tibia: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  427. "Tibia: Tb.N [1/mm]" = "Tb.N",
  428. "Tibia: Tb.Sp [mm]" = "Tb.Sp",
  429. "Tibia: Tb.Th [mm]" = "Tb.Th",
  430. "Tibia: Tb.DA" = "Tb.DA"
  431. )
  432. # Extract and rename tibia data
  433. tibia_df <- df[, names(tibia_cols)]
  434. colnames(tibia_df) <- tibia_cols
  435. # Add femoral neck BMD
  436. tibia_df$Fn.BMD <- df$`Femoral neck BMD (g/cm2)`
  437. # Remove rows with NA values
  438. tibia_df <- na.omit(tibia_df)
  439. # General settings
  440. basepath <- "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/03_correlation-matrix/"
  441. filename <- "hr_pqct_parameters_correlation_matrix_nodaratis_tibia_da_paper.pdf"
  442. plot_title <- "HR-pQCT Tibia parameters correlation (p<0.005)"
  443. # Generate correlogram for the tibia dataframe
  444. generate_tibia_corrplot <- function(df, filename, plot_title, basepath) {
  445. # Calculate correlation matrix and p-values
  446. corrmatrix <- cor(as.matrix(df))
  447. p.mat <- correlation_p_matrix(df)
  448. # Create the output file
  449. fname <- file.path(basepath, filename)
  450. pdf(file = fname, width = 12, height = 12)
  451. # Set up plot parameters
  452. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  453. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  454. col <- colorRampPalette(pal_colors)
  455. # Create the correlogram
  456. corrplot(corrmatrix, method = "color", col = col(200),
  457. type = "upper", order = "AOE",
  458. addCoef.col = "black",
  459. number.font = 1,
  460. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  461. cl.cex = 1.25,
  462. number.cex = 1.25,
  463. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  464. diag = FALSE,
  465. mar = c(0, 0, 0, 0),
  466. cl.pos = "r",
  467. cl.ratio = 0.2,
  468. cl.align = "c"
  469. )
  470. # Add title
  471. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  472. dev.off()
  473. # Create PNG version for display
  474. png_path <- sub("\\.pdf$", ".png", fname)
  475. image <- image_read(fname)
  476. image_write(image, path = png_path, format = "png")
  477. display_png(file = png_path)
  478. }
  479. # Generate the correlogram with just the tibia parameters
  480. generate_tibia_corrplot(tibia_df, filename, plot_title, basepath)
  481. # %%
  482. ### ONLY EVALUATE THE RADIUS
  483. # Create correlogram on radar-specific parameters (tibia only)
  484. # only keep study name Nodaratis
  485. # df <- df[df$Study == "Nodaratis", ]
  486. # Remove non-numeric columns
  487. df_numeric <- df[sapply(df, is.numeric)]
  488. # Create dataframe with specific columns for Radius
  489. # Define mapping of original column names to standardized names
  490. radius_cols <- c(
  491. "Radius: Tot.vBMD [mg HA/cmm]" = "Tot.vBMD",
  492. "Radius: Ct.vBMD [mg HA/cmm]" = "Ct.vBMD",
  493. "Radius: Tb.BV/TV [1]" = "Tb.BVTV",
  494. "Radius: Relative cortical thickness [-]" = "Rel.Ct.Th",
  495. "Radius: Area ratio (Ct./Tb.) [-]" = "Ct./Tb.Ar",
  496. "Radius: y.Force [N]" = "y.Force",
  497. "Radius: y.Stress [MPa]" = "y.Stress",
  498. "Radius: Ct.Th [mm]" = "Ct.Th",
  499. "Radius: Ct.Po [1]" = "Ct.Po",
  500. "Radius: Tb.vBMD [mg HA/cmm]" = "Tb.vBMD",
  501. "Radius: Tb.N [1/mm]" = "Tb.N",
  502. "Radius: Tb.Sp [mm]" = "Tb.Sp",
  503. "Radius: Tb.Th [mm]" = "Tb.Th",
  504. "Radius: Tb.DA" = "Tb.DA"
  505. )
  506. # Extract and rename radius data
  507. radius_df <- df[, names(radius_cols)]
  508. colnames(radius_df) <- radius_cols
  509. # Add femoral neck BMD
  510. radius_df$Fn.BMD <- df$`Femoral neck BMD (g/cm2)`
  511. # Remove rows with NA values
  512. radius_df <- na.omit(radius_df)
  513. # General settings
  514. basepath <- "/home/simoneponcioni/Documents/01_PHD/03_Methods/HR-pQCT_database/03_EVALUATION/03_correlation-matrix/"
  515. filename <- "hr_pqct_parameters_correlation_matrix_nodaratis_radius_da_paper.pdf"
  516. plot_title <- "HR-pQCT Radius parameters correlation (p<0.005)"
  517. # Generate correlogram for the radius dataframe
  518. generate_radius_corrplot <- function(df, filename, plot_title, basepath) {
  519. # Calculate correlation matrix and p-values
  520. corrmatrix <- cor(as.matrix(df))
  521. p.mat <- correlation_p_matrix(df)
  522. # Create the output file
  523. fname <- file.path(basepath, filename)
  524. pdf(file = fname, width = 12, height = 12)
  525. # Set up plot parameters
  526. par(mar = c(0.1, 0.5, 3, 0.5), oma = c(0, 0, 0, 0), bg = "white", xpd=TRUE)
  527. pal_colors <- c("#BF360C", "#E64A19", "#FF8A65", "#FFCCBC","#FFFFFF","#7FC8C9", "#35A7A7", "#018786")
  528. col <- colorRampPalette(pal_colors)
  529. # Create the correlogram
  530. corrplot(corrmatrix, method = "color", col = col(200),
  531. type = "upper", order = "AOE",
  532. addCoef.col = "black",
  533. number.font = 1,
  534. tl.col = "black", tl.srt = 45, tl.cex = 1.25,
  535. cl.cex = 1.25,
  536. number.cex = 1.25,
  537. p.mat = p.mat, sig.level = 0.005, insig = "blank",
  538. diag = FALSE,
  539. mar = c(0, 0, 0, 0),
  540. cl.pos = "r",
  541. cl.ratio = 0.2,
  542. cl.align = "c"
  543. )
  544. # Add title
  545. mtext(plot_title, side = 3, line = -5.5, cex = 2.0, font = 2, outer = TRUE)
  546. dev.off()
  547. # Create PNG version for display
  548. png_path <- sub("\\.pdf$", ".png", fname)
  549. image <- image_read(fname)
  550. image_write(image, path = png_path, format = "png")
  551. display_png(file = png_path)
  552. }
  553. # Generate the correlogram with just the radius parameters
  554. generate_radius_corrplot(tibia_df, filename, plot_title, basepath)
  555. # %%

correlation-matrix-database.ipynb at commit 987628e, under GPL-3.0 · at the source

Overview

Authors: Simone Poncioni1,2, Dominique Lüscher1, Michael Indermaur1, Daniela A Frauchiger1,2, Christian Meier3, Philippe Zysset1, Kurt Lippuner1,2
  1. ARTORG Center for Biomedical Engineering Research, University of Bern, 3010 Bern, Switzerland
  2. Department of Osteoporosis, Bern University Hospital, 3010 Bern, Switzerland
  3. Division of Endocrinology, University Hospital Basel, 4031 Basel, Switzerland
Institutions: University of Bern (Switzerland); University Hospital of Bern (Switzerland); University Hospital of Basel (Switzerland)
Journal: JBMR plus, volume 10, issue 6, article ziag077
Dates: received 18 September 2025; accepted 11 April 2026; published online 25 April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1093/jbmrpl/ziag077 · PMID 42186504 · PMCID PMC13198809 · OpenAlex W7155628402
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism)
Methods: Statistics, Preprocessing, fMRI & imaging
Keywords: bone strength, distal radius, distal tibia, finite element analysis, HRpQCT, osteoporosis
Topic: Bone health and osteoporosis research (Orthopedics and Sports Medicine, Medicine), according to OpenAlex
Funding: Department of Osteoporosis of the University Hospital Bern
Citations: not cited yet (Europe PMC); 46 references in the paper

Abstract

HRpQCT is emerging as a promising evolution to DXA for longitudinal assessment of bone properties and strength estimation beyond FN aBMD, as it provides a detailed 3D representation and separate quantification of trabecular and cortical compartments. Reference data exist for thin single stacks of 10.2 mm in second-generation HRpQCT, but these sections may not fully capture clinically relevant fracture locations and pose challenges for longitudinal monitoring due to their limited thickness. Reported parameters are mainly size-dependent properties susceptible to bias from skeletal dimensions, potentially concealing changes in bone quality at the material level. Moreover, microstructural parameters are derived from densitometric information, making them partially redundant. This study provides the first age-, sex-, and site-specific reference data for a novel multi-stack on second-generation HRpQCT at the distal radius and tibia in 381 healthy participants (144F, 237M) from a primarily Caucasian population aged 20-92 yr and identifies the size-independent parameters most sensitive to age for improved bone health assessment. Six size-independent parameters relevant for estimated mechanical properties or exhibiting short trend assessment intervals were selected as candidates for improved bone health assessment: 2 densitometric properties (total volumetric BMD, cortical volumetric BMD), 1 size-independent geometrical property (relative cortical thickness), 2 microstructural properties (trabecular degree of anisotropy, trabecular bone volume over total volume), and 1 mechanical property (apparent yield stress [appσy]) estimated by homogenized finite elements. Intensive mechanical properties provided more sensitive follow-up estimations. Cortical volumetric BMD, especially in the weight-bearing tibia in women, was the most sensitive with age. Matched comparisons with single-stack counterparts demonstrated good agreement between densitometric and microstructural properties, supporting potential cross-study and cross-protocol comparisons. The present work proposes an alternative set of size-independent variables for multi-stack HRpQCT, which may offer a refined assessment of bone health and longitudinal monitoring.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

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

Zenodo 19661364

License: GPL-3.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: the references
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: pandas (13 files), NumPy (8 files), Matplotlib (6 files), ggplot2 (3 files), scikit-learn (3 files), SciPy (3 files), Plotly (2 files), statsmodels (2 files), tidyverse (2 files), car (1 file), cowplot (1 file), lme4 (1 file), lmerTest (1 file), Pillow (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
25 files
At the source:

artorg-unibe-ch/hrpqct-multistack-db

License: GPL-3.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 987628e7414c0542f43d726434ba0d966fdfbe46, 20 April 2026
Languages: Python (13), Jupyter (7), R (3)
Size: 40 files, 23 scripts
Software Heritage: not archived
Found in: the Zenodo archive record
Holds: README, license file, CITATION.cff, environment (01_CODE/docker-compose.yml, 01_CODE/Dockerfile, 01_CODE/pyproject.toml, 01_CODE/requirements.txt, 01_CODE/setup.cfg, 01_CODE/setup.py), 7 notebooks
Not found: tests, continuous integration, documentation
Tools: pandas (13 files), NumPy (8 files), Matplotlib (6 files), ggplot2 (3 files), scikit-learn (3 files), SciPy (3 files), Plotly (2 files), statsmodels (2 files), tidyverse (2 files), car (1 file), cowplot (1 file), lme4 (1 file), lmerTest (1 file), Pillow (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
25 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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 46 scripts, each with its path and the digest of its content;
  • 10 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.

Data availability

The processing code supporting the findings of this study is publicly available.46 The underlying data cannot be made publicly available owing to privacy and ethical constraints; however, data may be made available upon reasonable request to the corresponding author.

Reproduced under the paper's license (CC BY), from the paper cited above.

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, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 6 keywords, 1 funder, 44 references.

Cite

This paper

Poncioni, S., Lüscher, D., Indermaur, M., Frauchiger, D. A., Meier, C., Zysset, P., & Lippuner, K. (2026). Sex- and site-specific reference data for size-invariant properties using multi-stack HRpQCT. JBMR plus, 10(6), ziag077. https://doi.org/10.1093/jbmrpl/ziag077

BibTeX

@article{poncioni2026sex,
author = {Poncioni, Simone and Lüscher, Dominique and Indermaur, Michael and Frauchiger, Daniela A and Meier, Christian and Zysset, Philippe and Lippuner, Kurt},
title = {{Sex- and site-specific reference data for size-invariant properties using multi-stack HRpQCT}},
journal = {JBMR plus},
year = {2026},
month = apr,
volume = {10},
number = {6},
pages = {ziag077},
publisher = {Oxford University Press},
issn = {2473-4039},
doi = {10.1093/jbmrpl/ziag077},
url = {https://doi.org/10.1093/jbmrpl/ziag077},
pmid = {42186504},
pmcid = {PMC13198809}
}

RIS

TY - JOUR
AU - Poncioni, Simone
AU - Lüscher, Dominique
AU - Indermaur, Michael
AU - Frauchiger, Daniela A
AU - Meier, Christian
AU - Zysset, Philippe
AU - Lippuner, Kurt
TI - Sex- and site-specific reference data for size-invariant properties using multi-stack HRpQCT
T2 - JBMR plus
J2 - JBMR Plus
PY - 2026
DA - 2026/04/25
VL - 10
IS - 6
SP - ziag077
SN - 2473-4039
PB - Oxford University Press
DO - 10.1093/jbmrpl/ziag077
UR - https://doi.org/10.1093/jbmrpl/ziag077
LA - en
ER -

CSL-JSON

{
"id": "10.1093/jbmrpl/ziag077",
"type": "article-journal",
"title": "Sex- and site-specific reference data for size-invariant properties using multi-stack HRpQCT",
"container-title": "JBMR plus",
"author": [
{
"family": "Poncioni",
"given": "Simone"
},
{
"family": "Lüscher",
"given": "Dominique"
},
{
"family": "Indermaur",
"given": "Michael"
},
{
"family": "Frauchiger",
"given": "Daniela A"
},
{
"family": "Meier",
"given": "Christian"
},
{
"family": "Zysset",
"given": "Philippe"
},
{
"family": "Lippuner",
"given": "Kurt"
}
],
"container-title-short": "JBMR Plus",
"volume": "10",
"issue": "6",
"page": "ziag077",
"DOI": "10.1093/jbmrpl/ziag077",
"PMID": "42186504",
"PMCID": "PMC13198809",
"ISSN": "2473-4039",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/jbmrpl/ziag077",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
25
]
]
}
}

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.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: car, lmerTest, Plotly, 10 other tools
[2] doi:10.1093/braincomms/fcag176 [code]
Tau topography subtypes account for clinical heterogeneity and longitudinal trajectories in early-onset Alzheimer's disease.
Journal: Brain communications
In common: car, lmerTest, Plotly, 10 other tools
[3] doi:10.34133/csbj.0042 [code]
Using Steady-State Visual Evoked Potentials to Characterize Wide-Ranging Retinopathy Linked to &lt;i&gt;CRB1&lt;/i&gt;: Implications for Clinical Trials.
Journal: Computational and structural biotechnology journal
In common: car, lmerTest, Plotly, 10 other tools
[4] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: car, Plotly, lme4, 8 other tools
[5] doi:10.1093/braincomms/fcag121 [code]
Anterior insular co-activation patterns associated with stress markers in chronic primary pain.
Journal: Brain communications
In common: car, lmerTest, Plotly, 7 other tools
[6] doi:10.1371/journal.pone.0345651 [code]
Non-concussive head impacts sustained during American football correlate with changes in gut microbiome diversity and composition.
Journal: PloS one
In common: car, lmerTest, lme4, 8 other tools
[7] doi:10.3389/fnhum.2026.1839961 [code]
Developmental stability of task-rest neural efficiency in youth using a threat and cognitive control task.
Journal: Frontiers in human neuroscience
In common: car, lmerTest, lme4, 8 other tools
[8] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: car, lmerTest, lme4, 8 other tools
[9] doi:10.1038/s41467-026-71428-6 [code]
Binding items to contexts through conjunctive neural representations with the method of loci.
Journal: Nature communications
In common: lmerTest, Plotly, lme4, 8 other tools
[10] doi:10.1093/nc/niag029 [code]
A data-driven approach to identifying and evaluating connectivity-based neural correlates of conscious visual perception.
Journal: Neuroscience of consciousness
In common: car, lmerTest, cowplot, 8 other tools

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.