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

Framework example for non-star shaped analysis #55

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

hannahbrucemacdonald
Copy link
Contributor

I don't propose that this gets merged until it's in solid python, rather than in a notebook, but adding it here for version control/feedback.

This required changes to Arsenic, that I will open a PR for now

I don't propose that this gets merged until it's in solid python, rather than in a notebook, but adding it here for version control/feedback
@hannahbrucemacdonald
Copy link
Contributor Author

OpenFreeEnergy/cinnabar#17

To use this code, you will have to checkout the appropriate Arsenic branch until it is merged into master

@hannahbrucemacdonald
Copy link
Contributor Author

Addressing #52

@hannahbrucemacdonald
Copy link
Contributor Author

I'm not sure how best to return stuff from these functions, wether it should be the graph object itself (for plotting) or just a dictionary of {titles: (free_energy, estimate)}

@hannahbrucemacdonald
Copy link
Contributor Author

hannahbrucemacdonald commented Sep 3, 2020

TODO

@hannahbrucemacdonald hannahbrucemacdonald changed the title [DONT MERGE] Framework example for non-star shaped analysis Framework example for non-star shaped analysis Sep 4, 2020
@glass-w
Copy link
Contributor

glass-w commented Sep 4, 2020

I'm having trouble running the interactive networkx graph at:

for node in net.nodes:
    if node['title'] in has_expt:

Looks like node.keys() are: ['f_i', 'df_i', 'size', 'id', 'label', 'shape', 'font']

@hannahbrucemacdonald
Copy link
Contributor Author

Hmmm I have dict_keys(['title', 'id', 'label', 'shape', 'font'])

What version of pyvis do you have?

@glass-w
Copy link
Contributor

glass-w commented Sep 4, 2020

Using node['id'] seems to work instead, this is with networkx 2.4

node[1]['df_i'] = dg_err

# not sure how to best return from this script
return graphs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll want to return both the graph (for plotting purposes) and updated key entries to a .json for easy manipulation later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or a ".json like" object e.g a list or dict)

Copy link
Contributor

@mcwitt mcwitt Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that it would be useful to return both the graph and some json-compatible structure for inclusion in the analysis.json!

For the latter, I've been following the convention of describing the structure as a dataclass, e.g. like https://github.com/choderalab/covid-moonshot-infra/blob/266612d6ceef234ad6b77840f7e23cb65700dc64/covid_moonshot/core.py#L34-L40

This is nice as a form of documentation and also allows using something like mypy to check that we're not accessing fields incorrectly in downstream code.

For this case, would something like the following work?

@dataclass_json
@dataclass
class MoleculeAnalysis:
    molecule_id: str
    absolute_free_energy: FreeEnergy

def combine_relative_free_energies(results: Analysis) -> List[MoleculeAnalysis]:
    # ...

Returns
-------
type
Description of returned object.
Copy link
Contributor

@glass-w glass-w Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a float (?), need to update the docstring here

@mcwitt
Copy link
Contributor

mcwitt commented Sep 4, 2020

Nice, this works for me up until the last step, where I'm also having the issue @WG150 mentioned:

I'm having trouble running the interactive networkx graph at:

for node in net.nodes:
    if node['title'] in has_expt:

Looks like node.keys() are: ['f_i', 'df_i', 'size', 'id', 'label', 'shape', 'font']

I'm also seeing this with pyvis==0.1.8.2. When I replace title -> id the code runs, but the viz just shows a bunch of disconnected nodes. With title -> label, it runs and produces something that looks right, but without mouseover labels (@hannahbrucemacdonald, I thought I remembered your demo having these?)

return new_g


def combine_relative_free_energies(results):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll eventually want to transition this to taking a List[Run] or Analysis object rather than a dictionary (but this can be done later)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think we will want to merge #65 before doing this anyway)

@mcwitt mcwitt marked this pull request as draft September 9, 2020 21:46
@mcwitt mcwitt changed the base branch from master to enh/update-series-schema September 9, 2020 21:46
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2020

Codecov Report

Merging #55 into master will increase coverage by 0.15%.
The diff coverage is 44.16%.

@mcwitt mcwitt force-pushed the enh/update-series-schema branch 2 times, most recently from af58b8a to 8072617 Compare September 11, 2020 16:48
Base automatically changed from enh/update-series-schema to master September 11, 2020 22:51
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

Successfully merging this pull request may close these issues.

4 participants