You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

STRINGdb绘图报CERT_TRUST_IS_NOT_TIME_VALID错误的解决方法求助

解决STRINGdb绘图时的CERT_TRUST_IS_NOT_TIME_VALID证书错误

问题场景

我在学习STRINGdb用于工作时,以下代码可正常运行:

library(STRINGdb)
string_db <- STRINGdb$new( version="11.5", species=9606, 
                           score_threshold=200, network_type="full", input_directory="")
data(diff_exp_example1)
example1_mapped <- string_db$map( diff_exp_example1, "gene", removeUnmappedRows = TRUE )
hits <- example1_mapped$STRING_id[1:200]

成功生成包含基因名、Pvalue、logFC和STRING_id的数据框,并选取了前200个基因,但执行绘图代码:

string_db$plot_network(hits)

时触发以下错误:

Error in function (type, msg, asError = TRUE)  : 
  schannel: CertGetCertificateChain trust error CERT_TRUST_IS_NOT_TIME_VALID

后续相关在线操作也会触发相同错误。

解决方案

这个错误源于系统SSL证书链的时间有效性验证失败,常见于Windows系统,可通过以下方式解决:

  • 更新系统根证书
    打开Windows更新,检查并安装所有可选更新中的证书类更新;若更新未覆盖,可手动获取对应Windows版本的根证书更新包并安装。

  • 临时跳过SSL证书验证(仅测试环境使用)
    在调用绘图函数前添加以下代码,强制跳过证书验证:

    # 针对download.file的设置
    options(download.file.method = "libcurl")
    options(libcurl.followlocation = TRUE, libcurl.ssl.verifypeer = FALSE)
    
    # 若使用httr依赖,补充设置
    library(httr)
    set_config(config(ssl_verifypeer = FALSE))
    
  • 切换至STRINGdb离线模式
    若已提前下载对应版本的STRING数据库文件,初始化STRINGdb时指定本地缓存目录,避免在线请求:

    string_db <- STRINGdb$new( version="11.5", species=9606, 
                               score_threshold=200, network_type="full", 
                               input_directory="./string_local_cache" )
    

    确保指定目录下存在对应版本的STRING数据文件。

内容的提问来源于stack exchange,提问作者Pavel Hronek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 03:57:08