JPRED-2 Move Jpred 3.0.1 to public Git
[jpred.git] / jpred / lib / Profile / Generic.pm
1 package Profile::Generic;
2
3 use strict;
4 use warnings;
5 use base qw(Profile);
6
7 =head1 NAME
8
9 Profile::Generic
10
11 =head1 DESCRIPTION
12
13 Reads in a generic profile, where each position is represented by a line, and each piece of information is white space deliminated.
14
15 =head1 INHERITS
16
17 Profile.
18
19 =head1 METHODS
20
21 =head2 $obj->read($filehandle)
22
23 Reads in the profile contained in the file.
24
25 =cut
26
27 sub read {
28         my ($self, $fh) = @_;
29         while (<$fh>) {
30                 chomp;
31                 $self->add_pos(split);
32         }
33 }
34
35 =head2 $obj->write($filehandle);
36
37 Writes WS seperated profile, with each position on each line.
38
39 =cut
40
41 sub write {
42         my ($self, $fh) = @_;
43
44         while ((my @data = $self->get_pos) > 1) {
45                 print $fh " ".join("  ", @data), "\n";
46         }
47 }
48
49 1;