Body: <p>I have a list of PDB IDs with realtive chains IDs that have to be extracted, and then run on <code>dssp</code>.
  For the single chain extraction I tried several methods, such as:</p>
  <pre><code>import pymol2
  for entry in list:
      with pymol2.PyMOL() as pymol:
          pymol.cmd.fetch(entry)
          pymol.cmd.save(entry + '.cif')
  </code></pre>
  <p>Where, for example, if I want to extract chain <code>AC</code> for <code>4YBB</code>, entry = <code>4YBBAC</code>.
  This works well in saving the cif files (pymol correctly visualizes them), but makes them not suitable for mkdssp. Indeed, if i run</p>
  <pre><code>mkdssp 4YBBAC
  </code></pre>
  <p>I get</p>
  <pre><code>DSSP could not be created due to an error:
  Is this an mmCIF file?
  </code></pre>
  <p>I tried also using Biopython:</p>
  <pre><code>from Bio.PDB import MMCIFParser
  from Bio.PDB.mmcifio import MMCIFIO
  parser = MMCIFParser()
  io = MMCIFIO()
  structure = parser.get_structure(&quot;4YBB&quot;, &quot;4YBB.cif&quot;)
  model = structure[0]
  chain = model['AC']
  io.set_structure(chain)
  io.save(&quot;4YBBAC.cif&quot;)
  </code></pre>
  <p>But again, when running mkdssp, I get:</p>
  <pre><code>DSSP could not be created due to an error:
  bad lexical cast: source type value could not be interpreted as target
  </code></pre>
  <p>On a closer inspection, both methods drop the columns <code>_atom_site.pdbx_formal_charge  _atom_site.auth_comp_id _atom_site.auth_atom_id</code> from the file, while retaining all the others.
  This is the first line of the coordinates from the biopython/pymol file:</p>
  <pre><code>ATOM   1    N N   . GLY A ? 1   ? -125.713 46.378 -19.108 1.0 77.15  2   AC 1 
  </code></pre>
  <p>While this is the original file:</p>
  <pre><code>ATOM   34684  N  N     . GLY C   3  1    ? -125.713 46.378   -19.108  1.00 77.15  ?  2    GLY AC N     1
  </code></pre>
  <p>I think that renaming the AC chain to a single-character code would in principle resolve the issue, but it's more of a workaround.</p>
  <p><code>mkdssp</code> does support multicharacter chain ids. I've proved it first it by cutting and pasting the chain into the file and then with an ad-hoc parser. I think the issue is with how biopython and pymol extract the chains.</p>
  <p>Is this a bug? Am I using the tools incorrectly? Can my purpose be achieved with other (possibly hassle free) methods?</p>
  <p><strong>MORE ON THIS TOPIC ON Biopython GitHub :</strong></p>
  <p><a href="https://github.com/biopython/biopython/issues/3439" rel="nofollow noreferrer">https://github.com/biopython/biopython/issues/3439</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-30T22:18:19.107Z
Comments.Text: Could you post the PDBx/mmCIF loop_ before the coordinate lines of the pre and post structures/chains to better show what dropping the column mean
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-31T14:10:37.600Z
Comments.Text: Biopython 1.81 development https://biopython.org/docs/dev/api/Bio.PDB.DSSP.html has a module for DSSP
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-01T18:18:14.167Z
Comments.Text: to me looks like https://github.com/biopython/biopython/blob/master/Bio/PDB/MMCIFParser.py is missing 'pdbx_formal_charge' while  https://github.com/biopython/biopython/blob/master/Bio/PDB/mmcifio.py has it.
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-03T09:57:56.940Z
Comments.Text: If you are you using PyMOL, why not use its [command dss](https://pymolwiki.org/index.php/Dss)?
  PyMOL is annoying for removing most entries bar for ATOM/HETATM data from mmCIF and PDB filenames. So the SS data would not be saved, but it's easy to append to the file (I have done it [here](https://github.com/matteoferla/MichelaNGLo-transpiler/blob/ddedd6cb4dd212d16b129f9cbf3423a7e9a8c39e/michelanglo_transpiler/transpiler_io_mixin.py#L115) for example as NGL.js requires `SHEET` and `HELIX`)
Comments.UserDisplayName: Matteo Ferla
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-01T15:33:39.130Z
Comments.Text: @saidem why do you think ; "I think that renaming the AC chain to a single-character code would in principle resolve the issue, but it's more of a workaround." , have you tried it ?
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-01T15:43:54.187Z
Comments.Text: not sure if its relevant didi you checked laast verision of parser ?? https://biopython.org/docs/1.80/api/Bio.PDB.MMCIFParser.html it has : auth_chains - True by default. If true, use the author chain IDs. If false, use the re-assigned mmCIF chain IDs. AND auth_residues - True by default. If true, use the author residue numbering. If false, use the mmCIF “label” residue numbering, which has no insertion codes, and strictly increments residue numbers. NOTE: Non-polymers such as water don’t have a “label” residue number, and will be skipped.
Comments.UserDisplayName: pippo1980
Tags: <python><pymol>
Title: Using dssp after chain extraction
ThreadText: # Using dssp after chain extraction
  
  (Asked by: username_0 on 2020-09-25)
  
  I have a list of PDB IDs with realtive chains IDs that have to be extracted, and then run on `dssp`.
  For the single chain extraction I tried several methods, such as:
  
  ```
  import pymol2
  for entry in list:
      with pymol2.PyMOL() as pymol:
          pymol.cmd.fetch(entry)
          pymol.cmd.save(entry + '.cif')
  
  ```
  
  Where, for example, if I want to extract chain `AC` for `4YBB`, entry = `4YBBAC`.
  This works well in saving the cif files (pymol correctly visualizes them), but makes them not suitable for mkdssp. Indeed, if i run
  
  ```
  mkdssp 4YBBAC
  
  ```
  
  I get
  
  ```
  DSSP could not be created due to an error:
  Is this an mmCIF file?
  
  ```
  
  I tried also using Biopython:
  
  ```
  from Bio.PDB import MMCIFParser
  from Bio.PDB.mmcifio import MMCIFIO
  parser = MMCIFParser()
  io = MMCIFIO()
  structure = parser.get_structure("4YBB", "4YBB.cif")
  model = structure[0]
  chain = model['AC']
  io.set_structure(chain)
  io.save("4YBBAC.cif")
  
  ```
  
  But again, when running mkdssp, I get:
  
  ```
  DSSP could not be created due to an error:
  bad lexical cast: source type value could not be interpreted as target
  
  ```
  
  On a closer inspection, both methods drop the columns `_atom_site.pdbx_formal_charge _atom_site.auth_comp_id _atom_site.auth_atom_id` from the file, while retaining all the others.
  This is the first line of the coordinates from the biopython/pymol file:
  
  ```
  ATOM   1    N N   . GLY A ? 1   ? -125.713 46.378 -19.108 1.0 77.15  2   AC 1 
  
  ```
  
  While this is the original file:
  
  ```
  ATOM   34684  N  N     . GLY C   3  1    ? -125.713 46.378   -19.108  1.00 77.15  ?  2    GLY AC N     1
  
  ```
  
  I think that renaming the AC chain to a single-character code would in principle resolve the issue, but it's more of a workaround.
  
  `mkdssp` does support multicharacter chain ids. I've proved it first it by cutting and pasting the chain into the file and then with an ad-hoc parser. I think the issue is with how biopython and pymol extract the chains.
  
  Is this a bug? Am I using the tools incorrectly? Can my purpose be achieved with other (possibly hassle free) methods?
  
  **MORE ON THIS TOPIC ON Biopython GitHub :**
  
  <https://github.com/biopython/biopython/issues/3439>
  
  **Tags:** python, pymol
  
  > **Comments:**
  > **username_1**: Could you post the PDBx/mmCIF loop_ before the coordinate lines of the pre and post structures/chains to better show what dropping the column mean  
  > **username_1**: Biopython 1.81 development https://biopython.org/docs/dev/api/Bio.PDB.DSSP.html has a module for DSSP  
  > **username_1**: to me looks like https://github.com/biopython/biopython/blob/master/Bio/PDB/MMCIFParser.py is missing 'pdbx_formal_charge' while  https://github.com/biopython/biopython/blob/master/Bio/PDB/mmcifio.py has it.  
  > **username_2**: If you are you using PyMOL, why not use its [command dss](https://pymolwiki.org/index.php/Dss)? PyMOL is annoying for removing most entries bar for ATOM/HETATM data from mmCIF and PDB filenames. So the SS data would not be saved, but it's easy to append to the file (I have done it [here](https://github.com/username_2/MichelaNGLo-transpiler/blob/ddedd6cb4dd212d16b129f9cbf3423a7e9a8c39e/michelanglo_transpiler/transpiler_io_mixin.py#L115) for example as NGL.js requires `SHEET` and `HELIX`)  
  > **username_1**: @saidem why do you think ; "I think that renaming the AC chain to a single-character code would in principle resolve the issue, but it's more of a workaround." , have you tried it ?  
  > **username_1**: not sure if its relevant didi you checked laast verision of parser ?? https://biopython.org/docs/1.80/api/Bio.PDB.MMCIFParser.html it has : auth_chains - True by default. If true, use the author chain IDs. If false, use the re-assigned mmCIF chain IDs. AND auth_residues - True by default. If true, use the author residue numbering. If false, use the mmCIF “label” residue numbering, which has no insertion codes, and strictly increments residue numbers. NOTE: Non-polymers such as water don’t have a “label” residue number, and will be skipped.  
  
  ---
  
  ## 0 answers
  
  