lib/PDB.rb
# Extract sequence of residues from array of atoms.
# Order of the sequence is set by the order of the atoms in the array.
#
# ==== Attributes
#
# * +atoms+ - Array of Atoms
#
Extract sequence of residues from array of atoms.
Order of the sequence is set by the order of the atoms in the array.

Attributes

+atoms+ - Array of Atoms
Extract sequence of residues from array of atoms . Order of the sequence is set by the order of the atoms in the array . Attributes + atoms + - Array of Atoms
def extract_sequence(atoms)
    sequence={}
    first = atoms[0].resid
    sequence[atoms[0].chain] =[]
    sequence[atoms[0].chain] << atoms[0].residue
    atoms.each do |atom|
      if (sequence.key?(atom.chain))
        if first != atom.resid
          sequence[atom.chain] << atom.residue
          first = atom.resid
        end
      else
        sequence[atom.chain] =[]
        first = atom.resid
        sequence[atom.chain] << atom.residue
      end
    end
  end
def extract_sequence ( atoms ) sequence = { } first = atoms [ 0 ] . resid sequence [ atoms [ 0 ] . chain ] = [ ] sequence [ atoms [ 0 ] . chain ] << atoms [ 0 ] . residue atoms . each do | atom | if ( sequence . key? ( atom . chain ) ) if first != atom . resid sequence [ atom . chain ] << atom . residue first = atom . resid end else sequence [ atom . chain ] = [ ] first = atom . resid sequence [ atom . chain ] << atom . residue end end end
Extract sequence of residues from array of atoms.
Extract sequence of residues from array of atoms .
#if first != atom.resid #  @sequence << atom.resid #  first = atom.resid #end
atoms
<not_specific>