module Mspire::Ident::Peptide
A ‘sequence’ is a notation of a peptide that includes the leading and trailing amino acid after cleavage (e.g., K.PEPTIDER.E or -.STARTK.L ) and may contain post-translational modification information.
‘aaseq’ is the amino acid sequence of just the peptide with no leading or trailing notation (e.g., PEPTIDER or LAKKLY)
Constants
- Nonstandard_AA_re
Public Class Methods
prepare_sequence(sequence)
click to toggle source
remove non amino acids and split the sequence
# File lib/mspire/ident/peptide.rb, line 42 def prepare_sequence(sequence) nv = remove_non_amino_acids(sequence) split_sequence(nv) end
remove_non_amino_acids(sequence)
click to toggle source
removes non standard amino acids specified by Nonstandard_AA_re
# File lib/mspire/ident/peptide.rb, line 37 def remove_non_amino_acids(sequence) sequence.gsub(Nonstandard_AA_re, '') end
sequence_to_aaseq(sequence)
click to toggle source
Takes a peptide sequence of the form ‘-.PEPTIDE.R’, removes non-standard amino acids, and returns the center piece
# File lib/mspire/ident/peptide.rb, line 17 def sequence_to_aaseq(sequence) after_removed = remove_non_amino_acids(sequence) pieces = after_removed.split('.') case pieces.size when 3 pieces[1] when 2 if pieces[0].size > 1 ## N termini pieces[0] else ## C termini pieces[1] end when 1 ## this must be a parse error! pieces[0] ## which is the peptide itself else abort "bad peptide sequence: #{sequence.inspect}" end end
split_sequence(sequence)
click to toggle source
Returns prev, peptide, next from sequence. Parse errors return nil,nil,nil
R.PEPTIDE.A # -> R, PEPTIDE, A R.PEPTIDE.- # -> R, PEPTIDE, - PEPTIDE.A # -> -, PEPTIDE, A A.PEPTIDE # -> A, PEPTIDE, - PEPTIDE # -> nil,nil,nil
# File lib/mspire/ident/peptide.rb, line 54 def split_sequence(sequence) pieces = sequence.split('.') case pieces.size when 3 pieces when 2 if pieces[0].size > 1 ## N termini ['-', pieces[0], pieces[1]] else ## C termini [pieces[0], pieces[1], '-'] end when 1 ## this must be a parse error! [nil,nil,nil] when 0 [nil,nil,nil] end end