Closed dominiquesydow closed 3 years ago
@jaimergp - this is a minor update in the pocket
module (only in the backend). When you have time, could you please take a look if you approve of these changes?
Looks good! The PR description itself is a piece of art and should be framed in the lab :D
Btw, I didn't know about nglview.adaptor.TextStructure
! I'll revisit if there're other places where we can apply this nice trick.
The only comment I need to make with this approach is memory usage. I don't think it's going to be a problem in 99% of the cases so we'll leave it like that. But just to make sure we remember this if we hit 1% of the cases, I'll add a note to the class that will store the .text
attribute. In massive benchmarks, storing the text will add a liiiittle overhead (nothing compared to other problems). Now that I'm writing this I don't think it's even worth writing it down, so yep, whatever, ignore this :)
Merge!
Thank you :)
Description
So far, in order to work with a structure in the
pocket
module, a local copy of its structure file was needed to satisfy thePocket
class methodvisualize
(nglview
visualization of structure/pocket).This was mainly the case because I could not make it work to show a structure from text in the mol2 format - but I figured it out now. Let's look at our options:
In this PR, the
pocket
module is updated in a way thatPocket
class can be initialized from a file but also from text. This is helpful for theKlifsPocket
subclass, where we fetch data via KLIFS IDs. Before, the file was downloaded and linked to the object via the_filepath
attribute; now, we simply fetch the file text and format (_text
and_extension
attributes).Todos
_filepath
but add_text
and_extension
(to indicate the text format)_data
(structural data as DataFrame) into propertydata
Pocket.from_file
class method intoPocket.from_text
class method: Set all class attributes (new:_text
and_extension
)Pocket.from_file
class method: Get text from file and pass text toPocket.from_text
KlifsPocket
according to changes inPocket
(fetch text from KLIFS - no need for file download any more, yay!!)Questions
None
Status