lib/PDB/molecule.rb
# locate a sequence of 3 residues
# residues must be in three letter codes
# returns starting index if found, otherwise -1
locate a sequence of 3 residues
residues must be in three letter codes
returns starting index if found, otherwise -1
locate a sequence of 3 residues residues must be in three letter codes returns starting index if found otherwise - 1
def findTriplet(triplet, startAt)
      first = triplet[0..2]
      middle = triplet[3..5]
      third = triplet[6..8]
      tempArray = @residues.to_a
      totalInArray = @residues.length
      for i in startAt...(totalInArray-2)
        if tempArray[i] == first && tempArray[i+1] == middle && tempArray[i+2] == third
          return i
        end
      end
      return -1 
    end
def findTriplet ( triplet , startAt ) first = triplet [ 0 .. 2 ] middle = triplet [ 3 .. 5 ] third = triplet [ 6 .. 8 ] tempArray = @residues . to_a totalInArray = @residues . length for i in startAt ... ( totalInArray - 2 ) if tempArray [ i ] == first && tempArray [ i + 1 ] == middle && tempArray [ i + 2 ] == third return i end end return - 1 end
locate a sequence of 3 residues
residues must be in three letter codes
returns starting index if found, otherwise -1
locate a sequence of 3 residues residues must be in three letter codes returns starting index if found otherwise - 1
# found it so break and return index # nothing found
triplet
<not_specific>
startAt
<not_specific>