| 1 | package MS::Protein; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use Exporter qw/import/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use List::Util qw/sum/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use List::MoreUtils qw/any uniq/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use MS::Mass qw/:all/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use MS::CV qw/:MS regex_for/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use MS::Peptide; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use parent qw/MS::Peptide/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | *ec = \&extinction_coefficient; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | *pI = \&isoelectric_point; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | *ai = \&aliphatic_index; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | *mw = \&molecular_weight; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | our @EXPORT_OK = qw/ | |||||||||||||||||||||||||||||||||||||||||
| 28 | digest | ||||||||||||||||||||||||||||||||||||||||||
| 29 | isoelectric_point | ||||||||||||||||||||||||||||||||||||||||||
| 30 | pI | ||||||||||||||||||||||||||||||||||||||||||
| 31 | molecular_weight | ||||||||||||||||||||||||||||||||||||||||||
| 32 | mw | ||||||||||||||||||||||||||||||||||||||||||
| 33 | gravy | ||||||||||||||||||||||||||||||||||||||||||
| 34 | aliphatic_index | ||||||||||||||||||||||||||||||||||||||||||
| 35 | ai | ||||||||||||||||||||||||||||||||||||||||||
| 36 | n_residues | ||||||||||||||||||||||||||||||||||||||||||
| 37 | n_atoms | ||||||||||||||||||||||||||||||||||||||||||
| 38 | extinction_coefficient | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ec | ||||||||||||||||||||||||||||||||||||||||||
| 40 | charge_at_pH | ||||||||||||||||||||||||||||||||||||||||||
| 41 | /; | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 44 | all => \@EXPORT_OK, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # build lookup tables | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 3 | my $kyte_doolittle = _kyte_doolittle(); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 3 | my $pK = _pK(); | |||||||||||||||||||||||||||||||||||||||||
| 50 | 3 | my $pKt = _pKt(); | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | ▶ | sub molecular_weight { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
molecular_weight: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | my ($seq, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | ▶ | return sum( map {aa_mass($_, $type) // return} | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
aa_mass($_, $type) // (return)
MC/DC0%0/1
aa_mass($_, $type) // (return)
aa_mass($_, $type)
Truth table50%1/2
A
A= aa_mass($_, $type)
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | split('', $seq) ) + formula_mass('H2O'); | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | sub n_atoms { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_atoms: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | my ($seq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | my %counts; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ++$counts{$_} for (split '', $seq); | |||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | my %atoms = (H => 2, O => 1); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | for my $aa (keys %counts) { | |||||||||||||||||||||||||||||||||||||||||
| 67 | 20 | my $a = atoms('aa' => $aa); | |||||||||||||||||||||||||||||||||||||||||
| 68 | 20 | $atoms{$_} += $a->{$_}*$counts{$aa} for (keys %$a); | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | return \%atoms; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | ▶ | sub n_residues { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_residues: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | my ($seq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 4 | my %counts; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | ++$counts{$_} for (split '', $seq); | |||||||||||||||||||||||||||||||||||||||||
| 79 | 4 | return \%counts; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | sub aliphatic_index { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
aliphatic_index: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | my ($seq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | $seq = "$seq"; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | my $mf_A = $seq =~ tr/A//; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | my $mf_V = $seq =~ tr/V//; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | my $mf_IL = $seq =~ tr/IL//; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | return ($mf_A + 2.9*$mf_V + 3.9*$mf_IL) * 100 / length($seq); | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub extinction_coefficient { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extinction_coefficient: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my ($seq, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $is_reduced = $args{reduced}; | |||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $seq = "$seq"; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $Y = $seq =~ tr/Y//; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $W = $seq =~ tr/W//; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $C = $seq =~ tr/C//; | |||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | return $is_reduced | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | ? 1490*$Y + 5500*$W | ||||||||||||||||||||||||||||||||||||||||||
| 109 | : 1490*$Y + 5500*$W + 125*int($C/2); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | ▶ | sub gravy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gravy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | my ($seq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | return sum( map {$kyte_doolittle->{$_}} split( '', $seq) ) | |||||||||||||||||||||||||||||||||||||||||
| 117 | / length($seq); | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | ▶ | sub digest { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
digest: called CC=20 SCAR=30.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | my ($arg1, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # can be used as function or method, so test whether first argument is | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # MS::Protein object (otherwise should be simple string) | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 2 | ▶ | my $as_method = ref($arg1) && blessed($arg1) && $arg1->isa('MS::Protein'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
ref $arg1 && builtin::blessed($arg1) && $arg1->isa('MS::Protein')
ref $arg1 and builtin::blessed($arg1)
MC/DC0%0/3
ref $arg1 && builtin::blessed($arg1) && $arg1->isa('MS::Protein')
ref $arg1
builtin::blessed($arg1)
$arg1->isa('MS::Protein')
Truth table25%1/4
A and B && C
A= ref $arg1B= builtin::blessed($arg1)C= $arg1->isa('MS::Protein')
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | ▶ | my $seq = $as_method ? $arg1->seq : $arg1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | ▶ | my $enzymes = $args{enzymes} // croak "enzyme must be specified"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"enzymes"} // croak("enzyme must be specified")
MC/DC0%0/1
$args{"enzymes"} // croak("enzyme must be specified")
$args{"enzymes"}
Truth table50%1/2
A
A= $args{"enzymes"}
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | ▶ | my $missed = $args{missed} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"missed"} // 0
MC/DC100%1/1
$args{"missed"} // 0
$args{"missed"}
Truth table100%2/2
A
A= $args{"missed"}
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | my $min_len = $args{min_len} // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"min_len"} // 1
MC/DC100%1/1
$args{"min_len"} // 1
$args{"min_len"}
Truth table100%2/2
A
A= $args{"min_len"}
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | my $nme = $args{nme} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"nme"} // 0
MC/DC100%1/1
$args{"nme"} // 0
$args{"nme"}
Truth table100%2/2
A
A= $args{"nme"}
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | my @re = map {regex_for($_)} @$enzymes; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | croak "one or more enzyme CVs are not valid" if (any {! defined $_} @re); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | my @cut_sites = (0); | |||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | for (@re) { | |||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | while ($seq =~ /$_/ig) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 154 | push @cut_sites, $-[0]; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | my $seq_len = length $seq; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 2 | push @cut_sites, $seq_len; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | @cut_sites = sort {$a <=> $b} uniq @cut_sites; | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | # need to know later, only calculate once | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | my $starts_M = substr($seq, 0, 1) eq 'M'; | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | my @peptides; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | for my $i (0..$#cut_sites) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | A: | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 156 | for my $a (1..$missed+1) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 233 | $a = $i + $a; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 233 | ▶ | last A if ($a > $#cut_sites); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 230 | my @cuts = ($cut_sites[$i]); | |||||||||||||||||||||||||||||||||||||||||
| 160 | # If N-terminal methionine excision is requested, | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # add an extra first peptide if we're at the first cut site | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # and the peptide starts with M | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 230 | ▶ | if ($nme && $starts_M && $i == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$nme and $starts_M and $i == 0
$nme and $starts_M
MC/DC66%2/3
$nme and $starts_M and $i == 0
$nme
$starts_M
$i == 0
Truth table75%3/4
A and B and C
A= $nmeB= $starts_MC= $i == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | push @cuts, $cut_sites[$i] + 1; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 230 | for my $start (@cuts) { | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 232 | my $str = substr $seq, $start, | |||||||||||||||||||||||||||||||||||||||||
| 169 | $cut_sites[$a]-$start; | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 232 | ▶ | next if (length($str) < $min_len); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 195 | ▶ | if ($as_method) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 195 | push @peptides, $arg1->range( | |||||||||||||||||||||||||||||||||||||||||
| 174 | $start+1, | ||||||||||||||||||||||||||||||||||||||||||
| 175 | $cut_sites[$a], | ||||||||||||||||||||||||||||||||||||||||||
| 176 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | #return simple strings | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | push @peptides, $str; | |||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | return @peptides | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | sub isoelectric_point { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isoelectric_point: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | my ($seq) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | $seq = "$seq"; # convert object to string if needed | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # the ProMoST webserver counts charged terminal residues twice | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # (maybe a bug). Swap comments to emulate this behavior. | ||||||||||||||||||||||||||||||||||||||||||
| 201 | #my $nt = substr $seq, 0, 1; | ||||||||||||||||||||||||||||||||||||||||||
| 202 | #my $ct = substr $seq, -1, 1; | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | my $nt = substr $seq, 0, 1, ''; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | my $ct = substr $seq, -1, 1, ''; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | my $res = n_residues($seq); | |||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | my $z = 1; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | my $pH = 7; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | my $cut = 0.002; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | my $upper = 14; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | my $lower = 0; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | my $max_iter = 100; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | for (1..$max_iter) { | |||||||||||||||||||||||||||||||||||||||||
| 215 | 16 | $z = _charge_at_pH( $nt, $ct, $res, $pH ); | |||||||||||||||||||||||||||||||||||||||||
| 216 | 16 | ▶ | $upper = $z < 0 ? $pH : $upper; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 16 | ▶ | $lower = $z < 0 ? $lower : $pH; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 16 | $pH = ($upper+$lower)/2; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 16 | ▶ | last if (abs($z) <= $cut); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | return if (abs($z) > $cut); # failed to converge | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | return $pH; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 2 | ▶ | sub charge_at_pH { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
charge_at_pH: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | my ($seq, $pH) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | $seq = "$seq"; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | ▶ | die "Must specify pH" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | if (! defined $pH); | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | # the ProMoST webserver counts charged terminal residues twice | ||||||||||||||||||||||||||||||||||||||||||
| 234 | # (maybe a bug). Swap comments to emulate this behavior. | ||||||||||||||||||||||||||||||||||||||||||
| 235 | #my $nt = substr $seq, 0, 1; | ||||||||||||||||||||||||||||||||||||||||||
| 236 | #my $ct = substr $seq, -1, 1; | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | my $nt = substr $seq, 0, 1, ''; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | my $ct = substr $seq, -1, 1, ''; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | my $res = n_residues($seq); | |||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | return _charge_at_pH( $nt, $ct, $res, $pH ); | |||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 18 | ▶ | sub _charge_at_pH { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_charge_at_pH: called CC=10 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 18 | my ($nt, $ct, $other, $pH) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 18 | ▶ | my @p = map { ($pK->{$_}->[0]) x ($other->{$_} // 0) } qw/K R H /; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$other->{$_} // 0
MC/DC0%0/1
$other->{$_} // 0
$other->{$_}
Truth table50%1/2
A
A= $other->{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 18 | ▶ | my @n = map { ($pK->{$_}->[0]) x ($other->{$_} // 0) } qw/D E C Y/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$other->{$_} // 0
MC/DC0%0/1
$other->{$_} // 0
$other->{$_}
Truth table50%1/2
A
A= $other->{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | # terminal charges | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 18 | push @p, $pKt->{$nt}->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 18 | ▶ | push @n, defined $ct ? $pKt->{$ct}->[1] : $pKt->{$nt}->[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 18 | ▶ | push @p, $pK->{$nt}->[1] if (any {$nt eq $_} qw/K R H /); # N-term res | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 18 | ▶ | push @p, $pK->{$ct}->[2] if (any {$ct eq $_} qw/K R H /); # C-term res | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 18 | ▶ | push @n, $pK->{$nt}->[1] if (any {$nt eq $_} qw/D E C Y/); # N-term res | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 18 | ▶ | push @n, $pK->{$ct}->[2] if (any {$ct eq $_} qw/D E C Y/); # C-term res | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 18 | my $Ct = 0; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 18 | ▶ | $Ct += sum map { 1/(1 + 10**($pH-$_))} @p if (scalar @p); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 18 | ▶ | $Ct += sum map {-1/(1 + 10**($_-$pH))} @n if (scalar @n); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 18 | return $Ct; | |||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 3 | ▶ | sub _kyte_doolittle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_kyte_doolittle: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | A => 1.8, | |||||||||||||||||||||||||||||||||||||||||
| 274 | R => -4.5, | ||||||||||||||||||||||||||||||||||||||||||
| 275 | N => -3.5, | ||||||||||||||||||||||||||||||||||||||||||
| 276 | D => -3.5, | ||||||||||||||||||||||||||||||||||||||||||
| 277 | C => 2.5, | ||||||||||||||||||||||||||||||||||||||||||
| 278 | Q => -3.5, | ||||||||||||||||||||||||||||||||||||||||||
| 279 | E => -3.5, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | G => -0.4, | ||||||||||||||||||||||||||||||||||||||||||
| 281 | H => -3.2, | ||||||||||||||||||||||||||||||||||||||||||
| 282 | I => 4.5, | ||||||||||||||||||||||||||||||||||||||||||
| 283 | L => 3.8, | ||||||||||||||||||||||||||||||||||||||||||
| 284 | K => -3.9, | ||||||||||||||||||||||||||||||||||||||||||
| 285 | M => 1.9, | ||||||||||||||||||||||||||||||||||||||||||
| 286 | F => 2.8, | ||||||||||||||||||||||||||||||||||||||||||
| 287 | P => -1.6, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | S => -0.8, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | T => -0.7, | ||||||||||||||||||||||||||||||||||||||||||
| 290 | W => -0.9, | ||||||||||||||||||||||||||||||||||||||||||
| 291 | Y => -1.3, | ||||||||||||||||||||||||||||||||||||||||||
| 292 | V => 4.2, | ||||||||||||||||||||||||||||||||||||||||||
| 293 | X => 0.0, | ||||||||||||||||||||||||||||||||||||||||||
| 294 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 3 | ▶ | sub _pK { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pK: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | return { # in Nterm Cterm | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 3 | K => [ 9.80, 10.00, 10.30 ], | |||||||||||||||||||||||||||||||||||||||||
| 302 | R => [ 12.50, 11.50, 11.50 ], | ||||||||||||||||||||||||||||||||||||||||||
| 303 | H => [ 6.08, 4.89, 6.89 ], | ||||||||||||||||||||||||||||||||||||||||||
| 304 | D => [ 4.07, 3.57, 4.57 ], | ||||||||||||||||||||||||||||||||||||||||||
| 305 | E => [ 4.45, 4.15, 4.75 ], | ||||||||||||||||||||||||||||||||||||||||||
| 306 | C => [ 8.28, 8.00, 9.00 ], | ||||||||||||||||||||||||||||||||||||||||||
| 307 | Y => [ 9.84, 9.34, 10.34 ], | ||||||||||||||||||||||||||||||||||||||||||
| 308 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 3 | ▶ | sub _pKt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pKt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | return { # N C | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 3 | G => [ 7.50, 3.70 ], | |||||||||||||||||||||||||||||||||||||||||
| 316 | A => [ 7.58, 3.75 ], | ||||||||||||||||||||||||||||||||||||||||||
| 317 | S => [ 6.86, 3.61 ], | ||||||||||||||||||||||||||||||||||||||||||
| 318 | P => [ 8.36, 3.40 ], | ||||||||||||||||||||||||||||||||||||||||||
| 319 | V => [ 7.44, 3.69 ], | ||||||||||||||||||||||||||||||||||||||||||
| 320 | T => [ 7.02, 3.57 ], | ||||||||||||||||||||||||||||||||||||||||||
| 321 | C => [ 8.12, 3.10 ], | ||||||||||||||||||||||||||||||||||||||||||
| 322 | I => [ 7.48, 3.72 ], | ||||||||||||||||||||||||||||||||||||||||||
| 323 | L => [ 7.46, 3.73 ], | ||||||||||||||||||||||||||||||||||||||||||
| 324 | N => [ 7.22, 3.64 ], | ||||||||||||||||||||||||||||||||||||||||||
| 325 | D => [ 7.70, 3.50 ], | ||||||||||||||||||||||||||||||||||||||||||
| 326 | Q => [ 6.73, 3.57 ], | ||||||||||||||||||||||||||||||||||||||||||
| 327 | K => [ 6.67, 3.40 ], | ||||||||||||||||||||||||||||||||||||||||||
| 328 | E => [ 7.19, 3.50 ], | ||||||||||||||||||||||||||||||||||||||||||
| 329 | M => [ 6.98, 3.68 ], | ||||||||||||||||||||||||||||||||||||||||||
| 330 | H => [ 7.18, 3.17 ], | ||||||||||||||||||||||||||||||||||||||||||
| 331 | F => [ 6.96, 3.98 ], | ||||||||||||||||||||||||||||||||||||||||||
| 332 | R => [ 6.76, 3.41 ], | ||||||||||||||||||||||||||||||||||||||||||
| 333 | Y => [ 6.83, 3.60 ], | ||||||||||||||||||||||||||||||||||||||||||
| 334 | W => [ 7.11, 3.78 ], | ||||||||||||||||||||||||||||||||||||||||||
| 335 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | __END__ | ||||||||||||||||||||||||||||||||||||||||||