Answers.Body: <p>From <a href="https://bioinformatics.stackexchange.com/questions/22385/how-does-biopython-generate-ids-for-atoms-residues-chains-and-structures">How does BioPython generate IDs for atoms, residues, chains, and structures?</a> accepted answer (<a href="https://bioinformatics.stackexchange.com/a/22395/10049">answer link</a>) :</p>
  <p>When reading PDB file (&quot;<a href="https://www.rcsb.org/structure/1FAT" rel="nofollow noreferrer">1fat.pdb</a>&quot; as an example):</p>
  <pre><code>from Bio.PDB import *
  
  parser = PDBParser()
  structure = parser.get_structure(&quot;PHA-L&quot;, &quot;1fat.pdb&quot;)
  </code></pre>
  <p>The Structure object follows the so-called SMCRA <strong>(Structure/Model/Chain/Residue/Atom)</strong> architecture :</p>
  <ol>
  <li>A structure consists of models</li>
  <li>A model consists of chains</li>
  <li>A chain consists of residues</li>
  <li>A residue consists of atoms</li>
  </ol>
  <p>Biopython will automatically generate ids for models, chians, residues and atoms separately.</p>
  <p>The <strong>model id</strong> is an integer which denotes the rank of the model in the PDB file. The model id starts at 0.</p>
  <p>The <strong>chain id</strong> is specified in the PDB file, and is a single character (typically a letter).</p>
  <p>The <strong>residue id</strong> is a tuple with three elements:</p>
  <ol>
  <li>The hetero-flag: this is 'H_' plus the name of the hetero-residue (e.g. 'H_GLC' in the case of a glucose molecule), or 'W' in the case of a water molecule.</li>
  <li>The sequence identifier in the chain, e.g. 100</li>
  <li>The insertion code, e.g. 'A'. The insertion code is sometimes used
  to preserve a certain desirable residue numbering scheme.</li>
  </ol>
  <p>The <strong>atom id</strong> is simply the atom name (eg. 'CA').</p>
  <p>You can check the id like this:</p>
  <pre><code>import itertools
  # for convenience, we just check the first three id
  for model in itertools.islice(structure.get_models(), 3):
      print(f&quot;Model: {model.id}&quot;)
      for chain in itertools.islice(model.get_chains(), 3):
          print(f&quot;Chain: {chain.id}&quot;)
          for residue in itertools.islice(chain.get_residues(), 3):
              print(f&quot;Residue: {residue.id}&quot;)
              for atom in itertools.islice(residue.get_atoms(), 3):
                print(f&quot;Atom: {atom.id}&quot;)
  </code></pre>
  <p>The output is like this:</p>
  <p><a href="https://i.sstatic.net/sQEjH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sQEjH.png" alt="enter image description here" /></a></p>
  <p>The hetero-flag and insertion code in residue id are all empty in the example.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-06T20:37:49.803Z
Answers.LastActivityDate: 2024-11-06T20:37:49.803Z
Answers.UserDisplayName: pippo1980
Body: <p>What are a 'Structure' and a 'Model' in BioPython?</p>
  <p>Why did they incorporate 'structure' and 'model' instead of 'Protein' as objects?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-14T15:30:14.627Z
Comments.Text: You mean why they chose that name? And are these only for proteins? Can't they describe RNA molecules for instance? Or other chemical species?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-07-29T19:28:20.403Z
Comments.Text: This question is similar to: [How does BioPython generate IDs for atoms, residues, chains, and structures?](https://bioinformatics.stackexchange.com/questions/22385/how-does-biopython-generate-ids-for-atoms-residues-chains-and-structures). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-07-30T01:28:39.663Z
Comments.Text: Thanks @pippo1980 its fair to allow the OP a few days to edit their question, but otherwise the question should be closed.
Comments.UserDisplayName: M__
Tags: <biopython>
Title: What is a 'structure' and a 'model' in BioPython?
ThreadText: # What is a 'structure' and a 'model' in BioPython?
  
  (Asked by: username_0 on 2024-04-14)
  
  What are a 'Structure' and a 'Model' in BioPython?
  
  Why did they incorporate 'structure' and 'model' instead of 'Protein' as objects?
  
  **Tags:** biopython
  
  > **Comments:**
  > **username_1**: You mean why they chose that name? And are these only for proteins? Can't they describe RNA molecules for instance? Or other chemical species?  
  > **username_2**: This question is similar to: [How does BioPython generate IDs for atoms, residues, chains, and structures?](https://bioinformatics.stackexchange.com/questions/22385/how-does-biopython-generate-ids-for-atoms-residues-chains-and-structures). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.  
  > **username_3**: Thanks @username_2 its fair to allow the OP a few days to edit their question, but otherwise the question should be closed.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-11-06. Score: 2
  
  From [How does BioPython generate IDs for atoms, residues, chains, and structures?](https://bioinformatics.stackexchange.com/questions/22385/how-does-biopython-generate-ids-for-atoms-residues-chains-and-structures) accepted answer ([answer link](https://bioinformatics.stackexchange.com/a/22395/10049)) :
  
  When reading PDB file ("[1fat.pdb](https://www.rcsb.org/structure/1FAT)" as an example):
  
  ```
  from Bio.PDB import *
  
  parser = PDBParser()
  structure = parser.get_structure("PHA-L", "1fat.pdb")
  
  ```
  
  The Structure object follows the so-called SMCRA **(Structure/Model/Chain/Residue/Atom)** architecture :
  
  1. A structure consists of models
  2. A model consists of chains
  3. A chain consists of residues
  4. A residue consists of atoms
  
  Biopython will automatically generate ids for models, chians, residues and atoms separately.
  
  The **model id** is an integer which denotes the rank of the model in the PDB file. The model id starts at 0.
  
  The **chain id** is specified in the PDB file, and is a single character (typically a letter).
  
  The **residue id** is a tuple with three elements:
  
  1. The hetero-flag: this is 'H\_' plus the name of the hetero-residue (e.g. 'H\_GLC' in the case of a glucose molecule), or 'W' in the case of a water molecule.
  2. The sequence identifier in the chain, e.g. 100
  3. The insertion code, e.g. 'A'. The insertion code is sometimes used
     to preserve a certain desirable residue numbering scheme.
  
  The **atom id** is simply the atom name (eg. 'CA').
  
  You can check the id like this:
  
  ```
  import itertools
  # for convenience, we just check the first three id
  for model in itertools.islice(structure.get_models(), 3):
      print(f"Model: {model.id}")
      for chain in itertools.islice(model.get_chains(), 3):
          print(f"Chain: {chain.id}")
          for residue in itertools.islice(chain.get_residues(), 3):
              print(f"Residue: {residue.id}")
              for atom in itertools.islice(residue.get_atoms(), 3):
                print(f"Atom: {atom.id}")
  
  ```
  
  The output is like this:
  
  [![enter image description here](https://i.sstatic.net/sQEjH.png)](https://i.sstatic.net/sQEjH.png)
  
  The hetero-flag and insertion code in residue id are all empty in the example.
  
  
  ---
  
  