I am trying to do something reasonably simple but I'm a bit confused by the documentation for the io.CrystalWriter module. I'm trying to feed in a list of refcodes for which to output the corresponding crystal structures as pdb files into a new folder. 


Would you be able to help?
Thanks a lot 


Hi Puck,

it sounds as if you are trying to write the refcodes directly to the CrystalWriter instance, but this needs a crystal structure.  If you have the refcodes in a list you can create the crystals from the CSD as follows:

csd = io.EntryReader('csd')
for refcode in list_of_refcodes:
    with io.CrystalWriter('/path/to/pdb/directort/%s,pdb' % refcode) as writer:

Alternatively, if you have the refcodes in a file, they can be read through a CrystalReader instance:

with io.CrystalReader('/path/to/refcode/file', format='identifiers') as reader:
    for crystal in reader:
        with io.CrystalWriter('/path/to/pdb/directory/%s.pdb' % crystal.identifier) as writer:

Hope this is helpful.  Please let me know if I've misunderstood your problem.

Best wishes

That worked perfectly! Thanks a lot.

Hi Puck,

always happy to help.  Let me know if there are any other problems.

Best wishes

Nice forum ! I will share it to all of my friends.


เว็ปแทงบอล : po

You must be signed in to post in this forum.