GMOD/GBrowse — pull request #43 by nathanweeks (2014-05-16 17:34:11+00:00)
Title: BLAT plugin fixes

This proposed update to the BLAT plugin fixes several issues:

1. BLAT hits are not necessarily reported in best-to-worst order.

The BLAT plugin currently keeps the first "Number of Hits to Return" hits in the PSL output (default 5). BLAT doesn't necessarily report hits in best-to-worst order, however. Compare the results from "Number of Hits to Return: 5":

![orig-keep5](https://cloud.githubusercontent.com/assets/1800812/3000062/e905c934-dd1e-11e3-8985-6cfb19ecd471.png)

with "Number of Hits to Return: 10":

![orig-keep10](https://cloud.githubusercontent.com/assets/1800812/3000069/f6d3e3a2-dd1e-11e3-98c3-fbcc614fce43.png)

The best hit was only reported in the second set, as it did not appear in the first 5 reported hits in the BLAT PSL file. The erroneous start coordinate of the best hit, which starts at the beginning of the sequence, is a side effect of issue #2:

2. Start coordinates in PSL output are 0-based, not 1-based.

The proposed patch reads all BLAT hits and sorts them by the calculated score (which appears to be percent query coverage---a separate issue is whether it would be better to exclude mismatches) and adds one to all start coordinates, resulting in the following results with "Number of Hits to Return: 5":

![fixed-keep5](https://cloud.githubusercontent.com/assets/1800812/3000137/eaa6d00c-dd1f-11e3-9d63-056d4944e685.png)

This patch also changes the strand argument to Bio::Graphics::Feature to 1 or -1 instead of the "+" or "-" that is read from the PSL file, as the base class Bio::SeqFeature::Lite doesn't correctly handle "+" or "-", resulting in a 0 (".") for the strand (though I submitted a pull request to fix this: https://github.com/bioperl/bioperl-live/pull/71)