Module: Bio::Protparam::Local
- Defined in:
- lib/bio/util/protparam.rb
Instance Method Summary collapse
-
#aa_comp(aa_code = nil) ⇒ Object
Calculate the percentage composition of an AA sequence as a Hash object.
-
#aliphatic_index ⇒ Object
Calculate aliphatic index of an AA sequence.
-
#amino_acid_number ⇒ Object
Return the number of residues in an AA sequence.
-
#gravy ⇒ Object
Calculate GRAVY score of an AA sequence.
-
#half_life(species = nil) ⇒ Object
Return estimated half_life of an AA sequence.
-
#instability_index ⇒ Object
Calculate instability index of an AA sequence.
-
#molecular_weight ⇒ Object
Calculate molecular weight of an AA sequence.
-
#num_carbon ⇒ Object
Return the number of carbons.
- #num_hydrogen ⇒ Object
-
#num_neg ⇒ Object
Return the number of negative amino acids (D and E) in an AA sequence.
-
#num_nitro ⇒ Object
Return the number of nitrogens.
-
#num_oxygen ⇒ Object
Return the number of oxygens.
-
#num_pos ⇒ Object
Return the number of positive amino acids (R and K) in an AA sequence.
-
#num_sulphur ⇒ Object
Return the number of sulphurs.
-
#stability ⇒ Object
Return wheter the sequence is stable or not as String (stable/unstable).
-
#stable? ⇒ Boolean
Return true if the sequence is stable.
-
#theoretical_pI ⇒ Object
Claculate theoretical pI for an AA sequence with bisect algorithm.
-
#total_atoms(type = nil) ⇒ Object
Return the number of atoms in a sequence.
Instance Method Details
#aa_comp(aa_code = nil) ⇒ Object
Calculate the percentage composition of an AA sequence as a Hash object. It return percentage of a given amino acid if aa_code is not nil.
744 745 746 747 748 749 750 751 752 753 754 |
# File 'lib/bio/util/protparam.rb', line 744 def aa_comp(aa_code=nil) if aa_code.nil? aa_map = {} IUPAC_CODE.keys.each do |k| aa_map[k] = 0.0 end aa_map.update(aa_comp_map){|k,_,v| round(v, 1) } else round(aa_comp_map[aa_code], 1) end end |
#aliphatic_index ⇒ Object
Calculate aliphatic index of an AA sequence.
_The aliphatic index of a protein is defined as the relative volume occupied by aliphatic side chains (alanine, valine, isoleucine, and leucine). It may be regarded as a positive factor for the increase of thermostability of globular proteins._
714 715 716 717 718 719 |
# File 'lib/bio/util/protparam.rb', line 714 def aliphatic_index aa_map = aa_comp_map @aliphatic_index ||= round(aa_map[:A] + 2.9 * aa_map[:V] + (3.9 * (aa_map[:I] + aa_map[:L])), 2) end |
#amino_acid_number ⇒ Object
Return the number of residues in an AA sequence.
530 531 532 |
# File 'lib/bio/util/protparam.rb', line 530 def amino_acid_number @seq.length end |
#gravy ⇒ Object
Calculate GRAVY score of an AA sequence.
_The GRAVY(Grand Average of Hydropathy) value for a peptide or protein is calculated as the sum of hydropathy values [9] of all the amino acids, divided by the number of residues in the sequence._
729 730 731 732 733 734 735 736 737 |
# File 'lib/bio/util/protparam.rb', line 729 def gravy @gravy ||= begin hydropathy_sum = 0.0 each_aa do |aa| hydropathy_sum += HYDROPATHY[aa] end round(hydropathy_sum / @seq.length.to_f, 3) end end |
#half_life(species = nil) ⇒ Object
Return estimated half_life of an AA sequence.
_The half-life is a prediction of the time it takes for half of the amount of protein in a cell to disappear after its synthesis in the cell. ProtParam relies on the “N-end rule”, which relates the half-life of a protein to the identity of its N-terminal residue; the prediction is given for 3 model organisms (human, yeast and E.coli)._
644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/bio/util/protparam.rb', line 644 def half_life(species=nil) n_end = @seq[0].chr.to_sym if species HALFLIFE[species][n_end] else { :ecoli => HALFLIFE[:ecoli][n_end], :mammalian => HALFLIFE[:mammalian][n_end], :yeast => HALFLIFE[:yeast][n_end] } end end |
#instability_index ⇒ Object
Calculate instability index of an AA sequence.
_The instability index provides an estimate of the stability of your protein in a test tube. Statistical analysis of 12 unstable and 32 stable proteins has revealed [7] that there are certain dipeptides, the occurence of which is significantly different in the unstable proteins compared with those in the stable ones. The authors of this method have assigned a weight value of instability to each of the 400 different dipeptides (DIWV)._
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
# File 'lib/bio/util/protparam.rb', line 669 def instability_index @instability_index ||= begin instability_sum = 0.0 i = 0 while @seq[i+1] != nil aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym] if DIWV.key?(aa) && DIWV[aa].key?(next_aa) instability_sum += DIWV[aa][next_aa] end i += 1 end round((10.0/amino_acid_number.to_f) * instability_sum, 2) end end |
#molecular_weight ⇒ Object
Calculate molecular weight of an AA sequence.
_Protein Mw is calculated by the addition of average isotopic masses of amino acids in the protein and the average isotopic mass of one water molecule._
609 610 611 612 613 614 615 616 617 |
# File 'lib/bio/util/protparam.rb', line 609 def molecular_weight @mw ||= begin mass = WATER_MASS each_aa do |aa| mass += AVERAGE_MASS[aa.to_sym] end (mass * 10).floor().to_f / 10 end end |
#num_carbon ⇒ Object
Return the number of carbons.
569 570 571 |
# File 'lib/bio/util/protparam.rb', line 569 def num_carbon @num_carbon ||= total_atoms :C end |
#num_hydrogen ⇒ Object
573 574 575 |
# File 'lib/bio/util/protparam.rb', line 573 def num_hydrogen @num_hydrogen ||= total_atoms :H end |
#num_neg ⇒ Object
Return the number of negative amino acids (D and E) in an AA sequence.
514 515 516 |
# File 'lib/bio/util/protparam.rb', line 514 def num_neg @num_neg ||= @seq.count("DE") end |
#num_nitro ⇒ Object
Return the number of nitrogens.
581 582 583 |
# File 'lib/bio/util/protparam.rb', line 581 def num_nitro @num_nitro ||= total_atoms :N end |
#num_oxygen ⇒ Object
Return the number of oxygens.
589 590 591 |
# File 'lib/bio/util/protparam.rb', line 589 def num_oxygen @num_oxygen ||= total_atoms :O end |
#num_pos ⇒ Object
Return the number of positive amino acids (R and K) in an AA sequence.
522 523 524 |
# File 'lib/bio/util/protparam.rb', line 522 def num_pos @num_neg ||= @seq.count("RK") end |
#num_sulphur ⇒ Object
Return the number of sulphurs.
597 598 599 |
# File 'lib/bio/util/protparam.rb', line 597 def num_sulphur @num_sulphur ||= total_atoms :S end |
#stability ⇒ Object
Return wheter the sequence is stable or not as String (stable/unstable).
_Protein whose instability index is smaller than 40 is predicted as stable, a value above 40 predicts that the protein may be unstable._
693 694 695 |
# File 'lib/bio/util/protparam.rb', line 693 def stability (instability_index <= 40) ? "stable" : "unstable" end |
#stable? ⇒ Boolean
Return true if the sequence is stable.
701 702 703 |
# File 'lib/bio/util/protparam.rb', line 701 def stable? (instability_index <= 40) ? true : false end |
#theoretical_pI ⇒ Object
Claculate theoretical pI for an AA sequence with bisect algorithm. pK value by Bjelqist, et al. is used to calculate pI.
624 625 626 627 628 629 630 631 632 |
# File 'lib/bio/util/protparam.rb', line 624 def theoretical_pI charges = [] residue_count().each do |residue| charges << charge_proc(residue[:positive], residue[:pK], residue[:num]) end round(solve_pI(charges), 2) end |
#total_atoms(type = nil) ⇒ Object
Return the number of atoms in a sequence. If type is given, return the number of specific atoms in a sequence.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/bio/util/protparam.rb', line 539 def total_atoms(type=nil) if !type.nil? type = type.to_sym if /^(?:C|H|O|N|S){1}$/ !~ type.to_s raise ArgumentError, "type must be C/H/O/N/S/nil(all)" end end num_atom = {:C => 0, :H => 0, :O => 0, :N => 0, :S => 0} each_aa do |aa| ATOM[aa].each do |t, num| num_atom[t] += num end end num_atom[:H] = num_atom[:H] - 2 * (amino_acid_number - 1) num_atom[:O] = num_atom[:O] - (amino_acid_number - 1) if type.nil? num_atom.values.inject(0){|prod, num| prod += num } else num_atom[type] end end |