1 Star 0 Fork 0

Shenglong/stem_cell_therapy_meta

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
plot.R 56.67 KB
一键复制 编辑 原始数据 按行查看 历史
Shenglong 提交于 2023-11-17 20:09 . R code
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
# This code is used to plot
if(!require(tidyverse))require(tidyverse)
if(!require(readxl))require(readxl)
if(!require(xlsx))require(xlsx)
if(!require(writexl))require(writexl)
if(require(metafor))require(metafor)
if(!require(lubridate))require(lubridate)
if(!require(meta))library(meta)
if(!require(gridExtra))library(gridExtra)
if(!require(gridGraphics))library(gridGraphics)
if(!require(patchwork))library(patchwork)
setwd('')
###############################################
# Survival combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
# SCT
ref_HR <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(logHR)) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, Dead.T:SE, Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '180 days'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
meta_HR1 <- metagen(logHR, SE, sm="HR", data = ref_HR, subgroup = Time, studlab = Study_id)
forest(meta_HR1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
# SCT + PE
ref_HR <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(logHR)) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, Dead.T:SE, Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
meta_HR2 <- metagen(logHR, SE, sm="HR", data = ref_HR, subgroup = Time, studlab = Study_id)
forest(meta_HR2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
# Cell Source
ref_HR <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(logHR)) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, Dead.T:SE, Treatment, Control, Source, Injection_rout2, Injection_times) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("=<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")"," ", Time, " ", Treatment, " vs. ", Control))
meta_HR3 <- metagen(logHR, SE, sm="HR", data = ref_HR, subgroup = Source, studlab = Study_id)
forest(meta_HR3, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p3 = grid.grab()
# Route and injection
ref_HR <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(logHR)) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, Dead.T:SE, Treatment, Control, Source, Injection_rout2, Injection_times) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '180 days'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("=<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")"))
ref_HR = ref_HR %>%
mutate(Injection_rout2 = ifelse(Injection_rout2 == "Deep", "Deep+Single", "Peripheral+Multiple")) %>%
rename("Route+Injection" = Injection_rout2) %>%
mutate(Study_id = paste0(Study_id," ", Time)) %>%
mutate(Study_id = paste0(Study_id, " ", Treatment, " vs. ", Control))
meta_HR4 <- metagen(logHR, SE, sm="HR", data = ref_HR, subgroup = `Route+Injection`, studlab = Study_id)
forest(meta_HR4, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p4 = grid.grab()
## Integration
## HR forest combination
grid.newpage()
grid.arrange(p1, p2, p3, p4, ncol = 2)
rstudioapi::savePlotAsImage("./Survival_FR_231112.svg",width=2177,height=1420, format = "svg")
## Supplementary combination
####> Funnel plot
####> I dont know why funnel plot can not be grabbed.
####> So I have to use par method to combine plots.
par(mfrow=c(1,2), cex= 1)
meta::funnel(meta_HR1)
title(main = "SCT vs. SMT")
meta::funnel(meta_HR2)
title(main = "SCT+PE vs. PE")
# meta::funnel(meta_HR3)
# title(main = "Autologous vs. Allogeneic")
# meta::funnel(meta_HR4)
# title(main = "Deep+Single vs. Periphera+Multiple")
rstudioapi::savePlotAsImage("./Survival_FU_231113.svg",
width=960,height=500, format = "svg")
## Sensitivity analysis
meta::forest(metainf(meta_HR1, pooled = "random"))
p1 = grid.grab()
meta::forest(metainf(meta_HR2, pooled = "random"))
p2 = grid.grab()
# meta::forest(metainf(meta_HR3, pooled = "random"))
# p3 = grid.grab()
# meta::forest(metainf(meta_HR4, pooled = "random"))
# p4 = grid.grab()
grid.newpage()
grid.arrange(p1, p2, ncol = 1)
rstudioapi::savePlotAsImage("./Survival_SE_231113.svg",
width=960,height=800, format = "svg")
###############################################
# MELD combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
pre_data <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "(2-4weeks)"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
return(dt)
}
## SCT vs. SMT
i = 'MELD'
ref_MELD <- pre_data(i)
ref_MELD %>% mutate(Total = n.T + n.C) %>%
distinct(PMID,.keep_all = T) %>%
summarise(sum(Total))
meta_MELD1 <- metacont(n.T, MELD.T.M, MELD.T.SD, n.C, MELD.C.M, MELD.C.SD, data = ref_MELD,
sm="SMD", subgroup = Time, studlab = Study_id)
meta_MELD1a <- escalc(measure = "SMD", n1i = n.T, m1i = MELD.T.M, sd1i = MELD.T.SD, n2i = n.C, m2i = MELD.C.M,
sd2i = MELD.C.SD, data = ref_MELD, slab = Study_id) # Calculate effect size and variance
forest(meta_MELD1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
rstudioapi::savePlotAsImage("./MELD_SCT_231113.svg",
width=1273,height=960, format = "svg")
### CT+PE vs others
pre_data2 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
return(dt)
}
i = 'MELD'
ref_MELD <- pre_data2(i)
ref_MELD %>% mutate(Total = n.T + n.C) %>%
distinct(PMID,.keep_all = T) %>%
summarise(sum(Total))
meta_MELD2 <- metacont(n.T, MELD.T.M, MELD.T.SD, n.C, MELD.C.M, MELD.C.SD, data = ref_MELD,
sm="SMD", subgroup = Time, studlab = Study_id)
meta_MELD2a <- escalc(measure = "SMD", n1i = n.T, m1i = MELD.T.M, sd1i = MELD.T.SD, n2i = n.C, m2i = MELD.C.M,
sd2i = MELD.C.SD, data = ref_MELD, slab = Study_id) # Calculate effect size and variance
forest(meta_MELD2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
rstudioapi::savePlotAsImage("./MELD_SCTPE_231113.svg",
width=1273,height=960, format = "svg")
#######################################################
##### deep vs. peripheral | auto vs. allo ###########
#######################################################
pre_data3 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control, Source, Injection_rout2, Injection_times) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '180 days'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("=< ","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")"," ", Time, " ", Treatment, " vs. ", Control))
return(dt)
}
## Source
i = 'MELD'
ref_MELD <- pre_data3(i)
ref_MELD %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_MELD3 <- metacont(n.T, MELD.T.M, MELD.T.SD, n.C, MELD.C.M, MELD.C.SD, data = ref_MELD,
sm="SMD", subgroup = Source, studlab = Study_id)
meta_MELD3a <- escalc(measure = "SMD", n1i = n.T, m1i = MELD.T.M, sd1i = MELD.T.SD, n2i = n.C, m2i = MELD.C.M,
sd2i = MELD.C.SD, data = ref_MELD, slab = Study_id) # Calculate effect size and variance
forest(meta_MELD3, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
# p3 = grid.grab()
rstudioapi::savePlotAsImage("./MELD_SOURCE_231113.svg",
width=1382,height=1010, format = "svg")
## Injection route and times
i = 'MELD'
ref_MELD <- pre_data3(i)
ref_MELD %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
ref_MELD = ref_MELD %>%
mutate(Injection_rout2 = ifelse(Injection_rout2 == "Deep", "Deep+Single", "Peripheral+Multiple")) %>%
rename("Route+Injection" = Injection_rout2)
## rma convergence issue
##> https://www.metafor-project.org/doku.php/tips:convergence_problems_rma
##>
meta_MELD4 <- metacont(n.T, MELD.T.M, MELD.T.SD, n.C, MELD.C.M, MELD.C.SD, data = ref_MELD,
sm="SMD", subgroup = `Route+Injection`, studlab = Study_id,
control=list(stepadj=0.5))
meta_MELD4a <- escalc(measure = "SMD", n1i = n.T, m1i = MELD.T.M, sd1i = MELD.T.SD, n2i = n.C, m2i = MELD.C.M,
sd2i = MELD.C.SD, data = ref_MELD, slab = Study_id) # Calculate effect size and variance
forest(meta_MELD4, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
# p4 = grid.grab()
rstudioapi::savePlotAsImage("./MELD_ROUTE_231113.svg",
width=1382,height=1010, format = "svg")
## Adjustment for publication bias
par(mfrow = c(2, 2), # 2 x 4 pictures on one plot
cex = 1) # square plotting region
meta::funnel(meta_MELD1)
title(main = "SCT vs. SMT", sub = "Funnel plot")
res <- rma(yi, vi, data=meta_MELD1a) # Perform meta-analysis
res
metafor::trimfill(res)
metafor::trimfill(res) %>% meta::funnel()
title(sub = "Adjusted funnel plot")
#########################################
meta::funnel(meta_MELD2)
title(main = "SCT+PE vs. PE", sub = "Funnel plot")
res <- rma(yi, vi, data=meta_MELD2a) # Perform meta-analysis
res
metafor::trimfill(res)
metafor::trimfill(res) %>% meta::funnel()
title(sub = "Adjusted funnel plot")
################################################
# meta::funnel(meta_MELD3)
# title(main = "Autologous vs. Allogeneic", sub = "Funnel plot")
# res <- rma(yi, vi, data=meta_MELD3a) # Perform meta-analysis
# res
# metafor::trimfill(res)
# metafor::trimfill(res) %>% meta::funnel()
# title(sub = "Adjusted funnel plot")
# ######################################################
# meta::funnel(meta_MELD4)
# title(main = "Deep+Single vs. Periphera+Multiple", sub = "Funnel plot")
# res <- rma(yi, vi, data=meta_MELD4a) # Perform meta-analysis
# res
# metafor::trimfill(res)
# metafor::trimfill(res) %>% meta::funnel()
# title(sub = "Adjusted funnel plot")
rstudioapi::savePlotAsImage("./MELD_FU_adj.svg", format = "svg",
width=960,height=960)
dev.off()
###############################################
# ALT combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
pre_data <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "(2-4weeks)"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
return(dt)
}
## SCT vs. SMT
i = 'ALT'
ref_ALT <- pre_data(i)
ref_ALT %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_ALT1 <- metacont(n.T, ALT.T.M, ALT.T.SD, n.C, ALT.C.M, ALT.C.SD, data = ref_ALT,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALT1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
rstudioapi::savePlotAsImage("./ALT_SCT_FR.svg",
width=1230,height=1070, format = "svg")
### CT+PE vs others
pre_data2 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
return(dt)
}
i = 'ALT'
ref_ALT <- pre_data2(i)
ref_ALT %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_ALT2 <- metacont(n.T, ALT.T.M, ALT.T.SD, n.C, ALT.C.M, ALT.C.SD, data = ref_ALT,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALT2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
rstudioapi::savePlotAsImage("./ALT_SCTPE_FR.svg",
width=1230,height=1070, format = "svg")
#######################################################
##### deep vs. peripheral | auto vs. allo ###########
#######################################################
pre_data3 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control, Source, Injection_rout2, Injection_times) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '180 days'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("=< ","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")"," ", Time, " ", Treatment, " vs. ", Control))
return(dt)
}
## Source
i = 'ALT'
ref_ALT <- pre_data3(i)
ref_ALT %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_ALT3 <- metacont(n.T, ALT.T.M, ALT.T.SD, n.C, ALT.C.M, ALT.C.SD, data = ref_ALT,
sm="SMD", subgroup = Source, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALT3, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p3 = grid.grab()
rstudioapi::savePlotAsImage("./ALT_Source_FR.svg",
width=1390,height=1070, format = "svg")
## Injection route and times
i = 'ALT'
ref_ALT <- pre_data3(i)
ref_ALT %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
ref_ALT = ref_ALT %>%
mutate(Injection_rout2 = ifelse(Injection_rout2 == "Deep", "Deep+Single", "Peripheral+Multiple")) %>%
rename("Route+Injection" = Injection_rout2)
meta_ALT4 <- metacont(n.T, ALT.T.M, ALT.T.SD, n.C, ALT.C.M, ALT.C.SD, data = ref_ALT,
sm="SMD", subgroup = `Route+Injection`, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALT4, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p4 = grid.grab()
rstudioapi::savePlotAsImage("./ALT_Source_FR.svg",
width=1390,height=1070, format = "svg")
###############################################
# TBIL combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
pre_data <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "(2-4weeks)"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
return(dt)
}
## SCT vs. SMT
i = 'TBIL'
ref_TBIL <- pre_data(i)
ref_TBIL %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_TBIL1 <- metacont(n.T, TBIL.T.M, TBIL.T.SD, n.C, TBIL.C.M, TBIL.C.SD, data = ref_TBIL,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_TBIL1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
rstudioapi::savePlotAsImage("./TBIL_SCT_FR.svg",
width=1230,height=1070, format = "svg")
### CT+PE vs others
pre_data2 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
return(dt)
}
i = 'TBIL'
ref_TBIL <- pre_data2(i)
ref_TBIL %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_TBIL2 <- metacont(n.T, TBIL.T.M, TBIL.T.SD, n.C, TBIL.C.M, TBIL.C.SD, data = ref_TBIL,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_TBIL2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
rstudioapi::savePlotAsImage("./TBIL_SCTPE_FR.svg",
width=1230,height=1070, format = "svg")
###############################################
# ALB combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
pre_data <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "(2-4weeks)"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
return(dt)
}
## SCT vs. SMT
i = 'ALB'
ref_ALB <- pre_data(i)
ref_ALB %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_ALB1 <- metacont(n.T, ALB.T.M, ALB.T.SD, n.C, ALB.C.M, ALB.C.SD, data = ref_ALB,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALB1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
rstudioapi::savePlotAsImage("./ALB_SCT_FR.svg",
width=1230,height=1070, format = "svg")
### CT+PE vs others
pre_data2 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
return(dt)
}
i = 'ALB'
ref_ALB <- pre_data2(i)
ref_ALB %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_ALB2 <- metacont(n.T, ALB.T.M, ALB.T.SD, n.C, ALB.C.M, ALB.C.SD, data = ref_ALB,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_ALB2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
rstudioapi::savePlotAsImage("./ALB_SCTPE_FR.svg",
width=1230,height=1070, format = "svg")
###############################################
# INR combination ######
###############################################
# Load the data
rm(list = ls())
ref = read_excel("./Add_new_column.xlsx", sheet = 1) %>%
select(-1)
pre_data <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Follow.up = str_trim(Follow.up, side = "both")) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '(24 months)'), "96 weeks",
ifelse(str_detect(Follow.up, '(3 months)'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '(6 months)'), "24 weeks",
ifelse(str_detect(Follow.up, '(60 days)'), "8 weeks",
ifelse(str_detect(Follow.up, '(90 days)'), "12 weeks",
ifelse(str_detect(Follow.up, "(2-4weeks)"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT" & Control == "SMT")
return(dt)
}
## SCT vs. SMT
i = 'INR'
ref_INR <- pre_data(i)
ref_INR %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_INR1 <- metacont(n.T, INR.T.M, INR.T.SD, n.C, INR.C.M, INR.C.SD, data = ref_INR,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_INR1, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p1 = grid.grab()
rstudioapi::savePlotAsImage("./INR_SCT_FR.svg",
width=1230,height=1070, format = "svg")
### CT+PE vs others
#
pre_data2 <- function(i){
dt <- ref %>%
fill(`T.Group.N (F/M)`, `C.Group.N (F/M)`, .direction = "down") %>%
mutate(n.T = str_split(`T.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
mutate(n.C = str_split(`C.Group.N (F/M)`, '/') |>
map(as.numeric) |>
map_dbl(~sum(.x))) %>%
filter(!is.na(.[,paste0(i, ".T.SD")])) %>%
select(PMID, Author, Year, n.T, n.C, Follow.up, paste0(i,".T.M"):paste0(i,".C.SD"), Treatment, Control) %>%
mutate(Time = ifelse(str_detect(Follow.up, '(12 months)|(360 days)'), "48 weeks",
ifelse(str_detect(Follow.up, '(180 days)'), "24 weeks",
ifelse(str_detect(Follow.up, '24 months'), "96 weeks",
ifelse(str_detect(Follow.up, '3 months'), "12 weeks",
ifelse(str_detect(Follow.up, '(30 days)|(1 month)'), "4 weeks",
ifelse(str_detect(Follow.up, '6 months'), "24 weeks",
ifelse(str_detect(Follow.up, '60 days'), "8 weeks",
ifelse(str_detect(Follow.up, '90 days'), "12 weeks",
ifelse(str_detect(Follow.up, "2-4weeks"), "4 weeks",
Follow.up)
))))))))) %>%
mutate(Time = as.duration(Time) |> as.numeric('weeks')) %>%
arrange(Time) %>%
mutate(Duration = ifelse(Time <= 12, "short-term",
ifelse(Time >12 & Time <= 24, "medium-term",
"long-term"))) %>%
mutate(Time = paste0(Time, " weeks")) %>%
mutate(Time = ifelse(Time == "4 weeks", paste0("<","4 weeks"), Time)) %>%
mutate(Study_id = paste0(Author," (", Year, ")")) %>%
filter(Treatment == "CT+PE" & Control == "PE")
return(dt)
}
i = 'INR'
ref_INR <- pre_data2(i)
ref_INR %>% mutate(Total = n.T + n.C) %>%
distinct(PMID, .keep_all = T) %>%
summarise(sum(Total))
meta_INR2 <- metacont(n.T, INR.T.M, INR.T.SD, n.C, INR.C.M, INR.C.SD, data = ref_INR,
sm="SMD", subgroup = Time, studlab = Study_id) ## Standardized mean difference (SMD)
forest(meta_INR2, digits=3,test.effect.subgroup = TRUE,test.overall = TRUE,family="sans",fontsize=9.5,lwd=2,col.diamond.fixed="lightslategray",col.diamond.lines.fixed="lightslategray",
col.diamond.random="maroon",col.diamond.lines.random="maroon",col.square="skyblue",col.study="lightslategray",
lty.fixed=4,plotwidth="8cm",colgap.forest.left="1cm",colgap.forest.right="1cm",just.forest="right",colgap.left="0.5cm",
colgap.right="0.5cm", layout = "RevMan5")
p2 = grid.grab()
rstudioapi::savePlotAsImage("./INR_SCTPE_FR.svg",
width=1230,height=1070, format = "svg")
## Adjustment for publication bias
if(T){
par(mfrow = c(1, 2), # 2 x 2 pictures on one plot
pty = "s") # square plotting region
meta_INR <- metacont(n.T, INR.T.M, INR.T.SD, n.C, INR.C.M, INR.C.SD, data = ref_INR,
sm="SMD", subgroup = Time, studlab = Study_id)
meta_INR
meta::funnel(meta_INR)
title(main = "SCT+PE vs. PE", sub = "Funnel plot")
meta_INR <- escalc(measure = "SMD", n1i = n.T, m1i = INR.T.M, sd1i = INR.T.SD, n2i = n.C, m2i = INR.C.M,
sd2i = INR.C.SD, data = ref_INR, slab = Study_id) # Calculate effect size and variance
res <- rma(yi, vi, data=meta_INR) # Perform meta-analysis
res
metafor::trimfill(res)
metafor::trimfill(res) %>% meta::funnel()
title(sub = "Adjusted funnel plot")
}
rstudioapi::savePlotAsImage("./CT_PE_INR_AFU.svg", format = "svg",
width=695.04,height=456.96)
dev.off()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shenglonglin/stem_cell_therapy_meta.git
git@gitee.com:shenglonglin/stem_cell_therapy_meta.git
shenglonglin
stem_cell_therapy_meta
stem_cell_therapy_meta
master

搜索帮助