-
Notifications
You must be signed in to change notification settings - Fork 4
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
How do hold "parent" references? #1
Comments
Brainstrorming: from view_builder import nodes as ns
builder = Root()
structure = builder.download(url=f"https://www.ebi.ac.uk/pdbe/entry-files/download/{id.lower()}_updated.cif")\
.parse(format="mmcif")\
.structure()
def download(url: str, is_binary: bool = False, children: list[ParseNode | ...]):
return DownloadNode(url=url, is_binary=is_binary, children=children)
def parse(format: Literal["mmcif"], *children: Any):
return DownloadNode(url=url, is_binary=is_binary, children=children)
tree = download(
url="test",
children=[parse(
format="mmcif",
children=[structure(
kind="assembly",
)]
)]
)
(structure
.component(selector="protein")
.representation(type="cartoon", color="white"))
(structure
.component(selector="ligand")
.representation(type="ball-and-stick"))
# .children(lambda n: [
# n.component(selector="protein").representation(type="cartoon", color="white"),
# n.component(selector="ligand").representation(type="cartoon", color="white"),
# ])
# .children(
# ns.component(selector="protein").representation(type="cartoon", color="white"),
# ns.component(selector="ligand").representation(type="cartoon", color="white"),
# )
class None:
allowed_children_kinds = ["download", "..."]
def _validate_child(self, child: BuilderBase):
if child.kind not in self.allowed_children_kinds:
raise ValueError(...)
def many(cb: Callable[[T], list[Builder]]) -> Root:
pass
def many(*children: list[Builder]) -> Root:
pass
structure.component(selector="protein")\
.representation(type="cartoon", color="white")
structure.component(selector="ligand")\
.representation(type="ball-and-stick") |
The outcome of the discussion was: No immediate changes, but revisit in the future, right? |
Yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's say you want to create multiple representations from a structure:
How would this be done without holding
structure
in a variable? Are we fine with this? Shouldcomponent()
becomponents()
and take all requested components are argument? Generics +parent()
/leave()
/exit()
method?The text was updated successfully, but these errors were encountered: