text: user6483: I need to find peptides/proteins with a certain sequence of amino acids in a certain type of secondary structure. For example, "ALA PHE GLY" in alpha-helix. Is there any tool that does that?
  
  user6322: Your request is rather specific, so there is no tool...
  It is a straightforwards request though. I'd impose the requirement that the structures be solved and no predicted secondary structure. You can do it two ways if using Python. 
  PDB
  After downloading all PDB structures, in python with PyMOL (installable with conda, tricky without) you'd do something like
  import pymol2, os
  from multiprocessing import Pool
  
  def find_motif(file):
      motif = 'AFG'
      try:
          with pymol2.PyMOL() as pymol
              pymol.cmd.load(file)
              seq = pymol.cmd.get_fastastr()
              if motif not in seq:
                  return None
              d = {x: []}
              # str.find will cause issues if there is a gap also structure may not start at one.
              pymol.cmd.iterate('resn ALA+PHE+GLY', 'x.append((resi, resn, ss))', space=d)
              sequence = -1
              i = 0
              for residue in d['x']:
                  if residue['resn'] = 'ALA':
                      sequence = 0 # lazy enum
                      i = int(residue['resi'])
                  elif sequence != -1 :
                      if int(residue['resi']) == i+1 and residue['resn'] = 'PHE':
                          sequence = 1
                      elif int(residue['resi']) == i+2 and residue['resn'] = 'GLY':
                          return (file, i)
                      else:
                          sequence = -1
      finally:
          return (file, None)
  
  if __name__ == '__main__':
      p = Pool(12)
      structure_files = [f for f in os.listdir('pdb') if os.path.splitext(f)[1] == '.pdb']
      verdicts = p.map(finder, structure_files)
      print([(f,v) for f,v in verdicts if v is not None])
  
  The end result will be a list of PDB with where in the sequence (in that PDB code).
  (I wrote this in the reply box, so there may be a typo or two).
  PyMOL has a selection algebra called pepseq, which matches missing atoms, but I was a whimp and played it safe by being more verbose. Also, a for loop can be used instead of an iterate. But I think it is slower.
  atoms = pymol.cmd.get_model(f"pepseq {target} and name CA")
  for atom in atoms.atom:
        if atom.ss == ' ...
  
  Uniprot
  In Uniprot, if a protein is crystallised, there will be the feature entries corresponding to the secondary structure. It is sheet or helix. No turns, pi-helices or 3_10 helices. There is no Biopython method for parsing Uniprot XML. I wrote myself a parser and it is not too horrid thing to do —although I monkeypatched elementtree. Alternatively, xmlschema.XMLSchema.to_dict can be used to convert the XML to a dictionary. The advantage of Uniprot is that the residues ids will not require correcting. The disadvantage is parsing XML.
  My parser is specific for my application and it is poorly documented (so would not recommend it) but but... I can share it and human data. I'd be used like:
   import os
   from michelanglo_protein import ProteinCore
   ProteinCore.settings.startup(data_folder='protein-data')
   p = ProteinCore().gload(file=os.path.join('gpickle','Q86V25.gpz'))
   #print(p.asdict())
   if 'helix' in p.features:
          n = p.sequence.find( ...
          for ... p.features['helix'] #('helix', 'turn', 'strand')
          if x < n < y ...
  
  
original_text: 6483: <p>I need to find peptides/proteins with a certain sequence of amino acids in a certain type of secondary structure. For example, "ALA PHE GLY" in alpha-helix. Is there any tool that does that?</p>
   6322: <p>Your request is rather specific, so there is no tool...</p>
  
  <p>It is a straightforwards request though. I'd impose the requirement that the structures be solved and no predicted secondary structure. You can do it two ways if using Python. </p>
  
  <h2>PDB</h2>
  
  <p>After downloading all <a href="ftp://ftp.wwpdb.org/pub/pdb/data/structures/all/pdb/" rel="nofollow noreferrer">PDB structures</a>, in python with PyMOL (installable with conda, tricky without) you'd do something like</p>
  
  <pre><code>import pymol2, os
  from multiprocessing import Pool
  
  def find_motif(file):
      motif = 'AFG'
      try:
          with pymol2.PyMOL() as pymol
              pymol.cmd.load(file)
              seq = pymol.cmd.get_fastastr()
              if motif not in seq:
                  return None
              d = {x: []}
              # str.find will cause issues if there is a gap also structure may not start at one.
              pymol.cmd.iterate('resn ALA+PHE+GLY', 'x.append((resi, resn, ss))', space=d)
              sequence = -1
              i = 0
              for residue in d['x']:
                  if residue['resn'] = 'ALA':
                      sequence = 0 # lazy enum
                      i = int(residue['resi'])
                  elif sequence != -1 :
                      if int(residue['resi']) == i+1 and residue['resn'] = 'PHE':
                          sequence = 1
                      elif int(residue['resi']) == i+2 and residue['resn'] = 'GLY':
                          return (file, i)
                      else:
                          sequence = -1
      finally:
          return (file, None)
  
  if __name__ == '__main__':
      p = Pool(12)
      structure_files = [f for f in os.listdir('pdb') if os.path.splitext(f)[1] == '.pdb']
      verdicts = p.map(finder, structure_files)
      print([(f,v) for f,v in verdicts if v is not None])
  </code></pre>
  
  <p>The end result will be a list of PDB with where in the sequence (in that PDB code).
  (I wrote this in the reply box, so there may be a typo or two).
  PyMOL has a selection algebra called <code>pepseq</code>, which matches missing atoms, but I was a whimp and played it safe by being more verbose. Also, a for loop can be used instead of an iterate. But I think it is slower.</p>
  
  <pre><code>atoms = pymol.cmd.get_model(f"pepseq {target} and name CA")
  for atom in atoms.atom:
        if atom.ss == ' ...
  </code></pre>
  
  <h2>Uniprot</h2>
  
  <p>In Uniprot, if a protein is crystallised, there will be the feature entries corresponding to the secondary structure. It is sheet or helix. No turns, pi-helices or 3_10 helices. There is no Biopython method for parsing Uniprot XML. I wrote myself a parser and it is not too horrid thing to do —although I <a href="https://blog.matteoferla.com/2019/02/uniprot-xml-and-python-elementtree.html" rel="nofollow noreferrer">monkeypatched elementtree</a>. Alternatively, <code>xmlschema.XMLSchema.to_dict</code> can be used to convert the XML to a dictionary. The advantage of Uniprot is that the residues ids will not require correcting. The disadvantage is parsing XML.</p>
  
  <p>My parser is specific for my application and it is poorly documented (so would not recommend it) but but... I can share <a href="https://github.com/matteoferla/MichelaNGLo-protein-module" rel="nofollow noreferrer">it</a> and <a href="https://github.com/matteoferla/MichelaNGLo-human-protein-data" rel="nofollow noreferrer">human data</a>. I'd be used like:</p>
  
  <pre><code> import os
   from michelanglo_protein import ProteinCore
   ProteinCore.settings.startup(data_folder='protein-data')
   p = ProteinCore().gload(file=os.path.join('gpickle','Q86V25.gpz'))
   #print(p.asdict())
   if 'helix' in p.features:
          n = p.sequence.find( ...
          for ... p.features['helix'] #('helix', 'turn', 'strand')
          if x &lt; n &lt; y ...
  </code></pre>
  