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

Problematic behaviors around BAM index generation #316

Open
athos opened this issue Jul 11, 2024 · 0 comments
Open

Problematic behaviors around BAM index generation #316

athos opened this issue Jul 11, 2024 · 0 comments

Comments

@athos
Copy link
Member

athos commented Jul 11, 2024

Currently, cljam's BAM writer supports simultaneous writing of a BAM file and its index file. This feature can be enabled by specifying true as the second argument of cljam.io.sam/writer. There are two problematic behaviors around this:

  1. Index file writing is only performed if SO:coordinate is specified in the BAM file header
    • If SO:coordinate is not specified, enabling index file writing is ignored, and no index file is created without any error
  2. The BAM indexer can also create BAM index files although it does not check for SO:coordinate in the BAM file header and always creates an index file
    • This is not only inconsistent with the BAM writer's behavior but also can result in invalid index files if the input BAM file is not sorted

I think the following changes can be made to improve usability and consistency:

  1. If index file writing is enabled for the BAM writer and SO:coordinate is not specified in the BAM file header, an error should be raised to tell the user that the BAM writer didn't succeed in generating an index file
  2. The BAM indexer should also check for SO:coordinate in the input BAM file header and raise an error if SO:coordinate is not specified, ensuring consistency with the BAM writer

Note that these changes will introduce breaking changes in that they will cause errors in situations where no errors were found previously.

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

No branches or pull requests

1 participant