[chimerax-users] Saving PDB file as a string
Sophie Liu
sophiel2 at andrew.cmu.edu
Wed Jun 8 06:48:57 PDT 2022
Hi Eric,
I ended up figuring an alternate implementation, and I can now retrieve the
information I want.
Thank you so much for the help/pointers!
Best,
Sophie
On Tue, Jun 7, 2022 at 11:07 PM Sophie Liu <sophiel2 at andrew.cmu.edu> wrote:
> Hi Eric,
>
> The information really is at the end of the file after “TER” like.
>
> Thank you so much for the information. I would really appreciate anymore
> guidance you can give.
>
> I really just need to be able to access the PDB in its entire text format
> or in some form that I can iterate through.
>
> Best,
> Sophie
>
> On Tue, Jun 7, 2022 at 8:32 PM Eric Pettersen <pett at cgl.ucsf.edu> wrote:
>
>> Hi Sophie,
>> The normal PDB reader does not preserve the full text of the PDB file as
>> is. In particular, nothing in the "coordinates" section of the file (ATOM
>> records and beyond) is preserved as text -- it is translated into data
>> structures. Lines above the coordinates section are preserved in the
>> 'metadata' attribute of the structure. For a PDB file, the metadata would
>> be a dictionary keyed on record type (*e.g.* 'JRNL') with a corresponding
>> value of a list of lines of that record type. So if the information you
>> are looking for is in the header lines then you are good to go. If the the
>> information really is "at the end of the file" like you said, then you
>> would need to implement your own reader that preserves that information.
>> Let me know if you really need that and I will provide further guidance.
>>
>> --Eric
>>
>> Eric Pettersen
>> UCSF Computer Graphics Lab
>>
>>
>> On Jun 7, 2022, at 3:20 PM, Sophie Liu via ChimeraX-users <
>> chimerax-users at cgl.ucsf.edu> wrote:
>>
>> Hi,
>>
>> My organization has some extra information at the end of a PDB file that
>> I would like to be printed onto the Log Console of ChimeraX.
>>
>> I am currently writing a bundle to do so by adding a command (however if
>> this is best implemented by overriding the open command for PDB files then
>> I would switch to that).
>>
>> I am wondering how I can have the bundle work like so:
>> 1. the user types a command call it, "showdata"
>> 2. the bundle would read all Models (that are pdb files) that are being
>> displayed
>> 3. for each model it would read the PDB text file, and say go to indices
>> 200-251 of the string and display that in the Log console
>>
>> I hope this makes sense. I am mainly struggling on how to access the
>> original PDB text of the model.
>>
>> Best,
>> Sophie
>>
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220608/495b2611/attachment.html>
More information about the ChimeraX-users
mailing list