Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/AlignIO/prodom.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 # $Id: prodom.pm,v 1.8 2002/10/22 07:38:26 lapp Exp $ | |
2 # | |
3 # BioPerl module for Bio::AlignIO::prodom | |
4 | |
5 # based on the Bio::SeqIO::prodom module | |
6 # by Ewan Birney <birney@sanger.ac.uk> | |
7 # and Lincoln Stein <lstein@cshl.org> | |
8 # | |
9 # and the SimpleAlign.pm module of Ewan Birney | |
10 # | |
11 # Copyright Peter Schattner | |
12 # | |
13 # You may distribute this module under the same terms as perl itself | |
14 # _history | |
15 # September 5, 2000 | |
16 # POD documentation - main docs before the code | |
17 | |
18 =head1 NAME | |
19 | |
20 Bio::AlignIO::prodom - prodom sequence input/output stream | |
21 | |
22 =head1 SYNOPSIS | |
23 | |
24 Do not use this module directly. Use it via the L<Bio::AlignIO> class. | |
25 | |
26 =head1 DESCRIPTION | |
27 | |
28 This object can transform L<Bio::Align::AlignI> objects to and from prodom flat | |
29 file databases. | |
30 | |
31 =head1 FEEDBACK | |
32 | |
33 =head2 Reporting Bugs | |
34 | |
35 Report bugs to the Bioperl bug tracking system to help us keep track | |
36 the bugs and their resolution. | |
37 Bug reports can be submitted via email or the web: | |
38 | |
39 bioperl-bugs@bio.perl.org | |
40 http://bugzilla.bioperl.org/ | |
41 | |
42 =head1 AUTHORS - Peter Schattner | |
43 | |
44 Email: schattner@alum.mit.edu | |
45 | |
46 | |
47 =head1 APPENDIX | |
48 | |
49 The rest of the documentation details each of the object | |
50 methods. Internal methods are usually preceded with a _ | |
51 | |
52 =cut | |
53 | |
54 # Let the code begin... | |
55 | |
56 package Bio::AlignIO::prodom; | |
57 use vars qw(@ISA); | |
58 use strict; | |
59 | |
60 use Bio::AlignIO; | |
61 | |
62 @ISA = qw(Bio::AlignIO); | |
63 | |
64 =head2 next_aln | |
65 | |
66 Title : next_aln | |
67 Usage : $aln = $stream->next_aln() | |
68 Function: returns the next alignment in the stream. | |
69 Returns : L<Bio::Align::AlignI> object | |
70 Args : NONE | |
71 | |
72 =cut | |
73 | |
74 sub next_aln { | |
75 my $self = shift; | |
76 my $entry; | |
77 my ($acc, $fake_id, $start, $end, $seq, $add, %names); | |
78 | |
79 my $aln = Bio::SimpleAlign->new(-source => 'prodom'); | |
80 | |
81 while( $entry = $self->_readline) { | |
82 | |
83 if ($entry =~ /^AC\s+(\S+)\s*$/) { #ps 9/12/00 | |
84 $aln->id( $1 ); | |
85 } | |
86 elsif ($entry =~ /^AL\s+(\S+)\|(\S+)\s+(\d+)\s+(\d+)\s+\S+\s+(\S+)\s*$/){ #ps 9/12/00 | |
87 $acc=$1; | |
88 $fake_id=$2; # Accessions have _species appended | |
89 $start=$3; | |
90 $end=$4; | |
91 $seq=$5; | |
92 | |
93 $names{'fake_id'} = $fake_id; | |
94 | |
95 $add = new Bio::LocatableSeq('-seq'=>$seq, | |
96 '-id'=>$acc, | |
97 '-start'=>$start, | |
98 '-end'=>$end, | |
99 ); | |
100 | |
101 $aln->add_seq($add); | |
102 } | |
103 elsif ($entry =~ /^CO/) { | |
104 # the consensus line marks the end of the alignment part of the entry | |
105 last; | |
106 } | |
107 } | |
108 | |
109 # If $end <= 0, we have either reached the end of | |
110 # file in <> or we have encountered some other error | |
111 # | |
112 if ($end <= 0) { undef $aln;} | |
113 | |
114 | |
115 return $aln; | |
116 } | |
117 | |
118 | |
119 | |
120 =head2 write_aln | |
121 | |
122 Title : write_aln | |
123 Usage : $stream->write_aln(@aln) | |
124 Function: writes the $aln object into the stream in prodom format ###Not yet implemented!### | |
125 Returns : 1 for success and 0 for error | |
126 Args : L<Bio::Align::AlignI> object | |
127 | |
128 | |
129 =cut | |
130 | |
131 sub write_aln { | |
132 my ($self,@aln) = @_; | |
133 | |
134 $self->throw("Sorry: prodom-format output, not yet implemented! /n"); | |
135 } | |
136 | |
137 1; |