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

Registry #94

Merged
merged 16 commits into from
Feb 27, 2024
Merged

Registry #94

merged 16 commits into from
Feb 27, 2024

Conversation

SamCox822
Copy link
Contributor

This PR updates the tools to correctly use path registry and fixes minor bugs

self.file_path = None

def _find_file(self, file_name: str) -> None:
self.file_name = file_name
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be self.file_id = file_id,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so - I decided to have it saved as file_name and don't use file_id anywhere in this class or file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

are you just asking me to rename it?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, just renaming it haha. Although, we should keep it consistent through the entire package. I call file name at the literal file name "1XYZ.pdb" for example

Copy link
Contributor

Choose a reason for hiding this comment

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

Not saying im perfect, im almost certain I overlooked this somewhere

if type(plot_result) == str:
return "Figures created: " + plot_result
else:
return "No figures created."
except ValueError:
return "No timestep data found in csv file."
return "File could not be processed."
except FileNotFoundError:
return "Issue with CSV file, file not found."
Copy link
Contributor

Choose a reason for hiding this comment

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

Here I usually describe the problem stating that the name/id is not in the path_registry. check again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that error is caught earlier - I solved this by just returning the error that I raise previously in the code (I explicitly raise the error you are describing)

@@ -123,6 +123,9 @@ def compute_rmsd(self, selection="backbone", plot=True):
plt.savefig(f"{self.filename}.png")
# plt.close() # if you don't want to show the plot in notebooks
message += f"Plotted RMSD over time. Saved to {self.filename}.png.\n"
self.path_registry.map_path(
f"{self.filename}.png", f"{self.filename}.png", message
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that i notice, plots are not included in the files yet. Therefore, they don't have an ID. We could include them as records.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you recommend here?

Copy link
Contributor

Choose a reason for hiding this comment

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

So far ive been going with a "simple" approach. Anything that comes as an output from the simulation is a record, everything that ends in .pdb is a pdb file, and simulations are saved as scripts.
Also if a file is a "child" of another file, ill just use that as part of the ID to keep it "traceable".

In this case, the plot comes from a Traj file with its time_stamp, so ill just give it an ID like it: REC0_TRAJ123456, where the number is the time stamp from the traj file.

message = rmsd.calculate_rmsd(rmsd_type, selection, plot)
except ValueError as e:
return (
f"ValueError: {e}. \nMake sure to provide valid PBD "
"file and binding site using MDAnalysis selection syntax."
)
except FileNotFoundError as e:
return str(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, i like to make this messages to the agent more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I add the description above where I define the filenotfound error message

Copy link
Contributor

@Jgmedina95 Jgmedina95 left a comment

Choose a reason for hiding this comment

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

overall I like the new structure. Feels way more organized :). I had a couple comments, but I don't think they are critic, except for the ones regarding the files ids for plots. We can either continue with the ID we have so far for the same simulations: REC0,1,2_simid, or make a new one. I would think, that just keeping what we have, and making good descriptions should work :)

@SamCox822
Copy link
Contributor Author

overall I like the new structure. Feels way more organized :). I had a couple comments, but I don't think they are critic, except for the ones regarding the files ids for plots. We can either continue with the ID we have so far for the same simulations: REC0,1,2_simid, or make a new one. I would think, that just keeping what we have, and making good descriptions should work :)

most of the description errors you are seeing is because I describe the error when defining it, not when returning it. We can chat soon about the file id

@SamCox822 SamCox822 requested a review from Jgmedina95 February 27, 2024 00:52
Copy link
Contributor

@Jgmedina95 Jgmedina95 left a comment

Choose a reason for hiding this comment

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

LGTM

@SamCox822 SamCox822 merged commit 9228878 into main Feb 27, 2024
1 check passed
@SamCox822 SamCox822 deleted the registry branch February 27, 2024 17:04
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.

2 participants