提问人:Lisa W 提问时间:10/2/2023 最后编辑:Lisa W 更新时间:10/2/2023 访问量:34
R:如何使用 rentrez 提取 PubMed 摘要
R: how to extract a PubMed abstract using rentrez
问:
library(rentrez)
record <- entrez_fetch(db = "pubmed", id = 37757828, rettype = "xml", parsed = TRUE)
给定一个 PubMed id,我想从 .具体来说,我想提取record
<AbstractText>
...
</AbstractText>
我尝试首先使用以下方法解析它,但出现错误:
library(XML)
> xmlParse(record)
Error in as.vector(x, "character") :
cannot coerce type 'externalptr' to vector of type 'character'
答:
1赞
TarJae
10/2/2023
#1
以下是我们是如何做到的:
library(XML)
library(rentrez)
record <- entrez_fetch(db = "pubmed", id = 37757828, rettype = "xml", parsed = TRUE)
abstract_nodes <- xpathSApply(record, "//AbstractText", xmlValue)
if (length(abstract_nodes) > 0) {
abstract_text <- abstract_nodes[[1]]
print(abstract_text)
} else {
print("No abstract found.")
}
[1] "Autozygosity is associated with rare Mendelian disorders and clinically relevant quantitative traits. We investigated associations between the fraction of the genome in runs of homozygosity (FROH) and common diseases in Genes & Health (n = 23,978 British South Asians), UK Biobank (n = 397,184), and 23andMe. We show that restricting analysis to offspring of first cousins is an effective way of reducing confounding due to social/environmental correlates of FROH. Within this group in G&H+UK Biobank, we found experiment-wide significant associations between FROH and twelve common diseases. We replicated associations with type 2 diabetes (T2D) and post-traumatic stress disorder via within-sibling analysis in 23andMe (median n = 480,282). We estimated that autozygosity due to consanguinity accounts for 5%-18% of T2D cases among British Pakistanis. Our work highlights the possibility of widespread non-additive genetic effects on common diseases and has important implications for global populations with high rates of consanguinity."
评论