美文网首页
🤔 Aba | 全自动biomarker分析神包!~(原作者用这

🤔 Aba | 全自动biomarker分析神包!~(原作者用这

作者: 生信漫卷 | 来源:发表于2022-12-13 14:00 被阅读0次

写在前面

今天介绍一个Github上的神包吧, 主要是用于Biomarker的临床分析, 原作者用这个包已经发了3篇Nature了, 一起看看吧:👇

< , , >

在一些针对Biomarker的临床研究中, 我们常常需对Biomarker进行模型拟合, 预测效果评估等等.🥰
这个包可以完美解决这些问题, 并且直接输出发表级图表, 简单介绍一下用法给大家吧.🥳

用到的包

rm(list = ls())
#devtools::install_github("ncullen93/abaR")
library(aba)
library(tidyverse)
library(ggsci)

示例数据

dat <- adnimerge %>% 
  dplyr::filter(VISCODE == 'bl')

DT::datatable(dat)

变量一览

看一下都有什么变量, 都是什么类型. 🤞

str(dat)

建立模型

5.1 原函数

大家可以通过这种方式来建立模型.

  aba_model(
   data = NULL,
   groups = NULL,
   outcomes = NULL,
   predictors = NULL,
   covariates = NULL,
   stats = NULL,
   evals = NULL,
   include_basic = TRUE
 )

5.2 pipeline形式

这里也提供了pipeline的形式来编写代码, 个人也是更倾向于这种方式, 大家试一下吧. 😏

我们在这里设定两个结局指标: ConvertedToAlzheimersCSF_ABETA_STATUS_bl.🤒
两个预测指标, 即Biomarker, PLASMA_PTAU181_blPLASMA_NFL_bl. 🤫

模型为logistic regression. 📈

model <- aba_model() %>% 
  set_data(dat) %>% 
  set_groups(DX_bl %in% c('MCI','AD')) %>% 
  set_outcomes(ConvertedToAlzheimers, CSF_ABETA_STATUS_bl) %>% 
  set_predictors(
    PLASMA_PTAU181_bl,
    PLASMA_NFL_bl,
    c(PLASMA_PTAU181_bl, PLASMA_NFL_bl)
  ) %>% 
  set_covariates(AGE, GENDER, EDUCATION) %>% 
  set_stats(stat_glm(std.beta=T))

model

Note! 这里我们注意下如何进行Biomarker联合应用, 可写为 c(PLASMA_PTAU181_bl, PLASMA_NFL_bl). 😘


5.3 拟合

model <- model %>% 
  fit()
model

5.4 模型数据

拟合完以后我们就获得了模型的结果, 大家可以大致看一下.🤓

model_summary <- model %>% 
  summary()

model_summary

模型结果的可视化

这个包提供了很多可视化的参数, 可以直接将summary的结果传递给画图函数, 非常简单. 😘

6.1 coeffficients可视化

这里需要说明一下, 函数内自带的配色只有4种, 即jama, nature, lancet, none.
但是大家可以按照ggplot语法更改颜色.🤜

model_summary %>% 
  aba_plot_coef(coord_flip=T,
                palette = 'nature') 

6.2 AUC可视化

看看各个模型的AUC吧.😗

model_summary %>% 
  aba_plot_metric(palette = 'nature')

6.3 ROC可视化

model_summary %>% 
  aba_plot_roc()

6.4 Risk density plot

批量出图, 大家想看哪个predictorRisk density plot就提取哪个吧. 🤪

fig <- model %>%
  aba_plot_risk_density()
fig

随便提取一个看看吧~~~😉

fig$fig[1]

补充一下

这个包还有很多其他强大的功能, 大家可以去进一步地探索一下。😘

欢迎大家留言说一下其他强大的函数哦~


这里附上所有函数官方解释:👇

  • aba_adjust()

    Create an aba_adjust object.

  • aba_control()

    Create an aba control object.

  • aba_demographics()

    Create a demographics table from a fitted aba model.

  • aba_diagnosticpower()

    Caclulate diagnostic power based on a fitted aba model

  • aba_emmeans()

    Calculated estimated marginal means.

  • aba_evaluate()

    Evaluate a fitted aba model on new data

  • aba_fit()

    Fit an aba model.

  • aba_longpower()

    Run power analysis on a longitudinal-based aba model.

  • aba_model()

    Create an aba model.

  • aba_plot()

    Plot an aba object

  • aba_plot_coef()

    Plot coefficients of an aba model summary

  • aba_plot_metric()

    Plot metrics of an aba model summary

  • aba_plot_predictor_risk()

    Plot predictor values versus predicted risk from fitted aba model

  • aba_plot_risk_density()

    Plot risk density split by binary outcome class

  • aba_plot_roc()

    Plot ROC curves from an aba model

  • aba_predict()

    Get individual predictions from a fitted aba model

  • aba_read()

    Read an aba object from file

  • aba_robust()

    Evaluate the robustness of an aba model to systematic and random error.

  • aba_screen()

    Create an aba screen object.

  • aba_selection()

    Run model selection on an aba model.

  • aba_summary()

    Summarise a fitted aba model.

  • aba_write()

    Write an aba object to file.

  • adnimerge

    A sample of ADNI data in long format

  • all_combos()

    Create all possible combinations of a set of variables

  • all_levels()

    Create groups from all levels of one or more variables

  • as_reactable()

    Convert an aba summary to a interactive react table

  • as_reactable(*<abaSummary>*)

    Convert an aba summary to a interactive react table

  • as_table()

    Convert an aba summary to a nicely formatted table

  • as_table(*<abaSummary>*)

    Convert an aba summary to a nicely formatted table

  • eval_boot()

    Create a bootstrap evaluator

  • eval_cv()

    Create a cross validation evaluator

  • eval_standard()

    Create a standard evaluator

  • eval_traintest()

    Create a train-test evaluator

  • everyone()

    Use all data rows as a group in an aba model.

  • fit(*<abaModel>*)

    Fit an aba model.

  • predict(*<abaModel>*)

    Get individual predictions from a fitted aba model

  • set_covariates()

    Set the covariates of an aba model.

  • set_data()

    Set the data of an aba model

  • set_evals()

    Set the evals of an aba model

  • set_groups()

    Set the groups of an aba model.

  • set_outcomes()

    Set the outcomes of an aba model.

  • set_predictors()

    Set the predictors of an aba model.

  • set_stats()

    Set the stats of an aba model

  • stat_ancova()

    Create an ancova stat object.

  • stat_cox()

    Create a glm stat object.

  • stat_glm()

    Create a glm stat object.

  • stat_lm()

    Create an lm stat object.

  • stat_lme()

    Create an lme stat object.

  • stat_lmer()

    Create an lmer stat object.

  • stat_mmrm()

    Create an mmrm stat object.

  • stat_retest()

    Create a retest stat object.

  • stat_roc()

    Create a roc stat object.

  • theme_aba()

    Custom aba ggplot2 theme


<img src="https://img.haomeiwen.com/i24475539/a8d99c85dde3e123.png" alt="果冻" style="zoom:25%;" />

<center>最后祝大家早日不卷!~</center>


点个在看吧各位~ ✐.ɴɪᴄᴇ ᴅᴀʏ 〰

<center> <b>📍 往期精彩 <b> </center>

📍 <font size=1>🤩 ComplexHeatmap | 颜狗写的高颜值热图代码!</font>
📍 <font size=1>🤥 ComplexHeatmap | 你的热图注释还挤在一起看不清吗!?</font>
📍 <font size=1>🤨 Google | 谷歌翻译崩了我们怎么办!?(附完美解决方案)</font>
📍 <font size=1>🤩 scRNA-seq | 吐血整理的单细胞入门教程</font>
📍 <font size=1>🤣 NetworkD3 | 让我们一起画个动态的桑基图吧~</font>
📍 <font size=1>🤩 RColorBrewer | 再多的配色也能轻松搞定!~</font>
📍 <font size=1>🧐 rms | 批量完成你的线性回归</font>
📍 <font size=1>🤩 CMplot | 完美复刻Nature上的曼哈顿图</font>
📍 <font size=1>🤠 Network | 高颜值动态网络可视化工具</font>
📍 <font size=1>🤗 boxjitter | 完美复刻Nature上的高颜值统计图</font>
📍 <font size=1>🤫 linkET | 完美解决ggcor安装失败方案(附教程)</font>
📍 <font size=1>......</font>

本文由mdnice多平台发布

相关文章

网友评论

      本文标题:🤔 Aba | 全自动biomarker分析神包!~(原作者用这

      本文链接:https://www.haomeiwen.com/subject/npuhqdtx.html