Class: Mspire::Ident::Pepxml::SampleEnzyme
- Inherits:
-
Object
- Object
- Mspire::Ident::Pepxml::SampleEnzyme
- Includes:
- Merge
- Defined in:
- lib/mspire/ident/pepxml/sample_enzyme.rb
Instance Attribute Summary (collapse)
-
- (Object) cut
amino acids after which to cleave.
-
- (Object) name
an identifier.
-
- (Object) no_cut
cleave at 'cut' amino acids UNLESS it is followed by 'no_cut'.
-
- (Object) sense
'C' or 'N'.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) from_pepxml_node(node)
returns self.
-
- (SampleEnzyme) initialize(arg = {})
constructor
Can pass in a name of an enzyme that is recognized (meaning there is a set_ method), or .
-
- (Object) num_missed_cleavages(aaseq)
takes an amino acid sequence (e.g. PEPTIDE).
-
- (Object) num_tol_term(prev_aa, middle, next_aa)
No arguments should contain non-standard amino acids.
- - (Object) set_trypsin
-
- (Object) to_xml(builder = nil)
if an xml builder object is given, it adds to the object and returns the builder object, otherwise it returns an xml fragment string.
Methods included from Merge
Constructor Details
- (SampleEnzyme) initialize(arg = {})
Can pass in a name of an enzyme that is recognized (meaning there is a set_<name> method), or
trypsin
For other enzymes, you must set :cut, :no_cut, :name, and :sense will
23 24 25 26 27 28 29 30 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 23 def initialize(arg={}) if arg.is_a?(String) @name = arg send("set_#{@name}".to_sym) else merge!(arg) end end |
Instance Attribute Details
- (Object) cut
amino acids after which to cleave
13 14 15 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 13 def cut @cut end |
- (Object) name
an identifier
11 12 13 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 11 def name @name end |
- (Object) no_cut
cleave at 'cut' amino acids UNLESS it is followed by 'no_cut'
15 16 17 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 15 def no_cut @no_cut end |
- (Object) sense
'C' or 'N'
17 18 19 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 17 def sense @sense end |
Class Method Details
+ (Object) from_pepxml_node(node)
58 59 60 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 58 def self.from_pepxml_node(node) self.new.from_pepxml_node(node) end |
Instance Method Details
- (Object) from_pepxml_node(node)
returns self
49 50 51 52 53 54 55 56 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 49 def from_pepxml_node(node) self.name = node['name'] ch = node.child self.cut = ch['cut'] self.no_cut= ch['no_cut'] self.sense = ch['sense'] self end |
- (Object) num_missed_cleavages(aaseq)
takes an amino acid sequence (e.g. PEPTIDE). returns the number of missed cleavages
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 64 def num_missed_cleavages(aaseq) seq_to_scan = ' ' + aaseq + ' ' raise NotImplementedError, 'need to implement for N terminal sense' if sense == 'N' @num_missed_cleavages_regex = if @num_missed_cleavages_regex ; @num_missed_cleavages_regex else regex_string = "[#{@cut}]" if @no_cut and @no_cut != '' regex_string << "[^#{@no_cut}]" end /#{regex_string}/ end arr = aaseq.scan(@num_missed_cleavages_regex) num = arr.size if aaseq[-1,1] =~ @num_missed_cleavages_regex num -= 1 end num end |
- (Object) num_tol_term(prev_aa, middle, next_aa)
No arguments should contain non-standard amino acids
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 85 def num_tol_term(prev_aa, middle, next_aa) raise NotImplementedError, 'need to implement for N terminal sense' if sense == 'N' no_cut = @no_cut || '' num_tol = 0 last_of_middle = middle[-1,1] first_of_middle = middle[0,1] if ( @cut.include?(prev_aa) && !no_cut.include?(first_of_middle) ) || prev_aa == '-' num_tol += 1 end if @cut.include?(last_of_middle) && !no_cut.include?(next_aa) || next_aa == '-' num_tol += 1 end num_tol end |
- (Object) set_trypsin
32 33 34 35 36 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 32 def set_trypsin @sense = 'C' @cut = 'KR' @no_cut = 'P' end |
- (Object) to_xml(builder = nil)
if an xml builder object is given, it adds to the object and returns the builder object, otherwise it returns an xml fragment string
40 41 42 43 44 45 46 |
# File 'lib/mspire/ident/pepxml/sample_enzyme.rb', line 40 def to_xml(builder=nil) xmlb = builder || Nokogiri::XML::Builder.new xmlb.sample_enzyme(:name => name) do |xmlb| xmlb.specificity(:cut => cut, :no_cut => no_cut, :sense => sense) end builder || xmlb.doc.root.to_xml end |