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

filter: Statementstmt 63.1% 36 / 57 Branchbran 23.3% 7 / 30 Conditioncond 16.6% 6 / 36 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 80.0% 8 / 10 Podpod 75.0% 3 / 4 totaltotal 37.2% 60 / 161 CC 31 SCAR 39.7
CC
31
Cov
40%
clean_rna_seq
90.0
clean_dna_seq
90.0
clean_pep_seq
33.1
CRAP 53.1
« blib/lib/Bio/Gonzales/Feat/IO/SWISS.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.058'; # 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=9 SCAR=45.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 $seq =~ y/AGCUNagcun/N/c;
53 0 $s->seq($seq);
54 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
55 }
56 0 return $seqs;
57  
58 }
59  
60 sub clean_dna_seq {
61 0 ▶ my ( $seqs, $config ) = @_;
Subroutine clean_dna_seq: not called CC=9 SCAR=45.0
Pod documented
62  
63  
64 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
65 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
66 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
67  
68 0 for my $s (@$seqs) {
69  
70 0 my $seq = $s->seq;
71 0 $seq =~ y/AGCTNagctn/N/c;
72 0 $s->seq($seq);
73 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
74 }
75 0 return $seqs;
76  
77 }
78  
79 1 1;
80  
81 __END__
82  
83 =head1 NAME
84  
85 Bio::Gonzales::Seq::Filter - filter sequence data
86  
87 =head1 SYNOPSIS
88  
89 use Bio::Gonzales::Seq::Filter qw(clean_pep_seq clean_dna_seq clean_rna_seq);
90  
91 =head1 DESCRIPTION
92  
93 =head1 SUBROUTINES
94  
95 =over 4
96  
97 =item B<< $seqs = clean_dna_seq(\@seqs!, \%config) >>
98  
99 Do some cleaning, substitute invalid nucleotides with N, remove the
100 description of the sequence objects.
101  
102 C<clean_dna_seq> leaves the sequence object description untouched if
103  
104 %config = ( no_desc => 0 );
105  
106 =item B<< $seqs = clean_pep_seq(\@seqs!, \%config) >>
107  
108 =item B<< $seqs = clean_rna_seq(\@seqs!, \%config) >>
109  
110 =back
111  
112 =head1 SEE ALSO
113  
114 =head1 AUTHOR
115  
116 jw bargsten, C<< <jwb at cpan dot org> >>
117  
118 =cut
« blib/lib/Bio/Gonzales/Feat/IO/SWISS.pm ↑ Summary blib/lib/Bio/Gonzales/Search/IO/BLAST.pm »