【问题标题】:How to track which protein ID is linked to which gene ID with rentrez如何使用rentrez跟踪哪个蛋白质ID与哪个基因ID相关联
【发布时间】:2017-10-24 00:48:46
【问题描述】:

我有一堆蛋白质 ID,我想在不丢失蛋白质 ID 的情况下获取相应的编码序列 (CDS)。我已经设法下载了相应的 CDS,但不幸的是,CDS ID 与 NCBI 中的蛋白质 ID 非常不同。

我有以下 R 代码:

library(rentrez)
Prot_ids <- c("XP_012370245.1","XP_004866438.1","XP_013359583.1")
links <- entrez_link(dbfrom="protein", db="nuccore", id=Prot_ids, by_id = TRUE)

然后,我使用此命令将蛋白质 ID 与 CDS ID“匹配”:

lapply(links, function(x) x$links$protein_nuccore_mrna)

[[1]]
[1] "820968283"

[[2]]
[1] "861491027"

[[3]]
[1] "918634580"

但是,正如您所见,参数“by_id=TRUE”只是列出了三个 elink 对象,但现在我丢失了蛋白质 ID。

我想要类似的东西:

蛋白质 ID XP_012370245.1 XP_004866438.1 XP_013359583.1

CDS ID XM_004866381.2 XM_012514791.1 XM_013504129.1

非常欢迎任何建议,谢谢!!

【问题讨论】:

  • 请做一个可重现的例子。例如。 links2 来自哪里?
  • 如果长度和顺序保持不变,您可以随时使用names(links) &lt;- Prot_ids
  • 哦,对不起,只是links,应该是lapply(links, function(x) x$links$protein_nuccore_mrna)。我会修好它。谢谢!

标签: r bioconductor ncbi rentrez


【解决方案1】:
library(rentrez)
Prot_ids <- c("XP_012370245.1","XP_004866438.1","XP_013359583.1")
links <- entrez_link(dbfrom="protein", db="nuccore", id=Prot_ids, by_id = TRUE)
linkids <- sapply(links, function(x) x$links$protein_nuccore_mrna)
##Get the summary for the gi record
linkNuc <- entrez_summary(id = linkids, db = "nuccore")

df <- data.frame(ProtIDs = Prot_ids[rep(sapply(links, function(x) length(x$links$protein_nuccore_mrna)))], 
                 linkids, 
                 NucID=sapply(strsplit(sapply(linkNuc, "[[", "extra"), split = "\\|"), "[", 4))

#                 ProtIDs   linkids          NucID
#820968283 XP_012370245.1 820968283 XM_012514791.1
#861491027 XP_012370245.1 861491027 XM_004866381.2
#918634580 XP_012370245.1 918634580 XM_013504129.1

【讨论】:

  • 这正是我想要的,非常感谢!
猜你喜欢
  • 2017-10-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-16
  • 1970-01-01
  • 2016-04-02
  • 2021-03-30
  • 2022-07-03
相关资源
最近更新 更多