| 1 | package Bio::Gonzales::Seq::Filter::ProteinCleaner; | ||
| 2 | use Bio::Gonzales::Util qw/flatten/; | ||
| 3 | |||
| 4 | use Mouse; | ||
| 5 | |||
| 6 | use warnings; | ||
| 7 | use strict; | ||
| 8 | |||
| 9 | use 5.010; | ||
| 10 | |||
| 11 | our $VERSION = '0.062'; # VERSION | ||
| 12 | |||
| 13 | has no_desc => ( is => 'rw', default => 1 ); | ||
| 14 | has uncommon_aa => ( is => 'rw', default => 1 ); | ||
| 15 | has end_terminal => ( is => 'rw', default => 1 ); | ||
| 16 | has terminal => ( is => 'rw', default => 1 ); | ||
| 17 | |||
| 18 | sub clean { | ||
| 19 | my ( $self, @seq_objs ) = @_; | ||
| 20 | my @seqs = flatten(@seq_objs); | ||
| 21 | for my $s (@seqs) { | ||
| 22 | |||
| 23 | my $seq = $s->seq; | ||
| 24 | |||
| 25 | $seq =~ tr/*//d if ( $self->terminal ); | ||
| 26 | $seq =~ s/\*$// if ( $self->end_terminal ); | ||
| 27 | $seq =~ s/[^*SFTNKYEVZQMCLAOWXPBHDIRGsftnkyevzqmclaowxpbhdirg]/X/ if ( $self->uncommon_aa ); | ||
| 28 | $s->seq($seq); | ||
| 29 | $s->desc('') if ( $self->no_desc ); | ||
| 30 | } | ||
| 31 | return \@seqs; | ||
| 32 | } | ||
| 33 | |||
| 34 | sub BUILD { | ||
| 35 | warn "DEPRECATED, use Bio::Gonzales::Seq::Filter"; | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; | ||
| 39 | |||
| 40 | __END__ | ||
| 41 | |||
| 42 | =head1 NAME | ||
| 43 | |||
| 44 | Bio::Gonzales::Seq::Filter::ProteinCleaner - clean protein sequences | ||
| 45 | |||
| 46 | =head1 SYNOPSIS | ||
| 47 | |||
| 48 | my $pc = Bio::Gonzales::Seq::Filter::ProteinCleaner->new(no_desc => 1, uncommon_aa => 1, terminal => 1); | ||
| 49 | my $seqs = $pc->clean(@seqs) | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | Remove or replace strings from protein sequences that usually confuse 3rd party software | ||
| 54 | |||
| 55 | =head1 METHODS | ||
| 56 | |||
| 57 | =over 4 | ||
| 58 | |||
| 59 | =item B<< $seqs = $pc->clean(@seqs) >> | ||
| 60 | |||
| 61 | Clean the sequences C<@seqs>. Works on the objects. | ||
| 62 | |||
| 63 | =back | ||
| 64 | |||
| 65 | =head1 AUTHOR | ||
| 66 | |||
| 67 | jw bargsten, C<< <joachim.bargsten at wur.nl> >> | ||
| 68 | |||
| 69 | =cut |