| Bio::Graphics::Browser2::Realign(3pm) | User Contributed Perl Documentation | Bio::Graphics::Browser2::Realign(3pm) |
Bio::Graphics::Browser2::Realign - Perl extension for Smith-Waterman alignments
use Bio::Graphics::Browser2::Realign 'align';
my ($top,$middle,$bottom) = align('gattttttc','gattttccc');
print join "\n",$top,$middle,$bottom,"\n";
# produces:
gatttttt--c
|||||| |
gatttt--ccc
This is a helper utility used by gbrowse to produce global alignments. It uses slow Smith-Waterman, so is only appropriate for short segments that are mostly aligned already.
It can be speeded up significantly by compiling Bio::Graphics::Browser2::CAlign, an XS extension. To do this, build gbrowse with the DO_XS=1 option:
cd Generic-Genome-Browser perl Makefile.PL DO_XS=1
Key name Default Description
-------- ------- -----------
match 1 Award one point for an exact match.
mismatch -1 Penalize one point for a mismatch.
wildcard_match 0 No penalty for a match to a wildcard (e.g. "n").
gap -1 Penalize one point to create a gap.
gap_extend 0 No penalty for extending an existing gap.
wildcard 'N' The wildcard character.
The alignment algorithm is run when new() is called.
For example, this alignment:
gatttttt--c
|||||| |
gatttt--ccc
corresponds to this arrayref:
index value
0[g] 0[g]
1[a] 1[a]
2[t] 2[t]
3[t] 3[t]
4[t] 4[t]
5[t] 5[t]
6[t] undef
7[t] undef
8[c] 8[c]
For example:
print join "\n",$aligner->pads;
Will produce this output:
gatttttt--c
|||||| |
gatttt--ccc
No functions are exported by default, but the following two methods can be imported explicitly.
Bio::Graphics::Browser2::Realign->new($source,$target)->pads;
This is useful for converting a gapped alignment into a series of nongapped alignments.
In a list context this function will return a list of non-gapped segments.
[src_start,src_end,tgt_start,tgt_end]
The 3 strings look like this
CA-ACCCCCTTGCAACAACCTTGAGAACCCCAGGGA
| |||||||||||||||||||||||||||||||||
AAGACCCCCTTGCAACAACCTTGAGAACCCCAGGGA
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2003 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.
Bio::Graphics::Browser.
| 2024-03-31 | perl v5.38.2 |