<p>This is easy. If you set</p>
<pre><code>expect=1000,
</code></pre>
<p>to</p>
<pre><code>expect=100,
</code></pre>
<p>It will work. NCBI servers impose a tighter restriction on the CLI whilst the web restriction is 5000.</p>
<p>If you require a <code>1000</code> restriction then out of (US) hours blasting is required, e.g. weekends.</p>
<hr />
<p>The Perl Blast API is here
<a href="https://blast.ncbi.nlm.nih.gov/docs/web_blast.pl" rel="nofollow noreferrer">https://blast.ncbi.nlm.nih.gov/docs/web_blast.pl</a></p>
<p>The documentation is here <a href="https://ncbi.github.io/blast-cloud/dev/api.html" rel="nofollow noreferrer">https://ncbi.github.io/blast-cloud/dev/api.html</a></p>
<p>Normally you need to modify it, that would be a separate question. This will work in default mode.</p>

CC BY-SA 4.0
2023-11-01T17:40:36.633Z
I will try this straight away, I am curious if that was documented anywhere though? as I didn't recall any mention of that in the doc of NCBIWWW's function (could have missed it).
Bas Jansen
CC BY-SA 4.0
2023-11-01T18:03:05.993Z
This would also mean that the short_query parameter can only be run on the weekends, as it sets expect to a 1000 *ponder*.
Bas Jansen
CC BY-SA 4.0
2023-11-01T18:16:47.260Z
I have raised the issue. If this doesn't work there is a direct Perl API that definitely works for 100.
M__
CC BY-SA 4.0
2023-11-01T18:29:52.580Z
I am still waiting for a response of the snippet, for well over 10 minutes, as such I can't say if it is working, yet.
Bas Jansen
CC BY-SA 4.0
2023-11-02T16:16:43.057Z
@BasJansen the Perl Api is at the web address posted above.
M__
CC BY-SA 4.0
2023-11-02T19:48:06.657Z
Much appreciated, the expect was indeed the issue it seems.
Bas Jansen
CC BY-SA 4.0
2023-11-02T20:06:16.440Z
Many thanks, glad its worked
M__
CC BY-SA 4.0
2023-11-01T17:29:59.197Z
2023-11-02T16:16:06.957Z
2023-11-02T16:16:06.957Z
M__
<p>I am trying to create a simple pipeline that takes a file containing various short sequences, and run them through blast. I have an example sequence;</p>
<pre><code>&gt;some_random_sequence
AAGGTTCGGTCCAAATTGAA
</code></pre>
<p>which returns a hit for FUT3 (using the RefSeq_Gene DB and using grch38 as an entrez_query). However, when I try to run this using NCBIWWW (Biopython) I don't get any results and I would like to figure out why.</p>
<p>A snippet that contains the call that I am using, is listed here;</p>
<pre class="lang-py prettyprint-override"><code>from Bio.Blast import NCBIWWW
from io import StringIO

sequence=['&gt;some_random_sequence\n','AAGGTTCGGTCCAAATTGAA']

lines = &quot;&quot;.join(sequence)
file = StringIO(lines)
results = NCBIWWW.qblast(
    program=&quot;blastn&quot;,
    database=&quot;RefSeq_Gene&quot;,
    entrez_query=&quot;grch38&quot;,
    sequence=file.read(),
    # Manually setting the parameters because short_query checks the length
    # of the sequence, but for some reason includes the name (resulting in
    # a length of 42, and thus defeating the entire purpose of using
    # short_query (which does a if len(sequence) &lt; 31).
    expect=1000,
    word_size=7,
    nucl_reward=1,
    filter=None,
    lcase_mask=None,
    # short_query=True,
)
with open('test_output.xml', 'w') as save_file:
    blast_results = results.read()
    save_file.write(blast_results)
</code></pre>

CC BY-SA 4.0
2023-11-03T03:52:10.350Z
This seems like it might be an [XY problem](https://en.wikipedia.org/wiki/XY_problem). Could you please add some more context around the question that you're asking? What are you trying to do with BLAST? What do you plan to do with the BLAST results once you see them?
gringer
<blast><biopython>
Blastn through NCBIWWW not giving any results, as opposed to the online BLAST
# Blastn through NCBIWWW not giving any results, as opposed to the online BLAST

(Asked by: username_0 on 2023-11-01)

I am trying to create a simple pipeline that takes a file containing various short sequences, and run them through blast. I have an example sequence;
>some_random_sequence
AAGGTTCGGTCCAAATTGAA

which returns a hit for FUT3 (using the RefSeq_Gene DB and using grch38 as an entrez_query). However, when I try to run this using NCBIWWW (Biopython) I don't get any results and I would like to figure out why.
A snippet that contains the call that I am using, is listed here;
from Bio.Blast import NCBIWWW
from io import StringIO

sequence=['>some_random_sequence\n','AAGGTTCGGTCCAAATTGAA']

lines = "".join(sequence)
file = StringIO(lines)
results = NCBIWWW.qblast(
    program="blastn",
    database="RefSeq_Gene",
    entrez_query="grch38",
    sequence=file.read(),
    # Manually setting the parameters because short_query checks the length
    # of the sequence, but for some reason includes the name (resulting in
    # a length of 42, and thus defeating the entire purpose of using
    # short_query (which does a if len(sequence) < 31).
    expect=1000,
    word_size=7,
    nucl_reward=1,
    filter=None,
    lcase_mask=None,
    # short_query=True,
)
with open('test_output.xml', 'w') as save_file:
    blast_results = results.read()
    save_file.write(blast_results)

**Tags:** blast, biopython
> **Comments:**
> **username_1**: This seems like it might be an [XY problem](https://en.wikipedia.org/wiki/XY_problem). Could you please add some more context around the question that you're asking? What are you trying to do with BLAST? What do you plan to do with the BLAST results once you see them?  

---

## 1 answers

### Answer by username_2 on 2023-11-01. Score: 2 | Accepted answer

This is easy. If you set
expect=1000,

to
expect=100,

It will work. NCBI servers impose a tighter restriction on the CLI whilst the web restriction is 5000.
If you require a 1000 restriction then out of (US) hours blasting is required, e.g. weekends.

The Perl Blast API is here
https://blast.ncbi.nlm.nih.gov/docs/web_blast.pl
The documentation is here https://ncbi.github.io/blast-cloud/dev/api.html
Normally you need to modify it, that would be a separate question. This will work in default mode.

> **Comments:**
> **username_0**: I will try this straight away, I am curious if that was documented anywhere though? as I didn't recall any mention of that in the doc of NCBIWWW's function (could have missed it).  
> **username_0**: This would also mean that the short_query parameter can only be run on the weekends, as it sets expect to a 1000 *ponder*.  
> **username_2**: I have raised the issue. If this doesn't work there is a direct Perl API that definitely works for 100.  
> **username_0**: I am still waiting for a response of the snippet, for well over 10 minutes, as such I can't say if it is working, yet.  
> **username_2**: @BasJansen the Perl Api is at the web address posted above.  
> **username_0**: Much appreciated, the expect was indeed the issue it seems.  
> **username_2**: Many thanks, glad its worked  

---

