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

Add output option to vcztools view #66

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

Will-Tyler
Copy link
Contributor

Overview

This pull request adds an -o / --output option to the vcztools view CLI. The option allows the user to specify a file to write the CLI output to.

This pull request closes #54.

Testing

I add a unit test that writes a file using the output option and confirms that the file is present.

References

Copy link
Contributor

@tomwhite tomwhite left a comment

Choose a reason for hiding this comment

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

Should we check that the filename has a .vcf suffix? Bcftools will use the suffix to detect the output type, and since we only support uncompressed VCF, it might be a good idea to fail if the user tries to write to a .vcf.gz or .bcf file for example.

output = tmp_path / "output.vcf"

run_vcztools(f"view {vcz_path} --output {output}")
assert os.path.exists(output)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you call assert_vcfs_close to check the output is correct?

Also, perhaps this should belong in test_bcftools_validation as you are using run_vcztools from there anyway?

@jeromekelleher
Copy link
Contributor

Failing loudly when we can't do something (or if we depart from bcftools behaviour) should be a basic guiding principle for us I think, so I like @tomwhite's suggestion above. It is a separate issue though, so we could just log an issue to track and do in a follow-up.

@tomwhite tomwhite merged commit 6baaf2f into sgkit-dev:main Aug 30, 2024
10 checks passed
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.

Add view -o/--output option for uncompressed VCF only
3 participants