| 1 | # | ||||||||||||||||||
| 2 | # BioPerl module for Bio::AlignIO::prodom | ||||||||||||||||||
| 3 | |||||||||||||||||||
| 4 | # based on the Bio::SeqIO::prodom module | ||||||||||||||||||
| 5 | # by Ewan Birney <birney@ebi.ac.uk> | ||||||||||||||||||
| 6 | # and Lincoln Stein <lstein@cshl.org> | ||||||||||||||||||
| 7 | # | ||||||||||||||||||
| 8 | # and the SimpleAlign.pm module of Ewan Birney | ||||||||||||||||||
| 9 | # | ||||||||||||||||||
| 10 | # Copyright Peter Schattner | ||||||||||||||||||
| 11 | # | ||||||||||||||||||
| 12 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||
| 13 | # _history | ||||||||||||||||||
| 14 | # September 5, 2000 | ||||||||||||||||||
| 15 | # POD documentation - main docs before the code | ||||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | =head1 NAME | ||||||||||||||||||
| 18 | |||||||||||||||||||
| 19 | Bio::AlignIO::prodom - prodom sequence input/output stream | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||
| 22 | |||||||||||||||||||
| 23 | Do not use this module directly. Use it via the L<Bio::AlignIO> class. | ||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||||||||||
| 26 | |||||||||||||||||||
| 27 | This object can transform L<Bio::Align::AlignI> objects to and from prodom flat | ||||||||||||||||||
| 28 | file databases. | ||||||||||||||||||
| 29 | |||||||||||||||||||
| 30 | =head1 FEEDBACK | ||||||||||||||||||
| 31 | |||||||||||||||||||
| 32 | =head2 Support | ||||||||||||||||||
| 33 | |||||||||||||||||||
| 34 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||
| 35 | |||||||||||||||||||
| 36 | I<bioperl-l@bioperl.org> | ||||||||||||||||||
| 37 | |||||||||||||||||||
| 38 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||
| 39 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||
| 40 | address it. Please include a thorough description of the problem | ||||||||||||||||||
| 41 | with code and data examples if at all possible. | ||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | =head2 Reporting Bugs | ||||||||||||||||||
| 44 | |||||||||||||||||||
| 45 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||
| 46 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||
| 47 | web: | ||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | =head1 AUTHORS - Peter Schattner | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | Email: schattner@alum.mit.edu | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | =head1 APPENDIX | ||||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | The rest of the documentation details each of the object | ||||||||||||||||||
| 59 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||
| 60 | |||||||||||||||||||
| 61 | =cut | ||||||||||||||||||
| 62 | |||||||||||||||||||
| 63 | # Let the code begin... | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | package Bio::AlignIO::prodom; | ||||||||||||||||||
| 66 | 3 | $Bio::AlignIO::prodom::VERSION = '1.7.8'; | |||||||||||||||||
| 67 | 3 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | |||||||||||||||||||
| 70 | 3 | ▶ | use base qw(Bio::AlignIO); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 71 | |||||||||||||||||||
| 72 | =head2 next_aln | ||||||||||||||||||
| 73 | |||||||||||||||||||
| 74 | Title : next_aln | ||||||||||||||||||
| 75 | Usage : $aln = $stream->next_aln() | ||||||||||||||||||
| 76 | Function: returns the next alignment in the stream. | ||||||||||||||||||
| 77 | Returns : L<Bio::Align::AlignI> object | ||||||||||||||||||
| 78 | Args : NONE | ||||||||||||||||||
| 79 | |||||||||||||||||||
| 80 | =cut | ||||||||||||||||||
| 81 | |||||||||||||||||||
| 82 | 4 | ▶ | sub next_aln { | ||||||||||||||||
|
Subroutine
next_aln: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||
| 83 | 4 | my $self = shift; | |||||||||||||||||
| 84 | 4 | my $entry; | |||||||||||||||||
| 85 | 4 | my ($acc, $fake_id, $start, $end, $seq, $add, %names); | |||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | 4 | my $aln = Bio::SimpleAlign->new(-source => 'prodom'); | |||||||||||||||||
| 88 | |||||||||||||||||||
| 89 | 4 | ▶ | while( $entry = $self->_readline) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 90 | |||||||||||||||||||
| 91 | 248 | ▶ | if ($entry =~ /^AC\s+(\S+)\s*$/) { #ps 9/12/00 | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 92 | 4 | $aln->id( $1 ); | |||||||||||||||||
| 93 | } | ||||||||||||||||||
| 94 | elsif ($entry =~ /^AL\s+(\S+)\|(\S+)\s+(\d+)\s+(\d+)\s+\S+\s+(\S+)\s*$/){ #ps 9/12/00 | ||||||||||||||||||
| 95 | 228 | $acc=$1; | |||||||||||||||||
| 96 | 228 | $fake_id=$2; # Accessions have _species appended | |||||||||||||||||
| 97 | 228 | $start=$3; | |||||||||||||||||
| 98 | 228 | $end=$4; | |||||||||||||||||
| 99 | 228 | $seq=$5; | |||||||||||||||||
| 100 | |||||||||||||||||||
| 101 | 228 | $names{'fake_id'} = $fake_id; | |||||||||||||||||
| 102 | |||||||||||||||||||
| 103 | 228 | $add = Bio::LocatableSeq->new('-seq' => $seq, | |||||||||||||||||
| 104 | '-id' => $acc, | ||||||||||||||||||
| 105 | '-start' => $start, | ||||||||||||||||||
| 106 | '-end' => $end, | ||||||||||||||||||
| 107 | '-alphabet' => $self->alphabet, | ||||||||||||||||||
| 108 | ); | ||||||||||||||||||
| 109 | |||||||||||||||||||
| 110 | 228 | $aln->add_seq($add); | |||||||||||||||||
| 111 | } | ||||||||||||||||||
| 112 | elsif ($entry =~ /^CO/) { | ||||||||||||||||||
| 113 | # the consensus line marks the end of the alignment part of the entry | ||||||||||||||||||
| 114 | 4 | last; | |||||||||||||||||
| 115 | } | ||||||||||||||||||
| 116 | } | ||||||||||||||||||
| 117 | |||||||||||||||||||
| 118 | 4 | ▶ | return $aln if $aln->num_sequences; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 119 | 0 | return; | |||||||||||||||||
| 120 | } | ||||||||||||||||||
| 121 | |||||||||||||||||||
| 122 | |||||||||||||||||||
| 123 | |||||||||||||||||||
| 124 | =head2 write_aln | ||||||||||||||||||
| 125 | |||||||||||||||||||
| 126 | Title : write_aln | ||||||||||||||||||
| 127 | Usage : $stream->write_aln(@aln) | ||||||||||||||||||
| 128 | Function: writes the $aln object into the stream in prodom format ###Not yet implemented!### | ||||||||||||||||||
| 129 | Returns : 1 for success and 0 for error | ||||||||||||||||||
| 130 | Args : L<Bio::Align::AlignI> object | ||||||||||||||||||
| 131 | |||||||||||||||||||
| 132 | |||||||||||||||||||
| 133 | =cut | ||||||||||||||||||
| 134 | |||||||||||||||||||
| 135 | 0 | ▶ | sub write_aln { | ||||||||||||||||
|
Subroutine
write_aln: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 136 | 0 | my ($self,@aln) = @_; | |||||||||||||||||
| 137 | 0 | $self->throw_not_implemented(); | |||||||||||||||||
| 138 | } | ||||||||||||||||||
| 139 | |||||||||||||||||||
| 140 | 3 | 1; | |||||||||||||||||