/usr/share/perl5/Bio/Align/AlignI.pm is in libbio-perl-perl 1.6.923-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | #
# BioPerl module for Bio::Align::AlignI
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Jason Stajich <jason@bioperl.org>
#
# Copyright Jason Stajich
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::Align::AlignI - An interface for describing sequence alignments.
=head1 SYNOPSIS
# get a Bio::Align::AlignI somehow - typically using Bio::AlignIO system
# some descriptors
print $aln->length, "\n";
print $aln->num_residues, "\n";
print $aln->is_flush, "\n";
print $aln->num_sequences, "\n";
print $aln->percentage_identity, "\n";
print $aln->consensus_string(50), "\n";
# find the position in the alignment for a sequence location
$pos = $aln->column_from_residue_number('1433_LYCES', 14); # = 6;
# extract sequences and check values for the alignment column $pos
foreach $seq ($aln->each_seq) {
$res = $seq->subseq($pos, $pos);
$count{$res}++;
}
foreach $res (keys %count) {
printf "Res: %s Count: %2d\n", $res, $count{$res};
}
=head1 DESCRIPTION
This interface describes the basis for alignment objects.
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via the
web:
https://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR - Jason Stajich
Email jason@bioperl.org
=head1 CONTRIBUTORS
Ewan Birney, birney@ebi.ac.uk
Heikki Lehvaslaiho, heikki-at-bioperl-dot-org
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::Align::AlignI;
use strict;
use base qw(Bio::Root::RootI);
=head1 Modifier methods
These methods modify the MSE by adding, removing or shuffling complete
sequences.
=head2 add_seq
Title : add_seq
Usage : $myalign->add_seq($newseq);
Function : Adds another sequence to the alignment. *Does not* align
it - just adds it to the hashes.
Returns : None
Argument : a Bio::LocatableSeq object
order (optional)
See L<Bio::LocatableSeq> for more information.
=cut
sub add_seq {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 remove_seq
Title : remove_seq
Usage : $aln->remove_seq($seq);
Function : Removes a single sequence from an alignment
Returns :
Argument : a Bio::LocatableSeq object
=cut
sub remove_seq {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 purge
Title : purge
Usage : $aln->purge(0.7);
Function:
Removes sequences above whatever %id.
This function will grind on large alignments. Beware!
(perhaps not ideally implemented)
Example :
Returns : An array of the removed sequences
Argument:
=cut
sub purge {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 sort_alphabetically
Title : sort_alphabetically
Usage : $ali->sort_alphabetically
Function :
Changes the order of the alignment to alphabetical on name
followed by numerical by number.
Returns : an array
Argument :
=cut
sub sort_alphabetically {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Sequence selection methods
Methods returning one or more sequences objects.
=head2 each_seq
Title : each_seq
Usage : foreach $seq ( $align->each_seq() )
Function : Gets an array of Seq objects from the alignment
Returns : an array
Argument :
=cut
sub each_seq {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 each_alphabetically
Title : each_alphabetically
Usage : foreach $seq ( $ali->each_alphabetically() )
Function :
Returns an array of sequence object sorted alphabetically
by name and then by start point.
Does not change the order of the alignment
Returns :
Argument :
=cut
sub each_alphabetically {
my($self) = @_;
$self->throw_not_implemented();
}
=head2 each_seq_with_id
Title : each_seq_with_id
Usage : foreach $seq ( $align->each_seq_with_id() )
Function :
Gets an array of Seq objects from the
alignment, the contents being those sequences
with the given name (there may be more than one)
Returns : an array
Argument : a seq name
=cut
sub each_seq_with_id {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 get_seq_by_pos
Title : get_seq_by_pos
Usage : $seq = $aln->get_seq_by_pos(3) # third sequence from the alignment
Function :
Gets a sequence based on its position in the alignment.
Numbering starts from 1. Sequence positions larger than
num_sequences() will throw an error.
Returns : a Bio::LocatableSeq object
Argument : positive integer for the sequence position
=cut
sub get_seq_by_pos {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Create new alignments
The result of these methods are horizontal or vertical subsets of the
current MSE.
=head2 select
Title : select
Usage : $aln2 = $aln->select(1, 3) # three first sequences
Function :
Creates a new alignment from a continuous subset of
sequences. Numbering starts from 1. Sequence positions
larger than num_sequences() will throw an error.
Returns : a Bio::SimpleAlign object
Argument : positive integer for the first sequence
positive integer for the last sequence to include (optional)
=cut
sub select {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 select_noncont
Title : select_noncont
Usage : $aln2 = $aln->select_noncont(1, 3) # first and 3rd sequences
Function :
Creates a new alignment from a subset of
sequences. Numbering starts from 1. Sequence positions
larger than num_sequences() will throw an error.
Returns : a Bio::SimpleAlign object
Args : array of integers for the sequences
=cut
sub select_noncont {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 slice
Title : slice
Usage : $aln2 = $aln->slice(20, 30)
Function :
Creates a slice from the alignment inclusive of start and
end columns. Sequences with no residues in the slice are
excluded from the new alignment and a warning is printed.
Slice beyond the length of the sequence does not do
padding.
Returns : a Bio::SimpleAlign object
Argument : positive integer for start column
positive integer for end column
=cut
sub slice {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Change sequences within the MSE
These methods affect characters in all sequences without changing the
alignment.
=head2 map_chars
Title : map_chars
Usage : $ali->map_chars('\.','-')
Function :
Does a s/$arg1/$arg2/ on the sequences. Useful for gap
characters
Notice that the from (arg1) is interpreted as a regex,
so be careful about quoting meta characters (eg
$ali->map_chars('.','-') wont do what you want)
Returns : None
Argument : 'from' rexexp
'to' string
=cut
sub map_chars {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 uppercase
Title : uppercase()
Usage : $ali->uppercase()
Function : Sets all the sequences to uppercase
Returns :
Argument :
=cut
sub uppercase {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 match_line
Title : match_line()
Usage : $align->match_line()
Function : Generates a match line - much like consensus string
except that a line indicating the '*' for a match.
Argument : (optional) Match line characters ('*' by default)
(optional) Strong match char (':' by default)
(optional) Weak match char ('.' by default)
=cut
sub match_line {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 match
Title : match()
Usage : $ali->match()
Function :
Goes through all columns and changes residues that are
identical to residue in first sequence to match '.'
character. Sets match_char.
USE WITH CARE: Most MSE formats do not support match
characters in sequences, so this is mostly for output
only. NEXUS format (Bio::AlignIO::nexus) can handle
it.
Returns : 1
Argument : a match character, optional, defaults to '.'
=cut
sub match {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 unmatch
Title : unmatch()
Usage : $ali->unmatch()
Function :
Undoes the effect of method match. Unsets match_char.
Returns : 1
Argument : a match character, optional, defaults to '.'
=cut
sub unmatch {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 MSE attibutes
Methods for setting and reading the MSE attributes.
Note that the methods defining character semantics depend on the user
to set them sensibly. They are needed only by certain input/output
methods. Unset them by setting to an empty string ('').
=head2 id
Title : id
Usage : $myalign->id("Ig")
Function : Gets/sets the id field of the alignment
Returns : An id string
Argument : An id string (optional)
=cut
sub id {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 missing_char
Title : missing_char
Usage : $myalign->missing_char("?")
Function : Gets/sets the missing_char attribute of the alignment
It is generally recommended to set it to 'n' or 'N'
for nucleotides and to 'X' for protein.
Returns : An missing_char string,
Argument : An missing_char string (optional)
=cut
sub missing_char {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 match_char
Title : match_char
Usage : $myalign->match_char('.')
Function : Gets/sets the match_char attribute of the alignment
Returns : An match_char string,
Argument : An match_char string (optional)
=cut
sub match_char {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 gap_char
Title : gap_char
Usage : $myalign->gap_char('-')
Function : Gets/sets the gap_char attribute of the alignment
Returns : An gap_char string, defaults to '-'
Argument : An gap_char string (optional)
=cut
sub gap_char {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 symbol_chars
Title : symbol_chars
Usage : my @symbolchars = $aln->symbol_chars;
Function: Returns all the seen symbols (other than gaps)
Returns : array of characters that are the seen symbols
Argument: boolean to include the gap/missing/match characters
=cut
sub symbol_chars{
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Alignment descriptors
These read only methods describe the MSE in various ways.
=head2 consensus_string
Title : consensus_string
Usage : $str = $ali->consensus_string($threshold_percent)
Function : Makes a strict consensus
Returns : consensus string
Argument : Optional threshold ranging from 0 to 100.
The consensus residue has to appear at least threshold %
of the sequences at a given location, otherwise a '?'
character will be placed at that location.
(Default value = 0%)
=cut
sub consensus_string {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 consensus_iupac
Title : consensus_iupac
Usage : $str = $ali->consensus_iupac()
Function :
Makes a consensus using IUPAC ambiguity codes from DNA
and RNA. The output is in upper case except when gaps in
a column force output to be in lower case.
Note that if your alignment sequences contain a lot of
IUPAC ambiquity codes you often have to manually set
alphabet. Bio::PrimarySeq::_guess_type thinks they
indicate a protein sequence.
Returns : consensus string
Argument : none
Throws : on protein sequences
=cut
sub consensus_iupac {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 is_flush
Title : is_flush
Usage : if( $ali->is_flush() )
:
:
Function : Tells you whether the alignment
: is flush, ie all of the same length
:
:
Returns : 1 or 0
Argument :
=cut
sub is_flush {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 length
Title : length()
Usage : $len = $ali->length()
Function : Returns the maximum length of the alignment.
To be sure the alignment is a block, use is_flush
Returns : integer
Argument :
=cut
sub length {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 maxname_length
Title : maxname_length
Usage : $ali->maxname_length()
Function :
Gets the maximum length of the displayname in the
alignment. Used in writing out various MSE formats.
Returns : integer
Argument :
=cut
sub maxname_length {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 num_residues
Title : num_residues
Usage : $no = $ali->num_residues
Function : number of residues in total in the alignment
Returns : integer
Argument :
Note : replaces no_residues
=cut
sub num_residues {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 num_sequences
Title : num_sequences
Usage : $depth = $ali->num_sequences
Function : number of sequence in the sequence alignment
Returns : integer
Argument : None
Note : replaces no_sequences
=cut
sub num_sequences {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 percentage_identity
Title : percentage_identity
Usage : $id = $align->percentage_identity
Function: The function calculates the percentage identity of the alignment
Returns : The percentage identity of the alignment (as defined by the
implementation)
Argument: None
=cut
sub percentage_identity{
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 overall_percentage_identity
Title : overall_percentage_identity
Usage : $id = $align->overall_percentage_identity
Function: The function calculates the percentage identity of
the conserved columns
Returns : The percentage identity of the conserved columns
Args : None
=cut
sub overall_percentage_identity{
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 average_percentage_identity
Title : average_percentage_identity
Usage : $id = $align->average_percentage_identity
Function: The function uses a fast method to calculate the average
percentage identity of the alignment
Returns : The average percentage identity of the alignment
Args : None
=cut
sub average_percentage_identity{
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Alignment positions
Methods to map a sequence position into an alignment column and back.
column_from_residue_number() does the former. The latter is really a
property of the sequence object and can done using
L<Bio::LocatableSeq::location_from_column>:
# select somehow a sequence from the alignment, e.g.
my $seq = $aln->get_seq_by_pos(1);
#$loc is undef or Bio::LocationI object
my $loc = $seq->location_from_column(5);
=head2 column_from_residue_number
Title : column_from_residue_number
Usage : $col = $ali->column_from_residue_number( $seqname, $resnumber)
Function:
This function gives the position in the alignment
(i.e. column number) of the given residue number in the
sequence with the given name. For example, for the
alignment
Seq1/91-97 AC..DEF.GH
Seq2/24-30 ACGG.RTY..
Seq3/43-51 AC.DDEFGHI
column_from_residue_number( "Seq1", 94 ) returns 6.
column_from_residue_number( "Seq2", 25 ) returns 2.
column_from_residue_number( "Seq3", 50 ) returns 9.
An exception is thrown if the residue number would lie
outside the length of the alignment
(e.g. column_from_residue_number( "Seq2", 22 )
Note: If the parent sequence is represented by more than one
alignment sequence and the residue number is present in
them, this method finds only the first one.
Returns : A column number for the position in the alignment of the
given residue in the given sequence (1 = first column)
Args : A sequence id/name (not a name/start-end)
A residue number in the whole sequence (not just that
segment of it in the alignment)
=cut
sub column_from_residue_number {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Sequence names
Methods to manipulate the display name. The default name based on the
sequence id and subsequence positions can be overridden in various
ways.
=head2 displayname
Title : displayname
Usage : $myalign->displayname("Ig", "IgA")
Function : Gets/sets the display name of a sequence in the alignment
:
Returns : A display name string
Argument : name of the sequence
displayname of the sequence (optional)
=cut
sub displayname {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 set_displayname_count
Title : set_displayname_count
Usage : $ali->set_displayname_count
Function :
Sets the names to be name_# where # is the number of
times this name has been used.
Returns : None
Argument : None
=cut
sub set_displayname_count {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 set_displayname_flat
Title : set_displayname_flat
Usage : $ali->set_displayname_flat()
Function : Makes all the sequences be displayed as just their name,
not name/start-end
Returns : 1
Argument : None
=cut
sub set_displayname_flat {
my ($self) = @_;
$self->throw_not_implemented();
}
=head2 set_displayname_normal
Title : set_displayname_normal
Usage : $ali->set_displayname_normal()
Function : Makes all the sequences be displayed as name/start-end
Returns : None
Argument : None
=cut
sub set_displayname_normal {
my ($self) = @_;
$self->throw_not_implemented();
}
=head1 Deprecated methods
=head2 no_residues
Title : no_residues
Usage : $no = $ali->no_residues
Function : number of residues in total in the alignment
Returns : integer
Argument :
Note : deprecated in favor of num_residues()
=cut
sub no_residues {
# immediate deprecation
shift->deprecated();
}
=head2 no_sequences
Title : no_sequences
Usage : $depth = $ali->no_sequences
Function : number of sequence in the sequence alignment
Returns : integer
Argument : None
Note : deprecated in favor of num_sequences()
=cut
sub no_sequences {
# immediate deprecation
shift->deprecated();
}
1;
|