I have installed Blast locally and I've configured the nucleotide database to use. I want to search some sequences (from a .fastafile) in this genome. So I used blastn:

blastn -db NewDb -query input.fasta -out blast.txt

Then I added some options to require a 100% identity and no gaps:

blastn -db NewDb -query input.fasta -perc_identity 100 -ungapped -out blast.txt

But I still have some results where only a subpart of the string is matching the genome:

BLASTN 2.2.29+


Database: […].fasta
           20 sequences; N total letters

Query= Mutant M :

                                                                      Score     E
Sequences producing significant alignments:                          (Bits)  Value

  chrom19                                                               435   3e-122
  chrom2                                                                429   1e-120

> chrom19

 Score =   435 bits (226),  Expect = 3e-122
 Identities = 226/226 (100%), Gaps = 0/226 (0%)


> chrom2

 Score =   429 bits (223),  Expect = 1e-120
 Identities = 223/223 (100%), Gaps = 0/223 (0%)


Both results have an identity score of 100%, but the second result only use 223 of the 226 bases from the input sequence.

What parameters can I use with blastn to get only perfect matches, with 100% identity and all the nucleotide bases from the input sequence used?

  • 2
    $\begingroup$ From my experience, I don't think this is possible. BLAST was designed to find many distant hits, so it wasn't made for this very strong requirement of identical sequences. But you can probably filter it afterwards, no? $\endgroup$ Mar 23 '15 at 15:46
  • 3
    $\begingroup$ If you want perfect identity, won't a simple string comparison program (in any language) do the job? $\endgroup$
    – March Ho
    Mar 23 '15 at 17:22
  • 2
    $\begingroup$ Yeah I concur with @MarchHo. Just do a string search. You can use grep $\endgroup$
    Mar 23 '15 at 18:12
  • 2
    $\begingroup$ Agree with @MarchHo. Would rather use Perl =~ operator for matching (used as $template =~ /query/) than grep. And yes Blastn was not designed for that and will match smaller sequences that are 100% similar. $\endgroup$ Mar 25 '15 at 6:45
  • 1
    $\begingroup$ This is a grep question rather than a blast issue, and nothing much to do with biology. I'm voting to close it as off topic. $\endgroup$
    – James
    Mar 22 '16 at 4:39