I'm trying to reproduce a complex manual search on NCBI using BioPython, but obviously something is not right. My command line is not working, but I'd especially like a way to have an accurate search where I can select only the genomes related to a published paper. Is there an easy way to do that?

I want to limit my results to only those genomes that i) have an NCBI BioProject entry and ii) that BioProject entry contains a Publications field.

For example, let's say I want all the genomes of Microbacterium, the latest version, from RefSeq and not partial (this is what I tried to write but something is not working) and I would like to add one more filter. Take, among the remaining/selected genomes, only the ones related to published papers.

For this strain, we have a related paper: https://www.ncbi.nlm.nih.gov/bioproject/PRJNA669461/

For this one, we do not: https://www.ncbi.nlm.nih.gov/bioproject/PRJNA608230/

and I really would like to not have to check 100 genomes manually, but I don't know how to manage it.

I tried:

query = "Microbacterium[Organism] AND latest refseq[filter] AND (all[filter] NOT
handle = Entrez.esearch(term=query, db="Assembly", retmax=600)
ids = Entrez.read(handle)["IdList"]

And after this, I'm just using a for loop to get genomes, but my query is not good and it is not handling the problem of the publication.

Thanks for any help!

Edit : as I need to search in the db Assembly unfortunately the answer with the flag author or date is not working


1 Answer 1


Entrez has the tags [journal], [volume], [page number], [title], [year] and [author] to identify all sequences from a given publication. You will find a full list of tags here from the drop down menu.


query = "Microbacterium[Organism] AND Nature[Journal] AND 528[volume] AND Bai[author] AND 364[page number]"

This will identify all Microbacterium genome sequences associated with Bai et al (2015) Nature 528:364- and is here.

For practical purposes I routinely search using the organism and author tags for their sequence output.

The example given (post-edit) was

Kim KK et al., "Microbacterium aquimaris sp. nov., isolated from seawater.", Int J Syst Evol Microbiol, 2008 Jul;58(Pt 7):1616-20

query = "Microbacterium[Organism] AND 58[volume] AND Kim[author] AND 1616[page number] AND 2008[year]"

I removed the [journal] tag because the abbreviation it uses is a bit unusual and replaced it with [year]. Still works here.

From the comments ... if only published sequences were required then using the range function and [publication date] is one way in ...

query = "Microbacterium[Organism] AND 2000/1/1:2020/1/1[publication date]"

The best strategy is to use the [author] because data production tends to be dominated by a small number of groups.

Comments of Comments

Why isn't searching working. The following search works

query = "Microbacterium[Organism] AND (all[filter] NOT partial[filter])"

The term it doesn't like is latest refseq[filter] if that is removed it will work. refseq works, but it doesn't like latest.

  • $\begingroup$ I think the OP wants to limit the results to only those genomes whose NCBI BioProject entry includes a Publications field. $\endgroup$
    – terdon
    Feb 8 at 19:03
  • $\begingroup$ @terdon I don't believe there is a tag [publication], there is [publication date], which is better than [year]. However, it's the same answer, the sequence output of most fields are represented only by a small number of authors and only those authors are searched. $\endgroup$
    – M__
    Feb 8 at 19:08
  • 1
    $\begingroup$ @M__ thanks a lot for your help ! your range idea it's pretty clever, it will already be much better than checking by hand! $\endgroup$ Feb 8 at 20:28
  • 1
    $\begingroup$ @M__ by the way, do you have any idea why my current research is not returning anything? $\endgroup$ Feb 8 at 20:35
  • 1
    $\begingroup$ @M__ thanks for your answer. I arrived in the same point but i need both, latest and refseq. For me latest is working with organism and no partial but refseq is not working even alone. do you have results with Microbacterium[Organism] AND refseq[Filter]? could it be related to version ? $\endgroup$ Feb 8 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.