Bioconductor / AnnotationForge

Tools for building SQLite-based annotation data packages
https://bioconductor.org/packages/AnnotationForge
4 stars 9 forks source link

makeorgdb,提示错误Warning message: In file.remove(dbFileName) : cannot remove file './/org.My.eg.sqlite', reason 'Permission denied' #54

Closed Frybank closed 1 year ago

Frybank commented 1 year ago

我正在尝试做一个关于油桐的orgdb library(tidyverse) library(clusterProfiler) de_result <- read.table( file = 'flower_sex/genes.counts.matrix.F_vs_M.DESeq2.DE_results', header = TRUE)

library(readr) emapper <- read_delim( file = 'out.emapper.annotations', "\t", escape_double = FALSE, col_names = FALSE, comment = "#", trim_ws = TRUE) %>% dplyr::select(GID = X1, Gene_Symbol = X9, GO = X10, KO = X12, Pathway = X13, OG = X7, Gene_Name = X8)


### 候选基因向量(gene)

一个字符型向量,包含感兴趣的基因,如差异表达基因、WGCNA 得到的关键模块里的基因、PCA 中某个PC loadings 高的基因。

```{r}
gene <- filter(de_result, 
               abs(log2FoldChange) > 2 & padj < 0.01) %>%
  pull(id)

基因差异向量(geneList)

一个有名向量,记录差异大小,名字为基因ID,值为 logFC,按 logFC 降序排列。

geneList <- de_result$log2FoldChange names(geneList) <- de_result$id geneList <- sort(geneList, decreasing = T)



## GO 富集

### 构建 OrgDB

使用 eggnog-mapper 注释结果构建 OrgDB

# 提取基因信息
gene_info <- dplyr::select(emapper,  GID, Gene_Name) %>%
  dplyr::filter(!is.na(Gene_Name))
# 提取GO信息
gene2go <- dplyr::select(emapper, GID, GO) %>%
  separate_rows(GO, sep = ',', convert = F) %>%
  filter(!is.na(GO)) %>%
  mutate(EVIDENCE = 'IEA') 
#过滤掉任何不以GO开头的GO
gene2go <- gene2go[grepl("^GO:", as.character(gene2go$GO)),]
# 构建 OrgDB
library(AnnotationForge)
AnnotationForge::makeOrgPackage(gene_info=gene_info,
                                go=gene2go,
                                maintainer='w.com',
                                author='bank',
                                outputDir="./",
                                tax_id=0000,
                                genus='m',
                                species='y',
                                goTable="go",
                                version="1.0")
运行之后,错误提示
Warning message:
In file.remove(dbFileName) :
  cannot remove file './/org.My.eg.sqlite', reason 'Permission denied'
lshep commented 1 year ago

Are you in a directory where that file exists already? Do you have write permission in the directory you are running?

Frybank commented 1 year ago

您是否在该文件已存在的目录中?您是否在正在运行的目录中具有写入权限?

我使用管理员权限运行Rstudio,写入的文件目录权限是完全控制

jmacdon commented 1 year ago

That error arises after the SQLite DB has been copied into the package and then the original DB file is supposed to be removed. I haven't tracked it down yet, but I think it's because R still has a connection open to the DB, so it can't be removed.

It's not a problem otherwise. Simply quitting R and then you can delete the SQLite DB by hand.

Frybank commented 1 year ago

该错误是在SQLite DB复制到包中之后出现的,然后应该删除原始DB文件。我还没有追踪到它,但我认为这是因为 R 仍然打开了与数据库的连接,因此无法删除它。

否则这不是问题。只需退出R,然后就可以手动删除SQLite数据库。

很感谢您,我想我知道问题如何解决了,麻烦您啦,非常感谢

zjx12-bot commented 4 months ago

你好,请问怎样解决这个问题啊,我也遇到这个难题了,请求帮助,十分感谢! @Frybank

jmacdon commented 4 months ago

@zjx12-bot This has already been answered. Quit R and then delete.

Frybank commented 4 months ago

退出手动删除那个sqlit文件,警告不用在意,接着跑之后的程序就行

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年3月6日(星期三) 晚上10:26 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Bioconductor/AnnotationForge] makeorgdb,提示错误Warning message: In file.remove(dbFileName) : cannot remove file './/org.My.eg.sqlite', reason 'Permission denied' (Issue #54)

你好,请问怎样解决这个问题啊,我也遇到这个难题了,请求帮助,十分感谢! @Frybank

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>