Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read pdb from list of strings (instead of from file) #70

Closed
dominiquesydow opened this issue Oct 21, 2020 · 3 comments
Closed

Read pdb from list of strings (instead of from file) #70

dominiquesydow opened this issue Oct 21, 2020 · 3 comments

Comments

@dominiquesydow
Copy link
Contributor

Describe the workflow you want to enable

Thank you for providing this great package - I am using it in most of my projects!

When a database is queried for structural data in e.g. the pdb format, the file content is often returned in the form of a string.
I would like to load DataFrames from such a string (or list of strings):
https://github.com/volkamerlab/opencadd/blob/912d4e98e89edf38707249fd4f034cea136e1932/opencadd/io/dataframe.py#L128

Currently, I use the private PandasPdb method _construct_df, which - I know - is bad practice.

Describe your proposed solution

In the mol2 module, we can load DataFrames from a file or from a list of strings.

pmol = PandasMol2()
pmol.read_mol2()
pmol.read_mol2_from_list()

Would it be possible to provide the same behavior in the pdb module?

ppdb = PandasPdb()
ppdb.read_pdb()
ppdb.read_pdb_from_list()  # New feature?

Thank you for your time!

Describe alternatives you've considered, if relevant

None.

Additional context

None.

@dominiquesydow dominiquesydow changed the title Read _pdb_ from list of strings (instead of from file) Read pdb from list of strings (instead of from file) Oct 21, 2020
@rasbt
Copy link
Member

rasbt commented Oct 22, 2020

Oh yeah, I can totally see how this would be useful. When I developed the library, I was purely going by what I needed for my projects, so I didn't think of it, but I can see that it would be useful (and would make the mol2 vs pdb API more consistent. I am not sure when I get to it (the COVID-19 related teaching workload keeps me super busy this semester), but I will keep that on my todo list for the not so distant future (esp. since this should be implemented rather easily)

@dominiquesydow
Copy link
Contributor Author

@rasbt, thank you for a quick reply despite a full teaching calendar!

When I started looking into the other issue I posted (#71), I found myself trying to make this issue work, too (see PR #72).
Let me know - when you have time on your hands - if you find this useful.

@dominiquesydow
Copy link
Contributor Author

@rasbt same here closing this issue (addressed in PR #72). Please re-open if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants