我正在嘗試抓取ncbi 網站(https://www.ncbi.nlm.nih.gov/ Protein/29436380)來獲取蛋白質信息。我需要訪問gene_synonyms 和GeneID 字段。我嘗試使用chrome中的selectorGadget插件和ff中的代碼檢查器找到相關節點。我試過這段代碼:我正在嘗試抓取ncbi 網站(https://www.ncbi.nlm.nih.gov/ Protein/29436380)來獲取蛋白質信息。我需要訪問gene_synonyms 和GeneID 字段。我嘗試使用chrome中的selectorGadget插件和ff中的代碼檢查器找到相關節點。我試過這段代碼:require("dplyr")require("rvest")require("stringr")GIwebPage <- read_html("https://www.ncbi.nlm.nih.gov/protein/29436380")TestHTML <- GIwebPage %>% html_node("div.grid , div#maincontent.col.nine_col , div.sequence , pre.genebank , .feature") %>% html_text(trim = TRUE)然后我嘗試查找相關文本,但根本不存在。str_extract_all(TestHTML, pattern = "(synonym).{30}") [[1]] character(0)str_extract_all(TestHTML, pattern = "(GeneID:).{30}") [[1]] character(0)我似乎正在訪問的只是右側列的一些文本內容。str_extract_all(TestHTML, pattern = "(protein).{30}") [[1]] [1] "protein codes including ambiguities a" [2] "protein sequence for myosin-9 (NP_00" [3] "protein should not be confused with t" [4] "protein, partial [Homo sapiens]gi|294" [5] "protein codes including ambiguities a"我已經嘗試了很多節點選擇與 html_node() 的組合,以至于我不知道該嘗試什么。該內容是否隱藏在我看不到的某些結構中?或者我只是不夠熟練,無法實現要選擇的節點?
- 0 回答
- 0 關注
- 162 瀏覽
添加回答
舉報
0/150
提交
取消