| 1 | #Copyright (c) 2010 Joachim Bargsten <code at bargsten dot org>. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Bio::Gonzales::Seq::Validate::fasta; | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our $VERSION = '0.062'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | #no use yet | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | our %alphabets = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | 'dna' => [qw(A C G T R Y M K S W H B V D X N)], | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 'rna' => [qw(A C G U R Y M K S W H B V D X N)], | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 'protein' => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | qw(A R N D C Q E G H I L K M F U | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | P S T W X Y V B Z J O *) | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | #no use yet | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | our %alphabets_strict = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 'dna' => [qw( A C G T )], | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'rna' => [qw( A C G U )], | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'protein' => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | qw(A R N D C Q E G H I L K M F U | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | P S T W Y V O) | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | our @protein_alphabet = qw/A B C D E F G H I K L M N P Q R S T V W X Y Z * \-/; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | our @nuc_alphabet = qw/A C G T U M R W S Y K V H D B X N \-/; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | has max_seq_len_out => ( is => 'ro', default => 21 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | has fh => ( is => 'rw', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | has prot_regex => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | my $r = join "", (@protein_alphabet); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | return "[$r]+"; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | has nuc_regex => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | my $r = join "", (@nuc_alphabet); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | return "[$r]+"; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | has seq_regex => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | my $r = join "", ( @protein_alphabet, @nuc_alphabet ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | return "[$r]+"; | |||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | has _error_cache => ( is => 'rw', default => sub { {} } ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=29 SCAR=37.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #clear cache | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | $self->_error_cache( {} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | my $fh = $self->fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | my $pre = $self->prot_regex; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | my $nre = $self->nuc_regex; | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | my $sre = $self->seq_regex; | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | my $header; | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | my $seq_type; | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | my $is_dos; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | my $probably_seq_in_header; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 371 | ▶ | if ( !$is_dos && /\r\n/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $is_dos and /\r\n/
MC/DC50%1/2
not $is_dos and /\r\n/
not $is_dos
/\r\n/
Truth table66%2/3
not(A) and B
A= not $is_dosB= /\r\n/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | $is_dos = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | $self->_add_error( 0, "File seems to be in DOS format" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | s/\r\n/\n/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 371 | ▶ | if ($is_dos); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 371 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 371 | ▶ | if (/^>/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 182 | ▶ | if ( $header && $probably_seq_in_header ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$header and $probably_seq_in_header
MC/DC100%2/2
$header and $probably_seq_in_header
$header
$probably_seq_in_header
Truth table100%3/3
A and B
A= $headerB= $probably_seq_in_header
| |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 4 | $self->_add_error( | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | ( $. - 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | "Wrong header format, seems to be sequence in the header: >>" | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | . $self->_shorten_seq($probably_seq_in_header) . "<<" | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | undef $probably_seq_in_header; | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | } elsif ($header) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | $self->_add_error( $. - 1, "No sequence after header." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | #header | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 182 | for my $re ( $pre, $nre ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 364 | ▶ | $probably_seq_in_header = $1 | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
/\s+($re)\s*$/ || /\s+($re)\s*$/i and length $1 > 3
/\s+($re)\s*$/ or /\s+($re)\s*$/i
MC/DC66%2/3
/\s+($re)\s*$/ || /\s+($re)\s*$/i and length $1 > 3
/\s+($re)\s*$/
/\s+($re)\s*$/i
length $1 > 3
Truth table60%3/5
A or B and C
A= /\s+($re)\s*$/B= /\s+($re)\s*$/iC= length $1 > 3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | if ( ( (/\s+($re)\s*$/) || (/\s+($re)\s*$/i) ) && length($1) > 3 ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 182 | $header = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 182 | ▶ | if (/^>([^\s]+)/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 182 | ▶ | $self->_add_error( $., "ID is very long: " . $self->_shorten_seq($1) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | if ( length($1) > 50 ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | $self->_add_error( $., "ID is ambiguous. $1" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 182 | ▶ | if ( exists $seen{$1} ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 182 | $seen{$1} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | } elsif (/^>\s*$/) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->_add_error( $., "Empty header" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $self->_add_error( $., "No ID in header." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 182 | undef $seq_type; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | } elsif (/[^>]+>/) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | $self->_add_error( $., "Wrong header format, '>' not in the beginning." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | $self->_add_error( $. - 1, "No sequence after header." ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | if ($header); | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | $header = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | undef $seq_type; | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | } elsif (/^\s*$/) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $self->_add_error( $., "Empty line." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | ▶ | } elsif ( $header || $seq_type ) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$header or $seq_type
MC/DC0%0/2
$header or $seq_type
$header
$seq_type
Truth table66%2/3
A or B
A= $headerB= $seq_type
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | #now sequence should be there | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 185 | ▶ | if ( $seq_type && !/^$seq_type$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seq_type and not /^$seq_type$/i
MC/DC0%0/2
$seq_type and not /^$seq_type$/i
$seq_type
not /^$seq_type$/i
Truth table66%2/3
A and not(B)
A= $seq_typeB= not /^$seq_type$/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my @unknown = $self->_find_unknown_character( $_, $sre ); | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ( @unknown > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->_add_error( $., "Found unknown characters: >>" . join( "", @unknown ) . "<<" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->_add_error( $., "Sequence type switch (from nucleotide to protein or vice versa)" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 185 | ▶ | if (/^$pre$/i) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 180 | $seq_type = $pre; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | } elsif (/^$nre$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $seq_type = $nre; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 5 | my @unknown = $self->_find_unknown_character( $_, $sre ); | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5 | ▶ | if ( @unknown > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 5 | $self->_add_error( $., "Found unknown characters: >>" . join( "", @unknown ) . "<<" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $self->_add_error( $., "Found mixed protein and DNA/RNA sequence." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 5 | $seq_type = $sre; | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 185 | undef $header; | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $self->_add_error( $., " ERROR IN THE SCRIPT" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | ▶ | if ( keys %{ $self->_error_cache } > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | return $self->_error_cache; | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | sub _add_error { | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 17 | ▶ | my ( $self, $line, $msg ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_error: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 17 | ▶ | $self->_error_cache->{$line} = [] unless defined $self->_error_cache->{$line}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 17 | push @{ $self->_error_cache->{$line} }, $msg; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | sub _find_unknown_character { | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 5 | ▶ | my ( $self, $seq, @re ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_unknown_character: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | my @unknown; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | my @seq = split //, $seq; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | for my $re (@re) { | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | 5 | for my $c (@seq) { | |||||||||||||||||||||||||||||||||||||||||||||
| 180 | 176 | ▶ | push @unknown, $c | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | unless ( $c =~ /$re/i ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | return @unknown; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | sub _shorten_seq { | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | ▶ | my ( $self, $seq ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_shorten_seq: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | my $len = $self->max_seq_len_out; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | my $short_seq; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | ▶ | if ( length($seq) >= $len ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 4 | $short_seq = substr $seq, 0, 9; | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | 4 | $short_seq .= " ... "; | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | 4 | $short_seq .= substr $seq, -9; | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 4 | return $short_seq; | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return $seq; | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||