question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove `pdb` from init_from_file options for BuildingBlock

See original GitHub issue

The minimum working example at the bottom shows clearly that if you write and then init_from_file, you will lose bond order information. This is because PDB files do not contain bond order information in their “CONECT” records.

Therefore, I suggest removing it as an init function (the with_structure_from_file method is completely fine because it just loads the coordinates). Perhaps a warning is added for 6 months before removing?

What do you think, @lukasturcani?


import stk
from collections import Counter

pdb_writer = stk.PdbWriter()

bb = stk.BuildingBlock(
    'CN(c1ccc(cc1)N=Cc2cccnc2)c3nc(nc(n3)N(C)c4ccc(cc4)N=Cc5ccccn5)'
    'N(C)c6ccc(cc6)N=Cc7ccccn7'
)

# Get bond order information.
orders = []
for bond in bb.get_bonds():
    orders.append(bond.get_order())

# Write to PDB.
bb.write(f'first.pdb')

# Read from PDB.
bb2 = stk.BuildingBlock.init_from_file('first.pdb')

# Get bond order information.
orders2 = []
for bond in bb2.get_bonds():
    orders2.append(bond.get_order())

print(Counter(orders), Counter(orders2)) ## >> Counter({1.0: 72, 2.0: 24}) Counter({1.0: 96})

# Write to PDB.
bb.write(f'second.pdb')

# Compare text of PDBs.
s1 = pdb_writer.to_string(bb)
s2 = pdb_writer.to_string(bb2)

print(s1 == s2)


Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lukasturcanicommented, May 22, 2022

fair, we write XYZ files which do not preserve bond orders. so thats not too crazy

0reactions
andrewtarziacommented, May 23, 2022

Can this be closed now? #449

Read more comments on GitHub >

github_iconTop Results From Across the Web

DROP PLUGGABLE DATABASE
Use the DROP PLUGGABLE DATABASE statement to drop a pluggable database (PDB). When you drop a PDB, the control file of the multitenant...
Read more >
Database Migration from non-CDB to PDB - The Component ...
Create a new CDB with the required options and unplug/plug the now-PDB · Install the missing options into the CDB$ROOT · Remove the...
Read more >
Multitenant : Flashback Pluggable Database (PDB) in Oracle ...
A guaranteed restored point prevents the database from removing ... There are several options for creating restore points at the PDB level.
Read more >
Oracle 21c Drop Pluggable Database | Oracledbwr
We have two options while dropping pluggable database related to its datafiles. Dropping PDB including datafiles; Dropping PDB keeping datafiles.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found