12
$\begingroup$

I am currently exploring the BLAST program, just for testing purpose i generated two FASTA files, containing two genes A and B, such that B is just a motif of repeated 'G's that occurs in A.

file A.fna:

>A
ACCAACAGACGGGGGGGGGGGGGAGAAAACCGGCCCCCGCAGGGACGCCACCCAGAGGGAAGGG

file B.fna:

>B
GGGGGGGGGGGG

So by my understanding BLAST should find the local alignment of B in A easily? But the program returns 'No hits found'? Maybe I am doing something wrong here?

I executed the following:

makeblastdb -in A.fna -dbtype 'nucl'
makeblastdb -in B.fna -dbtype 'nucl'
blastn -db A.fna -query B.fna

output of blastn:

BLASTN 2.7.1+


Reference: Zheng Zhang, Scott Schwartz, Lukas Wagner, and Webb Miller (2000), "A greedy algorithm for aligning DNA sequences", J Comput Biol 2000; 7(1-2):203-14.



Database: A.fna
           1 sequences; 64 total letters



Query= B

Length=12


***** No hits found *****



Lambda      K        H
    1.33    0.621     1.12 

Gapped Lambda      K        H
    1.28    0.460    0.850 

Effective search space used: 480


  Database: A.fna
    Posted date:  May 3, 2018  5:17 PM   Number of letters in database: 64   Number of sequences in database:  1



Matrix: blastn matrix 1 -2 Gap Penalties: Existence: 0, Extension: 2.5

Thanks for any suggestions (:

$\endgroup$
3
  • $\begingroup$ I'm not sure but could it be that there are too many gaps and then it doesn't match it. BLAST doesn't just search for a sequence inside another one, but looks for similarities between sequences, and these two sequences are not similar (even if one contains the other) $\endgroup$
    – llrs
    Commented May 3, 2018 at 16:10
  • $\begingroup$ But is that not exactly what BLAST is supposed to do (local alignment)? There is a perfect local alignment (without any gaps). In terms of global alignment the two sequences are very different (and gap penalties are huge), but here we are talking about local alignments !? $\endgroup$
    – Paul
    Commented May 3, 2018 at 16:22
  • $\begingroup$ Yes, it should, glad we have terdon to answer the question $\endgroup$
    – llrs
    Commented May 3, 2018 at 17:19

2 Answers 2

13
$\begingroup$

There are three possible problems that come to mind.

  1. Masking

    Blast will mask low complexity regions by default. Since your sequence is nothing but Gs, it is a safe bet that it is being masked, so no hits will be found for it.

  2. Score/e-value thresholds

    Another source of complication is that even if a match is found, that match will have very bad scores. Both the actual score of the alignment and the e-value will be very bad. Since this is such a simple sequence, it will always score badly.

  3. Word-size

    The way blast works is (simplifying a bit) by finding a match for N residues (the word size) and then extending that match if extending increases the score. If your query sequence is shorter than the word size, no match will ever be found.

With all that said, the specific problem in your case seems to be a combination of the word-size and masking. If you run your query setting the word-size to 11 and disabling masking, as shown below, you should get results.

blastn -db A.fna -query B.fna -word_size 11 -dust no

That should return two hits (two because the word size is one less than the query size, so it can align perfectly at two locations):

> A
Length=64

 Score = 23.3 bits (12),  Expect = 5e-05
 Identities = 12/12 (100%), Gaps = 0/12 (0%)
 Strand=Plus/Plus

Query  1   GGGGGGGGGGGG  12
           ||||||||||||
Sbjct  11  GGGGGGGGGGGG  22

 Score = 23.3 bits (12),  Expect = 5e-05
 Identities = 12/12 (100%), Gaps = 0/12 (0%)
 Strand=Plus/Plus

Query  1   GGGGGGGGGGGG  12
           ||||||||||||
Sbjct  12  GGGGGGGGGGGG  23

Note that the default word size for BLASTn searches is usually 11. I don't know why the blast+ version (2.2.31+) I have on my Ubuntu machine didn't use that as a default. The manual says it should. But I got no hits when I didn't explicitly set the word size to 11.

$\endgroup$
1
  • $\begingroup$ that makes a lot of sense (i was not familiar with the concept/term of masking) thanks (: $\endgroup$
    – Paul
    Commented May 3, 2018 at 17:24
3
$\begingroup$

I came across this thread while searching for a solution to a similar problem I was experiencing. I am inputting markers that are 20 basepairs in length as the query sequence and haven't been getting hits. As terdon mentioned in their excellent reply, setting word size to something smaller like 11 helps for these shorter query sequences.

I didn't get any results on my 20 bp query sequences when using blastn against the sunflower genome, but I got plenty when setting word size to 11. So, why does setting word size for blastn to 11 improve the results despite documentation stating that default word size is 11? Well it turns out that this is very misleading. This webpage explains that the default algorithm used in blastn is actually megablast, not blastn. The default word length for this default megablast algorithm is actually 28!

The documentation is quite unclear about this and many websites providing tutorials for blastn also seem to miss this key detail. Hope this helps anyone else who struggles with this!

$\endgroup$
1
  • 2
    $\begingroup$ Your hyperlink doesn't seem to be working any longer, but megablast vs blastn is a huge difference. Command line -task blastn or python task="blastn" will switch the algorithm. $\endgroup$
    – ded
    Commented Sep 5, 2023 at 16:33

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.