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

Update seqspec check so we can run it directly in python script #58

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

mingjiecn
Copy link

Previously, we need those two parameters beside seqspec file path to run check function: schema: Draft4Validator, spec: Assay. I updated the function so those two parameters are no longer needed. Only seqspec file path is needed to run check function in python script.

@sbooeshaghi
Copy link
Collaborator

Thank you for the PR! To be consistent with other functionality, can you modify the code slightly so that the already loaded spec is passed to the check function? So that way run_check takes in the spec_fn, loads the spec, and then passes it to the check function (like how index works

def run_index(

)

@mingjiecn
Copy link
Author

mingjiecn commented Jan 15, 2025

If we do so, how to run check in python script when only seqspec file name provided? The purpose of this PR is to remove the schema and the spec parameters out of function check so we can run check directly with only spec file name parameter since seqspec file is the only info we have before, for example: errors = check(seqpec_file_path). Let me know if you can enable check using python script without running it in terminal in some other ways. Thanks!

@sbooeshaghi
Copy link
Collaborator

I agree that removing the schema (making it a param that doesn't need to be passed) is a good idea. The way that you can run check in a python script with only the seqspec file name provided is the following

from seqspec.utils import load_spec
from seqspec.seqspec_check import check

spec = load_spec(spec_fn)
errors = check(spec)

This requires making the changes that I suggested (which has the benefit of making the code consistent across seqspec functionality).

@mingjiecn
Copy link
Author

Got it. Will do! Thanks!

@mingjiecn
Copy link
Author

OK, I put spec back in function check parameters. I can't remove spec_fn since it is used inside check function. Let me know if this is OK. Thank you! @sbooeshaghi

@sbooeshaghi
Copy link
Collaborator

Looks great! Thank you. Will merge.

@sbooeshaghi sbooeshaghi merged commit 8e9554f into pachterlab:devel Jan 15, 2025
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