Answers.Body: <p>This can be done using the <a href="https://www.ncbi.nlm.nih.gov/books/NBK25498/#chapter3.ESearch__ESummaryEFetch" rel="nofollow noreferrer">NCBI eutils command-line tools</a>. For taxa, the <a href="https://www.biostars.org/p/58955/" rel="nofollow noreferrer">correct incantation</a> for the search string is <code>txid&lt;taxID&gt;[Organism]</code> (assuming you want that taxon and all its children), but I haven't found the right one for the product field. However, it can be approximated by searching for a string in the tile line via <code>&lt;search&gt;[TITL]</code>. This seems to work fairly well, assuming you want the fasta files (the <code>-format</code> argument can be changed to <code>genbank</code> if you want the genbank record instead):</p>
  <pre><code>$ esearch -db nuccore -query &quot;txid1238[Organism] AND 16s[TITL]&quot; | efetch -format fasta | grep -A 1 '^&gt;' | head
  &gt;MW433822.1 Piscirickettsia salmonis strain HRV16 16S ribosomal RNA gene, partial sequence
  TCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAACATGACTAGCTTGCTAGTTGA
  --
  &gt;MW433821.1 Piscirickettsia salmonis strain HRV13 16S ribosomal RNA gene, partial sequence
  AATTTCAGGTGTAGCGGTGAAATGCGTAGATATCTGAAGGAACACCGGTGGCGAAGGCGACTTTCTGGAT
  --
  &gt;MN023100.1 Piscirickettsia salmonis clone Ps18621-6 16S ribosomal RNA gene, partial sequence
  GCTTGCTAGATGCTGACGAGTGGCGGACGGGTGAGTAACGCGTGGGAATTTACCTTTTAGTGGGGGATAA
  --
  &gt;MN023099.1 Piscirickettsia salmonis clone Ps18429-3 16S ribosomal RNA gene, partial sequence
  </code></pre>
  <p>Unfortunately I can't find anything for searching specifically in the features of an NCBI record. There'll be some way to do it; I just don't know how.</p>
  <p>Based on the updated request, it's possible to do a full-text search through the entire metadata (e.g. for <code>16S ribosomal RNA</code>) by adding the search term without specifying a field. Depending on what you want to do with the results, and how many were produced, it could be easy enough to manually unwanted sequences (e.g. whole genome shotgun assemblies, or chimeric products):</p>
  <pre><code>$ esearch -db nuccore -query &quot;txid1238[Organism:exp] AND (16S ribosomal RNA)&quot; | efetch -format fasta | grep -A 1 '^&gt;' --no-group-separator | tail -n 12
  &gt;EU170254.1 Piscirickettsia salmonis strain NVI 5692 16S ribosomal RNA gene, partial sequence
  CACATGCAAGTCGAACGGTAGCAGATCTAGCTTGCTAGATGCTGACGAGTGGCGGACGGGTGAGTAACGC
  &gt;U36941.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  &gt;U55015.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  &gt;U36942.1 Piscirickettsia salmonis strain NOR-92 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  &gt;U36940.1 Piscirickettsia salmonis strain EM-90 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCATGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  &gt;U36915.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCATGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  </code></pre>
  <p>FWIW, here's the list of all the searchable fields in the <code>nuccore</code> database:</p>
  <pre><code>$ einfo -db nuccore -fields
  ACCN    Accession
  ALL     All Fields
  ASSM    Assembly
  AUTH    Author
  BIOS    BioSample
  BRD     Breed
  COMP    Component Accession
  CULT    Cultivar
  DIV     Division
  ECNO    EC/RN Number
  FILT    Filter
  FKEY    Feature key
  GENE    Gene Name
  GPRJ    BioProject
  ISOL    Isolate
  ISS     Issue
  JOUR    Journal
  KYWD    Keyword
  MDAT    Modification Date
  ORGN    Organism
  PACC    Primary Accession
  PAGE    Page Number
  PDAT    Publication Date
  PORG    Primary Organism
  PROP    Properties
  PROT    Protein Name
  SLEN    Sequence Length
  SQID    SeqID String
  STRN    Strain
  SUBS    Substance Name
  TITL    Title
  UID     UID
  VOL     Volume
  WORD    Text Word
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-22T06:16:09.063Z
Answers.LastActivityDate: 2023-04-23T04:47:44.170Z
Answers.LastEditDate: 2023-04-23T04:47:44.170Z
Answers.UserDisplayName: gringer
Answers.Body: <p>To specifically answer the question the search that is used is</p>
  <pre><code>((1000:1500[Sequence Length]) AND Piscirickettsia salmonis[Organism]) AND 16S
  </code></pre>
  <p>That is place <a href="https://www.ncbi.nlm.nih.gov" rel="nofollow noreferrer">here</a> and select 'nucleotide'.</p>
  <p>Genbank uses taxon id internally, it's a database reference not a biological code, and can't be used as input - its completely unique to Genbank. Anyway the search results in 276 records, and are shown <a href="https://www.ncbi.nlm.nih.gov/nuccore/?term=((1000%3A1500%5BSequence%20Length%5D)%20AND%20Piscirickettsia%20salmonis%5BOrganism%5D)%20AND%2016s" rel="nofollow noreferrer">here</a>, this is near full length 16S thats cool.</p>
  <p><strong>Clarification</strong> <code>[taxon id]</code> is not a field in Genbank, it's a database code, the tag is <code>[organism]</code>.  Genbank knows what 16S is - its the most famous genetic marker in microbiology - so there is no need for a <code>[tag]</code></p>
  <p>At the base of the page there is a &quot;Send to:&quot; option (right hand corner). Click and then select &quot;File&quot;. The 276 sequences will then download.</p>
  <p>If <code>[Sequence length]</code> is removed this result 3820 sequences <a href="https://www.ncbi.nlm.nih.gov/nuccore/?term=(Piscirickettsia%20salmonis%5BOrganism%5D)%20AND%2016s" rel="nofollow noreferrer">here</a>. There are some 16S-23S sequences on the database result in a 2,198 bp length, so extending the sequence length will trap these by <code>1000:2200[Sequence Length]</code>. There are 431 bp sequences - which are not cool at all, probably a lot.</p>
  <p>The approach used below identifies nearly 1000 is complicated it traps everything of relevance which is close to full length and cuts out the 16S from  2,198 bp length and beyond. The 431 bp partial 16S sequences have been removed. Thus the numbers below are the idealised data set, so its about 1000 sequences and the tree will guide you into major groups - which is probably what is wanted, i.e. to place a 16S from a local salmon farm into the broader clade diversity of the species.</p>
  <hr />
  <p>The answer is for this species is there are around a thousand sequences on Genbank for the species of interest which are split into 6 identical genotypic groups. The demonstration of the species is represented by the scale bar, i.e. it is very little genetic diversity.</p>
  <p><a href="https://i.sstatic.net/OgU6r.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OgU6r.png" alt="enter image description here" /></a></p>
  <p><em>Cycloclausticus sp</em> is the outgroup and each member of the in-group is <em>Piscirickettsia salmonis</em></p>
  <hr />
  <p>Just to address the comments</p>
  <ul>
  <li>&quot;Cycloclasticus&quot;? The question is not specific to /db_xref=&quot;taxon:1238&quot;</li>
  </ul>
  <p>It is specific there's a fundamental principle of trees. A tree needs a root, all the ingroups are all <em>Piscirickettsia salmonis</em>. Without a root, i.e. something that is not <em>Piscirickettsia salmonis</em> there is no direction in the tree. <em>Cycloclasticus</em> is a good or reasonable root.</p>
  <ul>
  <li>how do i access this interface?</li>
  </ul>
  <p>Its complicated to explain and its a different question.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-21T06:54:53.313Z
Answers.LastActivityDate: 2023-04-21T18:20:10.277Z
Answers.LastEditDate: 2023-04-21T18:20:10.277Z
Answers.UserDisplayName: M__
Body: <p>I want to search GenBank entries by gene product and taxon id.</p>
  <p>Taking the 16s rRNA as an example for a gene and Piscirickettsia salmonis (taxon:1238) for a taxon:</p>
  <blockquote>
  <p><a href="https://www.ncbi.nlm.nih.gov/nuccore/219846389" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/nuccore/219846389</a></p>
  </blockquote>
  <p>How do I retrieve all GenBank entries that have the following properties <strong>/product</strong>=&quot;16S ribosomal RNA&quot; and <strong>/db_xref</strong>=&quot;taxon:1238&quot;?</p>
  <p>Update: It would be appreciated if you also showed me how to retrieve GenBank entries like <a href="https://www.ncbi.nlm.nih.gov/nuccore/KC473400.1" rel="nofollow noreferrer">this</a>, which don't have an exact match to the &quot;16S ribosomal RNA&quot; product.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-21T06:46:49.080Z
Comments.Text: The research study that submitted this sequence was in chile, but I think I've seen other sequences for the same organism, also obtained from chile.
Comments.UserDisplayName: Freezing Soul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-21T06:50:34.640Z
Comments.Text: "The salmon, which displayed typical disease signs, was collected from a seawater netpen in southern Chile where an epizootic was in progress. "
  https://www.microbiologyresearch.org/content/journal/ijsem/10.1099/00207713-42-1-120
Comments.UserDisplayName: Freezing Soul
Tags: <genbank><sequence><16rrna><ncbi>
Title: How do i search by these gene properties in NCBI's GenBank?
ThreadText: # How do i search by these gene properties in NCBI's GenBank?
  
  (Asked by: username_0 on 2023-04-21)
  
  I want to search GenBank entries by gene product and taxon id.
  
  Taking the 16s rRNA as an example for a gene and Piscirickettsia salmonis (taxon:1238) for a taxon:
  
  > <https://www.ncbi.nlm.nih.gov/nuccore/219846389>
  
  How do I retrieve all GenBank entries that have the following properties **/product**="16S ribosomal RNA" and **/db\_xref**="taxon:1238"?
  
  Update: It would be appreciated if you also showed me how to retrieve GenBank entries like [this](https://www.ncbi.nlm.nih.gov/nuccore/KC473400.1), which don't have an exact match to the "16S ribosomal RNA" product.
  
  **Tags:** genbank, sequence, 16rrna, ncbi
  
  > **Comments:**
  > **username_0**: The research study that submitted this sequence was in chile, but I think I've seen other sequences for the same organism, also obtained from chile.  
  > **username_0**: "The salmon, which displayed typical disease signs, was collected from a seawater netpen in southern Chile where an epizootic was in progress. " https://www.microbiologyresearch.org/content/journal/ijsem/10.1099/00207713-42-1-120  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-04-22. Score: 1 | Accepted answer
  
  This can be done using the [NCBI eutils command-line tools](https://www.ncbi.nlm.nih.gov/books/NBK25498/#chapter3.ESearch__ESummaryEFetch). For taxa, the [correct incantation](https://www.biostars.org/p/58955/) for the search string is `txid<taxID>[Organism]` (assuming you want that taxon and all its children), but I haven't found the right one for the product field. However, it can be approximated by searching for a string in the tile line via `<search>[TITL]`. This seems to work fairly well, assuming you want the fasta files (the `-format` argument can be changed to `genbank` if you want the genbank record instead):
  
  ```
  $ esearch -db nuccore -query "txid1238[Organism] AND 16s[TITL]" | efetch -format fasta | grep -A 1 '^>' | head
  >MW433822.1 Piscirickettsia salmonis strain HRV16 16S ribosomal RNA gene, partial sequence
  TCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAACATGACTAGCTTGCTAGTTGA
  --
  >MW433821.1 Piscirickettsia salmonis strain HRV13 16S ribosomal RNA gene, partial sequence
  AATTTCAGGTGTAGCGGTGAAATGCGTAGATATCTGAAGGAACACCGGTGGCGAAGGCGACTTTCTGGAT
  --
  >MN023100.1 Piscirickettsia salmonis clone Ps18621-6 16S ribosomal RNA gene, partial sequence
  GCTTGCTAGATGCTGACGAGTGGCGGACGGGTGAGTAACGCGTGGGAATTTACCTTTTAGTGGGGGATAA
  --
  >MN023099.1 Piscirickettsia salmonis clone Ps18429-3 16S ribosomal RNA gene, partial sequence
  
  ```
  
  Unfortunately I can't find anything for searching specifically in the features of an NCBI record. There'll be some way to do it; I just don't know how.
  
  Based on the updated request, it's possible to do a full-text search through the entire metadata (e.g. for `16S ribosomal RNA`) by adding the search term without specifying a field. Depending on what you want to do with the results, and how many were produced, it could be easy enough to manually unwanted sequences (e.g. whole genome shotgun assemblies, or chimeric products):
  
  ```
  $ esearch -db nuccore -query "txid1238[Organism:exp] AND (16S ribosomal RNA)" | efetch -format fasta | grep -A 1 '^>' --no-group-separator | tail -n 12
  >EU170254.1 Piscirickettsia salmonis strain NVI 5692 16S ribosomal RNA gene, partial sequence
  CACATGCAAGTCGAACGGTAGCAGATCTAGCTTGCTAGATGCTGACGAGTGGCGGACGGGTGAGTAACGC
  >U36941.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  >U55015.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  >U36942.1 Piscirickettsia salmonis strain NOR-92 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCCTGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  >U36940.1 Piscirickettsia salmonis strain EM-90 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCATGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  >U36915.1 Piscirickettsia salmonis 16S ribosomal RNA gene, complete sequence
  AGAGTTTGATCATGGCTCAGATTGAACGCTGGTGGCATGCTTAACACATGCAAGTCGAACGGTAGCAGAT
  
  ```
  
  FWIW, here's the list of all the searchable fields in the `nuccore` database:
  
  ```
  $ einfo -db nuccore -fields
  ACCN    Accession
  ALL     All Fields
  ASSM    Assembly
  AUTH    Author
  BIOS    BioSample
  BRD     Breed
  COMP    Component Accession
  CULT    Cultivar
  DIV     Division
  ECNO    EC/RN Number
  FILT    Filter
  FKEY    Feature key
  GENE    Gene Name
  GPRJ    BioProject
  ISOL    Isolate
  ISS     Issue
  JOUR    Journal
  KYWD    Keyword
  MDAT    Modification Date
  ORGN    Organism
  PACC    Primary Accession
  PAGE    Page Number
  PDAT    Publication Date
  PORG    Primary Organism
  PROP    Properties
  PROT    Protein Name
  SLEN    Sequence Length
  SQID    SeqID String
  STRN    Strain
  SUBS    Substance Name
  TITL    Title
  UID     UID
  VOL     Volume
  WORD    Text Word
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2023-04-21. Score: -1
  
  To specifically answer the question the search that is used is
  
  ```
  ((1000:1500[Sequence Length]) AND Piscirickettsia salmonis[Organism]) AND 16S
  
  ```
  
  That is place [here](https://www.ncbi.nlm.nih.gov) and select 'nucleotide'.
  
  Genbank uses taxon id internally, it's a database reference not a biological code, and can't be used as input - its completely unique to Genbank. Anyway the search results in 276 records, and are shown [here](https://www.ncbi.nlm.nih.gov/nuccore/?term=((1000%3A1500%5BSequence%20Length%5D)%20AND%20Piscirickettsia%20salmonis%5BOrganism%5D)%20AND%2016s), this is near full length 16S thats cool.
  
  **Clarification** `[taxon id]` is not a field in Genbank, it's a database code, the tag is `[organism]`. Genbank knows what 16S is - its the most famous genetic marker in microbiology - so there is no need for a `[tag]`
  
  At the base of the page there is a "Send to:" option (right hand corner). Click and then select "File". The 276 sequences will then download.
  
  If `[Sequence length]` is removed this result 3820 sequences [here](https://www.ncbi.nlm.nih.gov/nuccore/?term=(Piscirickettsia%20salmonis%5BOrganism%5D)%20AND%2016s). There are some 16S-23S sequences on the database result in a 2,198 bp length, so extending the sequence length will trap these by `1000:2200[Sequence Length]`. There are 431 bp sequences - which are not cool at all, probably a lot.
  
  The approach used below identifies nearly 1000 is complicated it traps everything of relevance which is close to full length and cuts out the 16S from 2,198 bp length and beyond. The 431 bp partial 16S sequences have been removed. Thus the numbers below are the idealised data set, so its about 1000 sequences and the tree will guide you into major groups - which is probably what is wanted, i.e. to place a 16S from a local salmon farm into the broader clade diversity of the species.
  
  ---
  
  The answer is for this species is there are around a thousand sequences on Genbank for the species of interest which are split into 6 identical genotypic groups. The demonstration of the species is represented by the scale bar, i.e. it is very little genetic diversity.
  
  [![enter image description here](https://i.sstatic.net/OgU6r.png)](https://i.sstatic.net/OgU6r.png)
  
  *Cycloclausticus sp* is the outgroup and each member of the in-group is *Piscirickettsia salmonis*
  
  ---
  
  Just to address the comments
  
  * "Cycloclasticus"? The question is not specific to /db\_xref="taxon:1238"
  
  It is specific there's a fundamental principle of trees. A tree needs a root, all the ingroups are all *Piscirickettsia salmonis*. Without a root, i.e. something that is not *Piscirickettsia salmonis* there is no direction in the tree. *Cycloclasticus* is a good or reasonable root.
  
  * how do i access this interface?
  
  Its complicated to explain and its a different question.
  
  
  ---
  
  