[Bioperl-l] get regions

Chris Fields cjfields at uiuc.edu
Wed May 16 02:44:43 UTC 2007


On May 14, 2007, at 8:46 PM, Steve Chervitz wrote:
...

> To generalize your code so that it will work for any pattern, such as
> one that can match strings of variable length like "A{5,10}", just
> subtract the length of the actual string that was matched:
>
> if ($gene =~ m/$pattern/gi)
> {
>     $start = pos($gene) - length($&) + 1;
>  }
>
> Steve

Right, but $& (as well as $` and $') inflict a significant penalty  
for their use, as Aaron alludes to.  Their use, even indirectly via a  
library module, can cause a significant performance hit.

chris



More information about the Bioperl-l mailing list