我有一堆蛋白质ID,我想获取相应的编码序列( CDSs ),而不丢失蛋白质ID。我已经下载了相应的CDSs,但不幸的是,CDSs 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)然后,我使用这个命令将蛋白质I与CDS I“匹配”:
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
任何建议都非常欢迎,谢谢!
发布于 2017-05-23 22:12:42
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.1https://stackoverflow.com/questions/44145435
复制相似问题