blib/lib/Bio/Gonzales/Seq/Filter.pm

filter: Statementstmt 59.0% 36 / 61 Branchbran 20.5% 7 / 34 Conditioncond 16.6% 6 / 36 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 80.0% 8 / 10 Podpod 75.0% 3 / 4 totaltotal 35.5% 60 / 169 CC 33 SCAR 41.6
CC
33
Cov
37%
clean_rna_seq
110.0
clean_dna_seq
110.0
clean_pep_seq
33.1
CRAP 64.4
« blib/lib/Bio/Gonzales/Graphics/BLAST.pm ↑ Summary blib/lib/Bio/Gonzales/Search/IO/BLAST.pm »
1 package Bio::Gonzales::Seq::Filter;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 our ( @EXPORT, @EXPORT_OK, %EXPORT_TAGS );
12 1 our $VERSION = '0.062'; # VERSION
13  
14 1 @EXPORT = qw();
15 1 %EXPORT_TAGS = ();
16 1 @EXPORT_OK = qw(clean_peptide_seq clean_dna_seq clean_rna_seq clean_pep_seq);
17  
18 sub clean_pep_seq {
19 1 ▶ my ( $seqs, $config ) = @_;
Subroutine clean_pep_seq: called CC=15 SCAR=35.0
Pod documented
20  
21 1 ▶ $seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq") 0 1 1
Condition33%1/3
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
!ll&&!rl&&r
100
MC/DC0%0/2
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
builtin::blessed($seqs) $seqs->isa("Bio::Gonzales::Seq")
Truth table33%1/3
A and B
A= builtin::blessed($seqs)B= $seqs->isa("Bio::Gonzales::Seq")
ABresult
0X0
100
111
22 1 ▶ confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $seqs eq "ARRAY" 0 1 1
23 1 ▶ confess "config format not readable" if ( $config && ref $config ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $config and ref $config ne "HASH" 0 1 1
Condition33%1/3
$config and ref $config ne "HASH"
!ll&&!rl&&r
100
MC/DC0%0/2
$config and ref $config ne "HASH"
$config ref $config ne "HASH"
Truth table33%1/3
A and B
A= $configB= ref $config ne "HASH"
ABresult
0X0
100
111
24  
25 1 for my $s (@$seqs) {
26  
27 1 my $seq = $s->seq;
28  
29 1 ▶ $seq =~ tr/*//d if ( !exists( $config->{terminal} ) || $config->{terminal} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"terminal"} or $config->{"terminal"} 1 0 1
Condition33%1/3
not exists $config->{"terminal"} or $config->{"terminal"}
l!l&&r!l&&!r
100
MC/DC0%0/2
not exists $config->{"terminal"} or $config->{"terminal"}
not exists $config->{"terminal"} $config->{"terminal"}
Truth table33%1/3
not(A) or B
A= not exists $config->{"terminal"}B= $config->{"terminal"}
ABresult
1X1
011
000
30 1 ▶ $seq =~ s/\*$// if ( !exists( $config->{end_terminal} ) || $config->{end_termninal} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"end_terminal"} or $config->{"end_termninal"} 1 0 1
Condition33%1/3
not exists $config->{"end_terminal"} or $config->{"end_termninal"}
l!l&&r!l&&!r
100
MC/DC0%0/2
not exists $config->{"end_terminal"} or $config->{"end_termninal"}
not exists $config->{"end_terminal"} $config->{"end_termninal"}
Truth table33%1/3
not(A) or B
A= not exists $config->{"end_terminal"}B= $config->{"end_termninal"}
ABresult
1X1
011
000
31 $seq =~ s/[^*SFTNKYEVZQMCLAOWXPBHDIRGsftnkyevzqmclaowxpbhdirg]/X/g
32 1 ▶ if ( !exists( $config->{uncommon_aa} ) || $config->{uncommon_aa} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"uncommon_aa"} or $config->{"uncommon_aa"} 1 0 1
Condition33%1/3
not exists $config->{"uncommon_aa"} or $config->{"uncommon_aa"}
l!l&&r!l&&!r
100
MC/DC0%0/2
not exists $config->{"uncommon_aa"} or $config->{"uncommon_aa"}
not exists $config->{"uncommon_aa"} $config->{"uncommon_aa"}
Truth table33%1/3
not(A) or B
A= not exists $config->{"uncommon_aa"}B= $config->{"uncommon_aa"}
ABresult
1X1
011
000
33 1 $s->seq($seq);
34 1 ▶ $s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"no_desc"} or $config->{"no_desc"} 1 0 1
Condition33%1/3
not exists $config->{"no_desc"} or $config->{"no_desc"}
l!l&&r!l&&!r
100
MC/DC0%0/2
not exists $config->{"no_desc"} or $config->{"no_desc"}
not exists $config->{"no_desc"} $config->{"no_desc"}
Truth table33%1/3
not(A) or B
A= not exists $config->{"no_desc"}B= $config->{"no_desc"}
ABresult
1X1
011
000
35 }
36 1 return $seqs;
37 }
38  
39 1 ▶sub clean_peptide_seq { return clean_pep_seq(@_); }
Subroutine clean_peptide_seq: called CC=1 SCAR=0.0
Pod undocumented
40  
41 sub clean_rna_seq {
42 0 ▶ my ( $seqs, $config ) = @_;
Subroutine clean_rna_seq: not called CC=10 SCAR=47.0
Pod documented
43  
44 0 ▶ $seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq") 0 0 0
Condition0%0/3
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
builtin::blessed($seqs) $seqs->isa("Bio::Gonzales::Seq")
Truth table0%0/3
A and B
A= builtin::blessed($seqs)B= $seqs->isa("Bio::Gonzales::Seq")
ABresult
0X0
100
111
45 0 ▶ confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $seqs eq "ARRAY" 0 0 0
46 0 ▶ confess "config format not readable" if ( $config && ref $config ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $config and ref $config ne "HASH" 0 0 0
Condition0%0/3
$config and ref $config ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$config and ref $config ne "HASH"
$config ref $config ne "HASH"
Truth table0%0/3
A and B
A= $configB= ref $config ne "HASH"
ABresult
0X0
100
111
47  
48 0 for my $s (@$seqs) {
49  
50 0 my $seq = $s->seq;
51 0 $seq =~ y/Tt/Uu/;
52 0 ▶ if ( $config->{intermediate_ambi} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config->{'intermediate_ambi'}) { } 0 0 0
53 0 $seq =~ y/AGCUNagcun/N/c;
54 } else {
55 0 $seq =~ y/agcunkmryswhbvdAGCUNKMRYSWHBVD/N/c;
56 }
57 0 $s->seq($seq);
58 0 ▶ $s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"no_desc"} or $config->{"no_desc"} 0 0 0
Condition0%0/3
not exists $config->{"no_desc"} or $config->{"no_desc"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not exists $config->{"no_desc"} or $config->{"no_desc"}
not exists $config->{"no_desc"} $config->{"no_desc"}
Truth table0%0/3
not(A) or B
A= not exists $config->{"no_desc"}B= $config->{"no_desc"}
ABresult
1X1
011
000
59 }
60 0 return $seqs;
61  
62 }
63  
64 sub clean_dna_seq {
65 0 ▶ my ( $seqs, $config ) = @_;
Subroutine clean_dna_seq: not called CC=10 SCAR=47.0
Pod documented
66  
67 0 ▶ $seqs = [$seqs] if ( blessed($seqs) && $seqs->isa('Bio::Gonzales::Seq') );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq") 0 0 0
Condition0%0/3
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($seqs) and $seqs->isa("Bio::Gonzales::Seq")
builtin::blessed($seqs) $seqs->isa("Bio::Gonzales::Seq")
Truth table0%0/3
A and B
A= builtin::blessed($seqs)B= $seqs->isa("Bio::Gonzales::Seq")
ABresult
0X0
100
111
68 0 ▶ confess "please supply the sequences as an arrayref" unless ( ref $seqs eq 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $seqs eq "ARRAY" 0 0 0
69 0 ▶ confess "config format not readable" if ( $config && ref $config ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $config and ref $config ne "HASH" 0 0 0
Condition0%0/3
$config and ref $config ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$config and ref $config ne "HASH"
$config ref $config ne "HASH"
Truth table0%0/3
A and B
A= $configB= ref $config ne "HASH"
ABresult
0X0
100
111
70  
71 0 for my $s (@$seqs) {
72  
73 0 my $seq = $s->seq;
74 0 ▶ if ( $config->{intermediate_ambi} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config->{'intermediate_ambi'}) { } 0 0 0
75 0 $seq =~ y/AGCTNagctn/N/c;
76 } else {
77 0 $seq =~ y/agctnkmryswhbvdAGCTNKMRYSWHBVD/N/c;
78 }
79 0 $s->seq($seq);
80 0 ▶ $s->desc('') if ( !exists( $config->{no_desc} ) || $config->{no_desc} );
Branch: 1 branch
BranchTrueFalseTotal
if not exists $config->{"no_desc"} or $config->{"no_desc"} 0 0 0
Condition0%0/3
not exists $config->{"no_desc"} or $config->{"no_desc"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not exists $config->{"no_desc"} or $config->{"no_desc"}
not exists $config->{"no_desc"} $config->{"no_desc"}
Truth table0%0/3
not(A) or B
A= not exists $config->{"no_desc"}B= $config->{"no_desc"}
ABresult
1X1
011
000
81 }
82 0 return $seqs;
83  
84 }
85  
86 1 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
« blib/lib/Bio/Gonzales/Graphics/BLAST.pm ↑ Summary blib/lib/Bio/Gonzales/Search/IO/BLAST.pm »