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
partial[filter])"
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