Skip to content

Commit

Permalink
max retmax as an argument in id mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiaoyi0504 committed Mar 21, 2018
1 parent 054e70a commit 705a4e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dc/utils.py
Expand Up @@ -8,23 +8,23 @@
Entrez.email = "hsiaoyi0504@gmail.com"


def get_pubmed_ids_from_phenotypes(phenotypes):
def get_pubmed_ids_from_phenotypes(phenotypes, retmax=200):
pubmed_ids = []
for phen in phenotypes:
query = phen
handle = Entrez.esearch(db='pubmed', term=query, rettype='medline', retmode='text', retmax=200)
handle = Entrez.esearch(db='pubmed', term=query, rettype='medline', retmode='text', retmax=retmax)
record = Entrez.read(handle)
handle.close()
idList = record['IdList']
pubmed_ids.extend(idList)
return list(set(pubmed_ids))


def get_pubmed_ids_from_rsids(rsids):
def get_pubmed_ids_from_rsids(rsids, retmax=200):
pubmed_ids = []
for id in rsids:
query = 'rs' + id + 'AND pubmed_snp_cited[sb]'
handle = Entrez.esearch(db='pubmed', term=query, rettype="medline", retmode="text", retmax=200)
handle = Entrez.esearch(db='pubmed', term=query, rettype="medline", retmode="text", retmax=retmax)
record = Entrez.read(handle)
handle.close()
idList = record['IdList']
Expand Down

0 comments on commit 705a4e6

Please sign in to comment.