| 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<seg> 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<seg> identifies low-complexity regions on a protein sequence. | ||||||||||
| 29 | It is usually part of the C<WU-BLAST> and C<InterProScan> packages. | ||||||||||
| 30 | |||||||||||
| 31 | The L<Bio::Tools::Seg> module will only parse the "fasta" output | ||||||||||
| 32 | modes of C<seg>, i.e. C<seg -l> (low complexity regions only), | ||||||||||
| 33 | C<seg -h> (high complexity regions only), or C<seg -a> (both low | ||||||||||
| 34 | and high). | ||||||||||
| 35 | |||||||||||
| 36 | It creates a L<Bio::SeqFeature::Generic> 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<bioperl-l@bioperl.org> | ||||||||||
| 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 | 2 | $Bio::Tools::Seg::VERSION = '1.7.8'; | |||||||||
| 87 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 88 | |||||||||||
| 89 | 2 | ▶ | use Bio::SeqFeature::Generic; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 90 | 2 | ▶ | use base qw(Bio::Root::Root Bio::Root::IO); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 91 | |||||||||||
| 92 | =head2 new | ||||||||||
| 93 | |||||||||||
| 94 | Title : new | ||||||||||
| 95 | Usage : my $obj = Bio::Tools::Seg->new(); | ||||||||||
| 96 | Function: Builds a new Bio::Tools::Seg object | ||||||||||
| 97 | Returns : Bio::Tools::Seg | ||||||||||
| 98 | Args : -fh/-file => $val, # for initing input, see Bio::Root::IO | ||||||||||
| 99 | |||||||||||
| 100 | =cut | ||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 104 | 1 | my($class,@args) = @_; | |||||||||
| 105 | 1 | my $self = $class->SUPER::new(@args); | |||||||||
| 106 | 1 | $self->_initialize_io(@args); | |||||||||
| 107 | 1 | return $self; | |||||||||
| 108 | } | ||||||||||
| 109 | |||||||||||
| 110 | =head2 next_result | ||||||||||
| 111 | |||||||||||
| 112 | Title : next_result | ||||||||||
| 113 | Usage : my $feat = $seg->next_result | ||||||||||
| 114 | Function: Get the next result set from parser data | ||||||||||
| 115 | Returns : Bio::SeqFeature::Generic | ||||||||||
| 116 | Args : none | ||||||||||
| 117 | |||||||||||
| 118 | =cut | ||||||||||
| 119 | |||||||||||
| 120 | 4 | ▶ | sub next_result { | ||||||||
|
Subroutine
next_result: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 121 | 4 | my ($self) = @_; | |||||||||
| 122 | |||||||||||
| 123 | # For example in this line | ||||||||||
| 124 | # test_prot(214-226) complexity=2.26 (12/2.20/2.50) | ||||||||||
| 125 | # $1 is test_prot | ||||||||||
| 126 | # $2 is 214 | ||||||||||
| 127 | # $3 is 226 | ||||||||||
| 128 | # $4 is 2.26 | ||||||||||
| 129 | |||||||||||
| 130 | 4 | ▶ | while (my $line = $self->_readline) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 131 | 9 | ▶ | if ($line =~ /^\>\s*?(\S+)?\s*?\((\d+)\-(\d+)\)\s*complexity=(\S+)/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 132 | 3 | return Bio::SeqFeature::Generic->new( | |||||||||
| 133 | -seq_id => $1, | ||||||||||
| 134 | -start => $2, | ||||||||||
| 135 | -end => $3, | ||||||||||
| 136 | -score => $4, | ||||||||||
| 137 | -source_tag => 'Seg', | ||||||||||
| 138 | -primary => 'low_complexity' | ||||||||||
| 139 | ); | ||||||||||
| 140 | } | ||||||||||
| 141 | } | ||||||||||
| 142 | } | ||||||||||
| 143 | |||||||||||
| 144 | |||||||||||
| 145 | 2 | 1; | |||||||||