line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Gonzales::Seq::Filter; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16399
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
6
|
1
|
|
|
1
|
|
6
|
use Scalar::Util qw/blessed/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
19
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
848
|
|
11
|
|
|
|
|
|
|
our ( @EXPORT, @EXPORT_OK, %EXPORT_TAGS ); |
12
|
|
|
|
|
|
|
our $VERSION = '0.083'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@EXPORT = qw(); |
15
|
|
|
|
|
|
|
%EXPORT_TAGS = (); |
16
|
|
|
|
|
|
|
@EXPORT_OK = qw(clean_peptide_seq clean_dna_seq clean_rna_seq clean_pep_seq); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub clean_pep_seq { |
19
|
1
|
|
|
1
|
1
|
4
|
my ( $seqs, $config ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
33
|
|
|
5
|
$seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') ); |
22
|
1
|
50
|
|
|
|
4
|
confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' ); |
23
|
1
|
50
|
33
|
|
|
4
|
confess "config format not readable" if ( $config && ref $config ne 'HASH' ); |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
3
|
for my $s (@$seqs) { |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
4
|
my $seq = $s->seq; |
28
|
|
|
|
|
|
|
|
29
|
1
|
50
|
33
|
|
|
18
|
$seq =~ tr/*//d if ( !exists( $config->{terminal} ) || $config->{terminal} ); |
30
|
1
|
50
|
33
|
|
|
11
|
$seq =~ s/\*$// if ( !exists( $config->{end_terminal} ) || $config->{end_termninal} ); |
31
|
|
|
|
|
|
|
$seq =~ s/[^*SFTNKYEVZQMCLAOWXPBHDIRGsftnkyevzqmclaowxpbhdirg]/X/g |
32
|
1
|
50
|
33
|
|
|
17
|
if ( !exists( $config->{uncommon_aa} ) || $config->{uncommon_aa} ); |
33
|
1
|
|
|
|
|
5
|
$s->seq($seq); |
34
|
1
|
50
|
33
|
|
|
7
|
$s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} ); |
35
|
|
|
|
|
|
|
} |
36
|
1
|
|
|
|
|
9
|
return $seqs; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
0
|
8
|
sub clean_peptide_seq { return clean_pep_seq(@_); } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub clean_rna_seq { |
42
|
0
|
|
|
0
|
1
|
|
my ( $seqs, $config ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
0
|
|
|
|
$seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') ); |
45
|
0
|
0
|
|
|
|
|
confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' ); |
46
|
0
|
0
|
0
|
|
|
|
confess "config format not readable" if ( $config && ref $config ne 'HASH' ); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
for my $s (@$seqs) { |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $seq = $s->seq; |
51
|
0
|
|
|
|
|
|
$seq =~ y/Tt/Uu/; |
52
|
0
|
0
|
|
|
|
|
if ( $config->{intermediate_ambi} ) { |
53
|
0
|
|
|
|
|
|
$seq =~ y/AGCUNagcun/N/c; |
54
|
|
|
|
|
|
|
} else { |
55
|
0
|
|
|
|
|
|
$seq =~ y/agcunkmryswhbvdAGCUNKMRYSWHBVD/N/c; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
$s->seq($seq); |
58
|
0
|
0
|
0
|
|
|
|
$s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} ); |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
return $seqs; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub clean_dna_seq { |
65
|
0
|
|
|
0
|
1
|
|
my ( $seqs, $config ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
0
|
0
|
0
|
|
|
|
$seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') ); |
68
|
0
|
0
|
|
|
|
|
confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' ); |
69
|
0
|
0
|
0
|
|
|
|
confess "config format not readable" if ( $config && ref $config ne 'HASH' ); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
for my $s (@$seqs) { |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $seq = $s->seq; |
74
|
0
|
0
|
|
|
|
|
if ( $config->{intermediate_ambi} ) { |
75
|
0
|
|
|
|
|
|
$seq =~ y/AGCTNagctn/N/c; |
76
|
|
|
|
|
|
|
} else { |
77
|
0
|
|
|
|
|
|
$seq =~ y/agctnkmryswhbvdAGCTNKMRYSWHBVD/N/c; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
$s->seq($seq); |
80
|
0
|
0
|
0
|
|
|
|
$s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} ); |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
return $seqs; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Bio::Gonzales::Seq::Filter - filter sequence data |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
use Bio::Gonzales::Seq::Filter qw(clean_pep_seq clean_dna_seq clean_rna_seq); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SUBROUTINES |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item B<< $seqs = clean_dna_seq(\@seqs!, \%config) >> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Do some cleaning, substitute invalid nucleotides with N, remove the |
107
|
|
|
|
|
|
|
description of the sequence objects. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
C<clean_dna_seq> leaves the sequence object description untouched if |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
%config = ( no_desc => 0 ); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item B<< $seqs = clean_pep_seq(\@seqs!, \%config) >> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item B<< $seqs = clean_rna_seq(\@seqs!, \%config) >> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SEE ALSO |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
jw bargsten, C<< <jwb at cpan dot org> >> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |