This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blast Short Sequences Containing Repeats

I try to detect repeats using blastn. I use the same sequence as query and subject. The sequence contains a 21bp tandem duplication. I expect three hits:

  1. The whole sequence aligns itself.
  2. First occurance of duplication in query aligns second occurance in subject.
  3. Second occurance of duplication in query aligns first occurance in subject.

This works very well for Sequence1 in the web version and in my standalone version. But for Sequence2 this is not working. I tried this for many sequences and it is working very well, but for that case it fails. Any suggestions?

Sequence1:

>gtacgtgcattttaaagattttccaatggaaaagaaatgctgcagaaacatttggcacattccattcttaccttggcacattccattcttaccaaactctaaattttctcttggaaa

Sequence2:

>gagtacgtgcattttaaagattttccaatggaaaagaaatgctgcagaaacatttggcacattccattcttaccttggcacattccattcttaccaaactctaaattttctcttggaaa

Blastn command: blastn -query seq.fa -subject seq.fa -word_size 21

blast repeats

I added -penalty -4 to the command. Now it is working. I did not use the -ungapped solution by JC, because I wanted to allow gaps and mismatches.

1 answer

you need to turn off the gaps:

*edit: because we want to allow gaps, the -penalty parameter is changed instead of the -ungapped flag

> blastn -query seq2.fa -subject seq2.fa -word_size 21 -ungapped
BLASTN 2.2.26+


Query= seq2.fa

Length=119

Subject= seq2.fa

Length=119


 Score =  229 bits (119),  Expect = 2e-65
 Identities = 119/119 (100%), Gaps = 0/119 (0%)
 Strand=Plus/Plus

Query  1    GAGTACGTGCATTTTAAAGATTTTCCAATGGAAAAGAAATGCTGCAGAAACATTTGGCAC  60
            ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sbjct  1    GAGTACGTGCATTTTAAAGATTTTCCAATGGAAAAGAAATGCTGCAGAAACATTTGGCAC  60

Query  61   ATTCCATTCTTACCTTGGCACATTCCATTCTTACCAAACTCTAAATTTTCTCTTGGAAA  119
            |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sbjct  61   ATTCCATTCTTACCTTGGCACATTCCATTCTTACCAAACTCTAAATTTTCTCTTGGAAA  119


 Score = 41.1 bits (21),  Expect = 1e-08
 Identities = 21/21 (100%), Gaps = 0/21 (0%)
 Strand=Plus/Plus

Query  75  TTGGCACATTCCATTCTTACC  95
           |||||||||||||||||||||
Sbjct  54  TTGGCACATTCCATTCTTACC  74


 Score = 41.1 bits (21),  Expect = 1e-08
 Identities = 21/21 (100%), Gaps = 0/21 (0%)
 Strand=Plus/Plus

Query  54  TTGGCACATTCCATTCTTACC  74
           |||||||||||||||||||||
Sbjct  75  TTGGCACATTCCATTCTTACC  95



Lambda     K      H
    1.33    0.621     1.12 


Effective search space used: 12544

Thank you, that works well. What would you suggest, if I want to allow gapped alignments, as well?

then you will need to adjust the penalty score for gaps

Log in to answer this question.