lib/Bio/AssemblyImprovement/Util/GetReadLengthsRole.pm

filter: Statementstmt 64.2% 18 / 28 Branchbran 33.3% 4 / 12 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 49.0% 27 / 55 CC 9 SCAR 26.3
CC
9
Cov
50%
_get_read_names_and_lengths
30.0
_get_read_lengths
5.5
BEGIN
1.0
CRAP 13.9
« blib/script/abacas.pl ↑ Summary lib/Bio/AssemblyImprovement/Circlator/Main.pm »
1 package Bio::AssemblyImprovement::Util::GetReadLengthsRole;
2 # ABSTRACT: Role for getting the read lengths from a fastq file (useful when reads are of varying lengths)
3  
4  
5 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 0 ▶sub _get_read_names_and_lengths {
Subroutine _get_read_names_and_lengths: not called CC=5 SCAR=34.0
10
11 0 my ( $self, $input_filename) = @_;
12 0 ▶ return undef unless(defined($input_filename));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $input_filename 0 0 0
13
14 0 my %read_names_with_length;
15
16 0 ▶ if ( $input_filename =~ /\.fq$/ || $input_filename =~ /\.fastq$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/) { } 0 0 0
Condition0%0/3
$input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/
$input_filename =~ /\.fq$/ $input_filename =~ /\.fastq$/
Truth table0%0/3
A or B
A= $input_filename =~ /\.fq$/B= $input_filename =~ /\.fastq$/
ABresult
1X1
011
000
17 0 my $fastq_obj = Bio::SeqIO->new( -file => $input_filename , -format => 'Fastq');
18 0 ▶ while(my $seq = $fastq_obj->next_seq()){
Branch: 1 branch
BranchTrueFalseTotal
if (my $seq = $fastq_obj->next_seq) 0 0 0
19 # Add the read name and the read length to the hash
20 0 $read_names_with_length{ $seq->id() } = length( $seq->seq() );
21 }
22
23 0 return \%read_names_with_length;
24 }
25 else {
26 0 return undef; # Error message?
27 }
28 }
29  
30 2 ▶sub _get_read_lengths {
Subroutine _get_read_lengths: called CC=5 SCAR=17.1
31
32 2 my ( $self, $input_filename) = @_;
33 2 ▶ return undef unless(defined($input_filename));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $input_filename 0 2 2
34
35 2 my @read_lengths;
36
37 2 ▶ if ( $input_filename =~ /\.fq$/ || $input_filename =~ /\.fastq$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/) { } 2 0 2
Condition33%1/3
$input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/
l!l&&r!l&&!r
020
MC/DC0%0/2
$input_filename =~ /\.fq$/ or $input_filename =~ /\.fastq$/
$input_filename =~ /\.fq$/ $input_filename =~ /\.fastq$/
Truth table33%1/3
A or B
A= $input_filename =~ /\.fq$/B= $input_filename =~ /\.fastq$/
ABresult
1X1
011
000
38 2 my $fastq_obj = Bio::SeqIO->new( -file => $input_filename , -format => 'Fastq');
39 2 ▶ while(my $seq = $fastq_obj->next_seq()){
Branch: 1 branch
BranchTrueFalseTotal
if (my $seq = $fastq_obj->next_seq) 8 2 10
40 # Add the read lengths to an array
41 8 push( @read_lengths, length($seq->seq()) );
42 }
43 2 return \@read_lengths;
44 }
45 else {
46 0 return undef; # Error message?
47 }
48 }
49  
50 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 4 1;
52  
53 __END__
« blib/script/abacas.pl ↑ Summary lib/Bio/AssemblyImprovement/Circlator/Main.pm »