Python 浏览器搜索与Bio.entrez搜索的结果不同

Python 浏览器搜索与Bio.entrez搜索的结果不同,python,bioinformatics,biopython,pubmed,Python,Bioinformatics,Biopython,Pubmed,当我使用Bio Entrez进行搜索时,我得到了不同的结果。例如,当我在浏览器上使用查询“新冠病毒副作用”进行搜索时,我得到了344个结果,而当我使用Bio-Entrez时,我只得到了92个结果。这是我使用的代码 from Bio import Entrez Entrez.email = "Your.Name.Here@example.org" handle = Entrez.esearch(db="pubmed", retmax=40, term=&qu

当我使用Bio Entrez进行搜索时,我得到了不同的结果。例如,当我在浏览器上使用查询“新冠病毒副作用”进行搜索时,我得到了344个结果,而当我使用Bio-Entrez时,我只得到了92个结果。这是我使用的代码

from Bio import Entrez
Entrez.email = "Your.Name.Here@example.org"
handle = Entrez.esearch(db="pubmed", retmax=40, term="covid side effect", idtype="acc")
record = Entrez.read(handle)
handle.close()
print(record['Count'])

我希望有人能帮我解决这个问题。

出于某种原因,无论是R api还是Python api,每个人似乎都有相同的问题。我已经找到了一个方法来获得同样的结果。虽然速度很慢,但它完成了任务。如果您的结果小于10k,您可以使用Selenium获得pubmedid。否则,我们可以使用下面的代码刮取数据。我希望这将有助于未来的人

import requests
# # Custom Date Range
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=dates.2009/01/01-2020/03/01&format=pmid&sort=pubdate&size=200&page={}".format(i))

# # Custom Year Range
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=years.2010-2019&format=pmid&sort=pubdate&size=200&page={}".format(i))


# #Relative Date 
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=datesearch.y_1&format=pmid&sort=pubdate&size=200&page={}".format(i))

# # filter language 
# # &filter=lang.english

# # filter human 
# #&filter=hum_ani.humans

# Systematic Review
#&filter=pubt.systematicreview

# Case Reports 
# &filter=pubt.casereports

# Age
# &filter=age.newborn

search = "covid lungs"
# search_list = "+".join(search.split(' '))

def id_retriever(search_string):
    string = "+".join(search_string.split(' '))
    result = []
    old_result = len(result)
    for page in range(1,10000000):
        req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term={string}&format=pmid&sort=pubdate&size=200&page={page}".format(page=page,string=string))

        for j in req.iter_lines():
            decoded = j.decode("utf-8").strip(" ")
            length = len(decoded)
            if "log_displayeduids" in decoded and length > 46:
                data = (str(j).split('"')[-2].split(","))
                result = result + data
                data = []
        new_result = len(result)
        if new_result != old_result:
            old_result = new_result
        else:
            break
    return result

ids=id_retriever(search)
len(ids)

出于某种原因,无论是R api还是Python api,每个人似乎都有相同的问题。我已经找到了一个方法来获得同样的结果。虽然速度很慢,但它完成了任务。如果您的结果小于10k,您可以使用Selenium获得pubmedid。否则,我们可以使用下面的代码刮取数据。我希望这将有助于未来的人

import requests
# # Custom Date Range
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=dates.2009/01/01-2020/03/01&format=pmid&sort=pubdate&size=200&page={}".format(i))

# # Custom Year Range
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=years.2010-2019&format=pmid&sort=pubdate&size=200&page={}".format(i))


# #Relative Date 
# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=datesearch.y_1&format=pmid&sort=pubdate&size=200&page={}".format(i))

# # filter language 
# # &filter=lang.english

# # filter human 
# #&filter=hum_ani.humans

# Systematic Review
#&filter=pubt.systematicreview

# Case Reports 
# &filter=pubt.casereports

# Age
# &filter=age.newborn

search = "covid lungs"
# search_list = "+".join(search.split(' '))

def id_retriever(search_string):
    string = "+".join(search_string.split(' '))
    result = []
    old_result = len(result)
    for page in range(1,10000000):
        req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term={string}&format=pmid&sort=pubdate&size=200&page={page}".format(page=page,string=string))

        for j in req.iter_lines():
            decoded = j.decode("utf-8").strip(" ")
            length = len(decoded)
            if "log_displayeduids" in decoded and length > 46:
                data = (str(j).split('"')[-2].split(","))
                result = result + data
                data = []
        new_result = len(result)
        if new_result != old_result:
            old_result = new_result
        else:
            break
    return result

ids=id_retriever(search)
len(ids)

奇怪的是,在PubMed(匹配Biopython)下,它看起来像是93,但当你点击@Chris_Rands时,它就>350了,这真的很奇怪。这似乎是一个众所周知的问题。我根本找不到解决这个问题的办法。这个数字可能会增加,因为可能会有新的出版物:D@Chris_Rands,我找到了解决这个问题的方法,但我认为pubmed API返回的结果不一样肯定有问题,在pubmed(匹配的Biopython)下看起来是93,但是当你点击@Chris_Rands的时候,它就>350了,这真的很奇怪。这似乎是一个众所周知的问题。我根本找不到解决这个问题的办法。这个数字可能会增加,因为可能会有新的出版物:D@Chris_Rands,我找到了解决此问题的方法,但我认为pubmed API没有返回相同的结果肯定有问题