I'm pretty new in bioinformatics.

I need to download FASTA sequences of several genes. The list of genes I have assembled consists of 140 genes, so I'd rather do this through via code than download each gene manually from the NCBI database.

The genes belong to 2 different organisms (bacteria) I have chosen, most of them are found in both organisms and some are specific to one or the other bacterium.

I've tried running this code which I found here: https://www.ncbi.nlm.nih.gov/books/NBK179288/

esearch -db nucleotide -query "aminoacyl-tRNA\ hydrolase" | efetch -format fasta

The gene of interest being aminoacyl-tRNA hydrolase here. But I don't know how to filter it for the specific organism, Neisseria meningitidis. Tried running this, without luck:

esearch -db nucleotide -query "aminoacyl-tRNA\ hydrolase" | efilter -organism [Neisseria meningitidis] | efetch -format fasta

Appreciate any help :)

  • 3
    $\begingroup$ Hi how does the list of 140 gene you are interested in look like? do you have gene accessions, or Ids or just gene symbols?, ie symbol: BRCA1 ; id : 672 ; accsession NC_000017.11 , are all the same gene. $\endgroup$ Commented Dec 4, 2022 at 23:40
  • $\begingroup$ what output do you get from your commands? nothing, an error, the wrong gene? $\endgroup$ Commented Dec 5, 2022 at 6:36
  • $\begingroup$ Yes, please edit your question and add a few lines of your input file. Presumably, you have a list of genes, so please show us the list so we can understand the input format. $\endgroup$
    – terdon
    Commented Dec 5, 2022 at 9:51
  • $\begingroup$ @user12256545 Right now I have the list on a word-document with locus name and gene-ID (that would be "pth" and 61281026 for aminoacyl-tRNA hydrolase). All genes seem to have the same accession nr. so that won't be useful unfortunately. $\endgroup$
    – Vjon
    Commented Dec 6, 2022 at 9:34

1 Answer 1


If I put the species name in quotes, I get expected (by me) output:

% esearch -db nucleotide -query "aminoacyl-tRNA\ hydrolase" | efilter -organism "Neisseria meningitidis" | efetch -format fasta
# outputs:
>NZ_JWNU01000010.1 Neisseria meningitidis strain Nm440716 Scaffold10, whole genome shotgun sequence
# [snip, tons of output]

Note that filtering down to only N. meningitidis still leaves all of the different sequenced accessions of this species, such that you will still have a lot of different annotated copies of this gene. You will need to filter more specifically to reduce that.

  • $\begingroup$ This was helpful, thank you! What would you suggest I use as identifier to filter more specifically? I tried substituting "aminoacyl-tRNA\ hydrolase" with gene-ID (61281026) but that doesn't seem to work. $\endgroup$
    – Vjon
    Commented Dec 6, 2022 at 10:19
  • 2
    $\begingroup$ @Vjon I would suggest trying an NCBI taxid in place of the species name. $\endgroup$ Commented Dec 6, 2022 at 20:01

Your Answer

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

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