This is a test version of Biostars. For the public version, visit https://www.biostars.org.
start and stop position of mapping in Blast

I used makeblastdb to search many short fasta sequences in a known organism. I successfully completed this step and got the mappings. My question is

How can I get the start and stop coordinate?

for eg

Query  1        AATATAGGTGGTACCACGGAATATCCGTCCTATTTGTATATAGGATGGATAtttttattt  60
                ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sbjct  1765181  AATATAGGTGGTACCACGGAATATCCGTCCTATTTGTATATAGGATGGATATTTTTATTT  1765122

Query  61       ttttAGGAGGTATAGCAAATGG  82
                ||||||||||||||||||||||
Sbjct  1765121  TTTTAGGAGGTATAGCAAATGG  1765100

How to get 1765100 and 1765181 from a text file with many mappings like this. I would also like to count the number of mappings or query sequences?

blast

use tabular output option:

blastn -query some.fa -db some.fa  -outfmt 6

Every bioinformatics journey begins with a BLAST parser :)

1 answer

blastn -query some.fa -db some.fa  -outfmt 6 | awk '{print $9 "\t" $10}'

Have in mind that sometimes $9 is greater than $10.

Also, there is no point in your answer as you're blasting some.fa against some.fa.

there are some cases when you run blast using query both as query and as subject, clustering groups of sequences for example.

in case alignment of query is in opposite direction to subject, then column 9 will be greater than column 10

blastn -query query.fa -db subject.fa  -outfmt 6 | awk '{OFS="\t"; if ($9>$10) print $9,$10; else print $10,$9}'

Log in to answer this question.