haddocking / pdb-tools

A dependency-free cross-platform swiss army knife for PDB files.
https://haddocking.github.io/pdb-tools/
Apache License 2.0
372 stars 113 forks source link

Adjust fhandle names to files and iterables. #109

Closed joaomcteixeira closed 2 years ago

joaomcteixeira commented 2 years ago

In #107 the run function was documented to be used either providing a file handler or an iterator scrolling over the PDB lines. However in pdb_split* and pdb_tocif the run function defines the output files basenames given the .name attribute of the file handler. iterables won't have this attribute. This PR corrects that by providing a default name, output, when the attribute .name is not present in fhandler. Also, if run is used directly, the user can define outname specifically, instead of relying on the default values.

You will see a new function get_fname in the __init__.py. This function is imported where it is needed. I don't think this adds any overhead to the execution, and keeps things clean.

I am keeping this PR as draft while I write the tests, so that you can comment on it already. But we should merge asap.

joaomcteixeira commented 2 years ago

The pull request is now complete.