【问题标题】:Error: cannot coerce type 'environment' to vector of type 'character' while using goProfiles package in R错误:在 R 中使用 goProfiles 包时,无法将类型“环境”强制转换为“字符”类型的向量
【发布时间】:2021-07-08 16:33:48
【问题描述】:

我正在尝试对 Entrez 基因列表完成基因本体 (GO) 分析。我已经安装了 goProfiles 包以及 orgPackage org.Hs.eg.db

我尝试使用以下代码为我的 Entrez 基因列表构建基本功能配置文件:

library(goProfiles)
library(org.Hs.eg.db)

entrez <- c(567, 6280, 1915, 3106, 60, 4512, 3043, 3107, 2495, 3133)
    
GO <- basicProfile(entrez, idType = "Entrez", onto = "BP", level = 2, 
orgPackage = org.Hs.eg.db, na.rm = T)

但我收到以下错误消息:

as.vector(x, "character") 中的错误:无法强制类型 '环境'到'字符'类型的向量

为什么我会遇到这个问题? entrez 未定义为“字符”,而是定义为“数字”。

【问题讨论】:

    标签: r


    【解决方案1】:

    goProfiles::basicProfile 的文档说明了它的 orgProfile 参数:

    Bioconductor 的有机体注释包的名称 ('org.Xx-eg-db')。如果基因列表通过,则必须提供此字段 该函数是“Entrez”(NCBI)的字符向量 标识符或探针名称的字符向量。

    请注意,它在引号中显示“org.Xx-eg-db”。因此,请尝试引用您的 orgPackage 输入,如下所示。

    library(goProfiles)
    library(org.Hs.eg.db)
    
    entrez <- c(567, 6280, 1915, 3106, 60, 4512, 3043, 3107, 2495, 3133)
    
    GO <- basicProfile(entrez, idType = "Entrez", 
                       onto = "BP", level = 2, 
                       orgPackage = "org.Hs.eg.db", na.rm = T)
    
    > basicProfile(entrez, idType = "Entrez", 
                   +                    onto = "BP", level = 2, 
                   +                    orgPackage = "org.Hs.eg.db", na.rm = T)
    
    $BP
    Description       GOID Frequency
    5                                    behavior GO:0007610         1
    12                        biological adhesion GO:0022610         4
    20                           biological phase GO:0044848         0
    29                      biological regulation GO:0065007         9
    31                          biomineralization GO:0110148         0
    7                    carbohydrate utilization GO:0009758         0
    9                          carbon utilization GO:0015976         0
    8                            cellular process GO:0009987        10
    30                             detoxification GO:0098754         2
    15                      developmental process GO:0032502         6
    16                                     growth GO:0040007         1
    2                       immune system process GO:0002376         8
    19 interspecies interaction between organisms GO:0044419         5
    27 intraspecies interaction between organisms GO:0051703         0
    26                               localization GO:0051179        10
    17                                 locomotion GO:0040011         2
    6                           metabolic process GO:0008152         9
    28                     multi-organism process GO:0051704         0
    14           multicellular organismal process GO:0032501         7
    23  negative regulation of biological process GO:0048519         4
    10                       nitrogen utilization GO:0019740         0
    4                      phosphorus utilization GO:0006794         0
    18                               pigmentation GO:0043473         0
    22  positive regulation of biological process GO:0048518         6
    24           regulation of biological process GO:0050789         9
    1                                reproduction GO:0000003         0
    11                       reproductive process GO:0022414         0
    25                       response to stimulus GO:0050896        10
    21                           rhythmic process GO:0048511         0
    13                                  signaling GO:0023052         6
    3                          sulfur utilization GO:0006791         0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多