File Coverage

Bio/AlignIO/prodom.pm
Criterion Covered Total %
statement 23 26 88.4
branch 7 8 87.5
condition n/a
subroutine 3 4 75.0
pod 2 2 100.0
total 35 40 87.5


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::AlignIO::prodom
3              
4             # based on the Bio::SeqIO::prodom module
5             # by Ewan Birney
6             # and Lincoln Stein
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 class.
24              
25             =head1 DESCRIPTION
26              
27             This object can transform L 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
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     3   399 use strict;
  3         5  
  3         91  
67              
68              
69 3     3   13 use base qw(Bio::AlignIO);
  3         5  
  3         854  
70              
71             =head2 next_aln
72              
73             Title : next_aln
74             Usage : $aln = $stream->next_aln()
75             Function: returns the next alignment in the stream.
76             Returns : L object
77             Args : NONE
78              
79             =cut
80              
81             sub next_aln {
82 3     3 1 9 my $self = shift;
83 3         6 my $entry;
84 3         6 my ($acc, $fake_id, $start, $end, $seq, $add, %names);
85              
86 3         20 my $aln = Bio::SimpleAlign->new(-source => 'prodom');
87              
88 3         23 while( $entry = $self->_readline) {
89              
90 186 100       1081 if ($entry =~ /^AC\s+(\S+)\s*$/) { #ps 9/12/00
    100          
    100          
91 3         13 $aln->id( $1 );
92             }
93             elsif ($entry =~ /^AL\s+(\S+)\|(\S+)\s+(\d+)\s+(\d+)\s+\S+\s+(\S+)\s*$/){ #ps 9/12/00
94 171         347 $acc=$1;
95 171         199 $fake_id=$2; # Accessions have _species appended
96 171         193 $start=$3;
97 171         215 $end=$4;
98 171         231 $seq=$5;
99              
100 171         211 $names{'fake_id'} = $fake_id;
101              
102 171         373 $add = Bio::LocatableSeq->new('-seq' => $seq,
103             '-id' => $acc,
104             '-start' => $start,
105             '-end' => $end,
106             '-alphabet' => $self->alphabet,
107             );
108              
109 171         431 $aln->add_seq($add);
110             }
111             elsif ($entry =~ /^CO/) {
112             # the consensus line marks the end of the alignment part of the entry
113 3         7 last;
114             }
115             }
116            
117 3 50       13 return $aln if $aln->num_sequences;
118 0           return;
119             }
120              
121              
122              
123             =head2 write_aln
124              
125             Title : write_aln
126             Usage : $stream->write_aln(@aln)
127             Function: writes the $aln object into the stream in prodom format ###Not yet implemented!###
128             Returns : 1 for success and 0 for error
129             Args : L object
130              
131              
132             =cut
133              
134             sub write_aln {
135 0     0 1   my ($self,@aln) = @_;
136 0           $self->throw_not_implemented();
137             }
138              
139             1;