Answers.Body: <p>For this particular query, try <a href="https://www.ncbi.nlm.nih.gov/nuccore/?term=host%3DBemisia%20tabaci%20B%5BWORD%5D" rel="nofollow noreferrer">host=Bemisia tabaci B[WORD]</a>.  However, you may also be interested in related queries like <a href="https://www.ncbi.nlm.nih.gov/nuccore/?term=host%3DBemisia%20tabaci%20B%20biotype%5BWORD%5D" rel="nofollow noreferrer">host=Bemisia tabaci B biotype[WORD]</a>.</p>
  <p>But, I am not sure a general solution exists, as I do not believe all qualifiers are indexed.</p>
  <hr />
  <p>Also, you can see how your query is interpreted on the right side under &quot;Search details&quot;.  For the original attempt (<code>[host]&quot;Bemisia tabaci B&quot;</code>), it is interpreted as:</p>
  <pre><code>host[All Fields] AND &quot;Bemisia tabaci B&quot;[All Fields]
  </code></pre>
  <p>while the goal is to produce</p>
  <pre><code>host=Bemisia tabaci B biotype[WORD]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-05T13:37:12.167Z
Answers.Text: Thanks for confirming it to me, the issue is indeed that this qualifier is not indexed. In the end, I downloaded the results as GenBank file for a much wider search, and then locally imported into BioSQL database where I was able to write queries for every qualifier and get the result I needed. It takes some effort, but the flexibility of running complex queries was amazing to have.
Answers.UserDisplayName: hlex
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-01T15:48:15.690Z
Answers.LastActivityDate: 2020-10-01T15:48:15.690Z
Answers.UserDisplayName: Brad Holmes
Body: <p>I cannot seem to find a way to query nucleotide database (<a href="https://www.ncbi.nlm.nih.gov/nuccore" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/nuccore</a>) by a specific qualifier of the feature. For example, by /host under the feature "source".
  For example, below is a part of one record, where the qualifier /host contains "Bemisia tabaci B".
  How could I search for all sequences that contain the word "Bemisia" in the qualifier \host?</p>
  
  <pre><code>FEATURES             Location/Qualifiers
   source          1..351658
                   /organism="Candidatus Portiera aleyrodidarum BT-B-HRs"
                   /mol_type="genomic DNA"
                   /strain="BT-B"
                   /host="Bemisia tabaci B"
                   /db_xref="taxon:1206109"
   gene            1..1926
                   /gene="dnaK"
                   /locus_tag="C530_RS00005"
                   /old_locus_tag="C530_001"
   CDS             1..1926
                   /gene="dnaK"
                   /locus_tag="C530_RS00005"
                   /old_locus_tag="C530_001"
                   /inference="COORDINATES: similar to AA
                   sequence:RefSeq:WP_014894920.1"
                   /note="Derived by automated computational analysis using
                   gene prediction method: Protein Homology."
                   /codon_start=1
                   /transl_table=11
                   /product="molecular chaperone DnaK"
                   /protein_id="WP_014894920.1"
                   /translation="MIRIIGIDLGTTNSCVAVLENGKSRVIENSEGARTTPSIIAYTD
                   DNEILIGQTAKRQAVTNPSNTLYAIKRLIGRKFNDDIVQKDIKMVPYKIVSAENGDAW
                   VQVKNRKLAPPQISAEILKKMKKTAEDYLGEKITEAVITVPAYFNDSQRQATKDAGRI
                   AGLNVKRIINEPTAAALAYGMDKNRGDKKIAVYDLGGGTFDISIIEIADVDGETQFEV
                   MATNGDTFLGGEDFDLKLINYIVKQFKLESGVDLSGDSLAMQRLKEAAEKGKIELSSS
                   QQTDINLPYITADKTGPKHLTLKITRAKLESLVEDLIKRSLLPCKKAIDDAKLTTKEI
                   DDIILVGGQTRMPLVQKKVAEFFGKEARKDVNPDEAVAMGAAIQGGVLGGDVKDVLLL
                   DVTPLTLGIETMGGIMTPLIEKNTTIPTKKTQIFSTAEDNQTAVTIHALQGERKKALQ
                   NKSLGRFDLTDIPPAPRGTPQIEVAFDLDANGILNITAKDKATGKEQSIIIKSSGGLS
                   EEEINKMIQDAETNKEEDKKFEELVQTRNQADGMIHTIRKTLKEIKNEDEKNKLESLI
                   NNLEQTLKSDDIKTIKEDLNKLTEEYSTIYQKIYSEKKPQNHNSEPAQKNAEKSSSKK
                   EGDVVDAEYEEVNNKTK"
                   ...
  </code></pre>
  
  <p>Best,
  Milan</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-05T14:55:43.943Z
Comments.Text: Doesn't it work if you just search for `[host]"Bemisia tabaci B"`?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-05T17:26:39.123Z
Comments.Text: @terdon Unfortunately it does not. If I try exactly as you wrote, it says "The following terms were ignored: [, ]".
  If I reverse the query to be "Bemisia tabaci B"[host], then the response is "Unknown field was ignored: [host]."
Comments.UserDisplayName: hlex
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-06T08:14:49.350Z
Comments.Text: Yes, it says `The following terms were ignored: [, ]`, but [the results](https://www.ncbi.nlm.nih.gov/nuccore/?term=%5Bhost%5D%22Bemisia+tabaci+B%22) seem to be what you're looking for, are they not?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-06T09:01:01.083Z
Comments.Text: Almost, it does include sequences that have the term in \host, but it also returns many sequences that do not have \host qualifier at all, but contain the term elsewhere, usually in the name of the sequence (DEFINITION). This is especially visible if you do [host]"Bemisia".
Comments.UserDisplayName: hlex
Tags: <database><phylogenetics><entrez>
Title: How to query NCBI (Nucleotide database) by a feature qualifier?
ThreadText: # How to query NCBI (Nucleotide database) by a feature qualifier?
  
  (Asked by: username_0 on 2020-05-05)
  
  I cannot seem to find a way to query nucleotide database (<https://www.ncbi.nlm.nih.gov/nuccore>) by a specific qualifier of the feature. For example, by /host under the feature "source".
  For example, below is a part of one record, where the qualifier /host contains "Bemisia tabaci B".
  How could I search for all sequences that contain the word "Bemisia" in the qualifier \host?
  
  ```
  FEATURES             Location/Qualifiers
   source          1..351658
                   /organism="Candidatus Portiera aleyrodidarum BT-B-HRs"
                   /mol_type="genomic DNA"
                   /strain="BT-B"
                   /host="Bemisia tabaci B"
                   /db_xref="taxon:1206109"
   gene            1..1926
                   /gene="dnaK"
                   /locus_tag="C530_RS00005"
                   /old_locus_tag="C530_001"
   CDS             1..1926
                   /gene="dnaK"
                   /locus_tag="C530_RS00005"
                   /old_locus_tag="C530_001"
                   /inference="COORDINATES: similar to AA
                   sequence:RefSeq:WP_014894920.1"
                   /note="Derived by automated computational analysis using
                   gene prediction method: Protein Homology."
                   /codon_start=1
                   /transl_table=11
                   /product="molecular chaperone DnaK"
                   /protein_id="WP_014894920.1"
                   /translation="MIRIIGIDLGTTNSCVAVLENGKSRVIENSEGARTTPSIIAYTD
                   DNEILIGQTAKRQAVTNPSNTLYAIKRLIGRKFNDDIVQKDIKMVPYKIVSAENGDAW
                   VQVKNRKLAPPQISAEILKKMKKTAEDYLGEKITEAVITVPAYFNDSQRQATKDAGRI
                   AGLNVKRIINEPTAAALAYGMDKNRGDKKIAVYDLGGGTFDISIIEIADVDGETQFEV
                   MATNGDTFLGGEDFDLKLINYIVKQFKLESGVDLSGDSLAMQRLKEAAEKGKIELSSS
                   QQTDINLPYITADKTGPKHLTLKITRAKLESLVEDLIKRSLLPCKKAIDDAKLTTKEI
                   DDIILVGGQTRMPLVQKKVAEFFGKEARKDVNPDEAVAMGAAIQGGVLGGDVKDVLLL
                   DVTPLTLGIETMGGIMTPLIEKNTTIPTKKTQIFSTAEDNQTAVTIHALQGERKKALQ
                   NKSLGRFDLTDIPPAPRGTPQIEVAFDLDANGILNITAKDKATGKEQSIIIKSSGGLS
                   EEEINKMIQDAETNKEEDKKFEELVQTRNQADGMIHTIRKTLKEIKNEDEKNKLESLI
                   NNLEQTLKSDDIKTIKEDLNKLTEEYSTIYQKIYSEKKPQNHNSEPAQKNAEKSSSKK
                   EGDVVDAEYEEVNNKTK"
                   ...
  
  ```
  
  Best,
  Milan
  
  **Tags:** database, phylogenetics, entrez
  
  > **Comments:**
  > **username_1**: Doesn't it work if you just search for `[host]"Bemisia tabaci B"`?  
  > **username_0**: @username_1 Unfortunately it does not. If I try exactly as you wrote, it says "The following terms were ignored: [, ]". If I reverse the query to be "Bemisia tabaci B"[host], then the response is "Unknown field was ignored: [host]."  
  > **username_1**: Yes, it says `The following terms were ignored: [, ]`, but [the results](https://www.ncbi.nlm.nih.gov/nuccore/?term=%5Bhost%5D%22Bemisia+tabaci+B%22) seem to be what you're looking for, are they not?  
  > **username_0**: Almost, it does include sequences that have the term in \host, but it also returns many sequences that do not have \host qualifier at all, but contain the term elsewhere, usually in the name of the sequence (DEFINITION). This is especially visible if you do [host]"Bemisia".  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-10-01. Score: 1 | Accepted answer
  
  For this particular query, try [host=Bemisia tabaci B[WORD]](https://www.ncbi.nlm.nih.gov/nuccore/?term=host%3DBemisia%20tabaci%20B%5BWORD%5D). However, you may also be interested in related queries like [host=Bemisia tabaci B biotype[WORD]](https://www.ncbi.nlm.nih.gov/nuccore/?term=host%3DBemisia%20tabaci%20B%20biotype%5BWORD%5D).
  
  But, I am not sure a general solution exists, as I do not believe all qualifiers are indexed.
  
  ---
  
  Also, you can see how your query is interpreted on the right side under "Search details". For the original attempt (`[host]"Bemisia tabaci B"`), it is interpreted as:
  
  ```
  host[All Fields] AND "Bemisia tabaci B"[All Fields]
  
  ```
  
  while the goal is to produce
  
  ```
  host=Bemisia tabaci B biotype[WORD]
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for confirming it to me, the issue is indeed that this qualifier is not indexed. In the end, I downloaded the results as GenBank file for a much wider search, and then locally imported into BioSQL database where I was able to write queries for every qualifier and get the result I needed. It takes some effort, but the flexibility of running complex queries was amazing to have.  
  
  ---
  
  