File Coverage

Bio/Tools/Seg.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 26 26 100.0


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::Tools::Seg
3             #
4             # Copyright Balamurugan Kumarasamy
5             # Totally re-written, added docs and tests -- Torsten Seemann, Sep 2006
6             #
7             # Copyright
8             # You may distribute this module under the same terms as perl itself
9             #
10             # POD documentation - main docs before the code
11              
12             =head1 NAME
13              
14             Bio::Tools::Seg - parse C output
15              
16             =head1 SYNOPSIS
17              
18             use Bio::Tools::Seg;
19             my $parser = Bio::Tools::Seg->(-file => 'seg.fasta');
20             while ( my $f = $parser->next_result ) {
21             if ($f->score < 1.5) {
22             print $f->location->to_FTstring, " is low complexity\n";
23             }
24             }
25              
26             =head1 DESCRIPTION
27              
28             C identifies low-complexity regions on a protein sequence.
29             It is usually part of the C and C packages.
30              
31             The L module will only parse the "fasta" output
32             modes of C, i.e. C (low complexity regions only),
33             C (high complexity regions only), or C (both low
34             and high).
35              
36             It creates a L for each FASTA-like entry
37             found in the input file. It is up to the user to appropriately filter
38             these using the feature's score.
39              
40             =head1 FEEDBACK
41              
42             =head2 Mailing Lists
43              
44             User feedback is an integral part of the evolution of this and other
45             Bioperl modules. Send your comments and suggestions preferably to
46             the Bioperl mailing list. Your participation is much appreciated.
47              
48             bioperl-l@bioperl.org - General discussion
49             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
50              
51             =head2 Support
52              
53             Please direct usage questions or support issues to the mailing list:
54              
55             I
56              
57             rather than to the module maintainer directly. Many experienced and
58             reponsive experts will be able look at the problem and quickly
59             address it. Please include a thorough description of the problem
60             with code and data examples if at all possible.
61              
62             =head2 Reporting Bugs
63              
64             Report bugs to the Bioperl bug tracking system to help us keep track
65             of the bugs and their resolution. Bug reports can be submitted via the
66             web:
67              
68             https://github.com/bioperl/bioperl-live/issues
69              
70             =head1 AUTHOR - Torsten Seemann
71              
72             Email - torsten.seemann AT infotech.monash.edu.au
73              
74             =head1 CONTRIBUTOR - Bala
75              
76             Email - savikalpa@fugu-sg.org
77              
78             =head1 APPENDIX
79              
80             The rest of the documentation details each of the object methods.
81             Internal methods are usually preceded with a _
82              
83             =cut
84              
85             package Bio::Tools::Seg;
86 1     1   420 use strict;
  1         1  
  1         22  
87              
88 1     1   376 use Bio::SeqFeature::Generic;
  1         2  
  1         28  
89 1     1   6 use base qw(Bio::Root::Root Bio::Root::IO);
  1         1  
  1         183  
90              
91             =head2 new
92              
93             Title : new
94             Usage : my $obj = Bio::Tools::Seg->new();
95             Function: Builds a new Bio::Tools::Seg object
96             Returns : Bio::Tools::Seg
97             Args : -fh/-file => $val, # for initing input, see Bio::Root::IO
98              
99             =cut
100              
101              
102             sub new {
103 1     1 1 10 my($class,@args) = @_;
104 1         9 my $self = $class->SUPER::new(@args);
105 1         6 $self->_initialize_io(@args);
106 1         6 return $self;
107             }
108              
109             =head2 next_result
110              
111             Title : next_result
112             Usage : my $feat = $seg->next_result
113             Function: Get the next result set from parser data
114             Returns : Bio::SeqFeature::Generic
115             Args : none
116              
117             =cut
118              
119             sub next_result {
120 4     4 1 11 my ($self) = @_;
121              
122             # For example in this line
123             # test_prot(214-226) complexity=2.26 (12/2.20/2.50)
124             # $1 is test_prot
125             # $2 is 214
126             # $3 is 226
127             # $4 is 2.26
128              
129 4         16 while (my $line = $self->_readline) {
130 9 100       33 if ($line =~ /^\>\s*?(\S+)?\s*?\((\d+)\-(\d+)\)\s*complexity=(\S+)/) {
131 3         19 return Bio::SeqFeature::Generic->new(
132             -seq_id => $1,
133             -start => $2,
134             -end => $3,
135             -score => $4,
136             -source_tag => 'Seg',
137             -primary => 'low_complexity'
138             );
139             }
140             }
141             }
142              
143              
144             1;