Understanding the significance of BLAT score calculations for read fragment alignment I'm attempting to reconstruct the read fragments that form a hit to a target, excluding/skipping gaps. BLAST's outfmt 6, and alternatives such as Diamond's M8 format only give the number of gap opens on the alignment. One can't just use the start and end positions of the alignment as indices to slice the read DNA sequence, as this will include the nucleotides that were gapped by the alignment.

PSL appeared to be the only format I could find that gave the actual start positions (and lengths) of each of the pieces that formed a hit (that is, each gap forces a new block).

The regular BLAST output is human readable and is a nightmare to parse. The XML format mentioned has a structure for each HSP, but an HSP can still include gaps:

  [...]
  &lt;Hit_hsps&gt;
    &lt;Hsp&gt;
      &lt;Hsp_num&gt;1&lt;/Hsp_num&gt;
      &lt;Hsp_bit-score&gt;51.6&lt;/Hsp_bit-score&gt;
      &lt;Hsp_score&gt;122&lt;/Hsp_score&gt;
      &lt;Hsp_evalue&gt;9.8e-06&lt;/Hsp_evalue&gt;
      &lt;Hsp_query-from&gt;2&lt;/Hsp_query-from&gt;
      &lt;Hsp_query-to&gt;98&lt;/Hsp_query-to&gt;
      &lt;Hsp_hit-from&gt;35&lt;/Hsp_hit-from&gt;
      &lt;Hsp_hit-to&gt;65&lt;/Hsp_hit-to&gt;
      &lt;Hsp_query-frame&gt;2&lt;/Hsp_query-frame&gt;
      &lt;Hsp_hit-frame&gt;0&lt;/Hsp_hit-frame&gt;
      &lt;Hsp_identity&gt;24&lt;/Hsp_identity&gt;
      &lt;Hsp_positive&gt;27&lt;/Hsp_positive&gt;
      &lt;Hsp_gaps&gt;1&lt;/Hsp_gaps&gt;
      &lt;Hsp_align-len&gt;32&lt;/Hsp_align-len&gt;
         &lt;Hsp_qseq&gt;ITAIGAGLQGPAGCEVIDAGGLLVMPGGIDTH&lt;/Hsp_qseq&gt;
         &lt;Hsp_hseq&gt;IAAVGTGLE-PAGAEIIDAGGLLVMPGGIDVH&lt;/Hsp_hseq&gt;
      &lt;Hsp_midline&gt;I A+G GL+ PAG E+IDAGGLLVMPGGID H&lt;/Hsp_midline&gt;
    &lt;/Hsp&gt;
  &lt;/Hit_hsps&gt;
&lt;/Hit&gt;


I'm trying to be lazy, I don't want to have to parse the Hsp_qseq and Hsp_hseq to determine exactly where my gaps are. I just want co-ordinates of where my read hits a protein. The PSL format (below) tells me this (tStarts):

match   mis-    rep.    N's     Q gap   Q gap   T gap   T gap   strand  Q               Q       Q       Q       T               T       T       T       block   blockSizes      qStarts  tStarts
        match   match           count   bases   count   bases           name            size    start   end     name            size    start   end     count
---------------------------------------------------------------------------------------------------------------------------------------------------------------
[...]
21      4       0       0       1       8       1       24      ++      &lt;PROTEIN&gt;   662     321     354     &lt;READ&gt;      101     2       101     2       8,17,   321,337,        2,50,


As an alternative, I've executed the BLAT aligner as a means to find alignments of translated DNA reads against a small protein database. I selected BLAT as it provided the easiest means to access information on the actual alignment blocks (with the smallest amount of parsing). That is, the PSL has a comma delimited field that enumerates each of the starting positions of a query to a target.

However, BLAT outputs a significantly greater number of alignments than alternative tools. This is likely due to its identity percentage threshold defaulting to 25% when emulating a blastx style query.
I can cope with this (apologies to my disks for the I/O), but for filtering purposes, the output PSL format appears to leave me nothing but raw match counts to work with.

The PSL gives me what I want, except now I don't have information on its significance. I know that the BLAT FAQ describes a Perl script for adding "web-based identity and score calculations". I can actually get identity percentages and scores from this script, but I cannot tell what the score actually represents. Is it comparable to bit-score? How can I recover something like an e-value from a PSL output file?
It would appear that BLAT and exonerate (as suggested by @terdon) are the only pieces of software that provide enough information for "HSPFragments" to be parsed from their outputs, at least according to BioPython's documentation, anyway:


  Most search programs only have HSPs with one HSPFragment in them,
  making these two objects inseparable. However, there are programs
  (e.g. BLAT and Exonerate) which may have more than one HSPFragment
  objects in any given HSP. If you are not using these programs, you can
  safely consider HSP and HSPFragment as a single union.


It would seem the options are sticking with BLAT and generating scores afterwards with the script described in their FAQ, or using exonerate which provides a raw score as part of its default output. What these scores actually mean I will have to investigate, but for now I think the case is closed!