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

Stop samtools cat from outputting multiple CRAM EOF markers. #1422

Closed
wants to merge 2 commits into from

Commits on Apr 26, 2021

  1. Stop samtools cat from outputting multiple CRAM EOF markers.

    Samtools cat naively copies all incoming containers, and then writes
    an empty EOF container when closing the file.  This leads to multiple
    internal EOF markers as they're implemented in CRAM as an empty
    container.
    
    Oddly there was code explicitly dealing with this, which seems
    redundant.  Perhaps it served a purpose in early versions.  Regardless
    internal EOF markers is permitted and are ignored, so this change is
    just for tidyness sake and to improve robustness incase bad
    implementations stop on the first EOF.
    jkbonfield committed Apr 26, 2021
    Configuration menu
    Copy the full SHA
    fb911e6 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2021

  1. SQUASH ME (and cull this commit message).

    Amend previous commit following review comments.  (As a distinct
    commit temporarily so the change we discussed is visible.)
    
    Empty containers still have a CRAM compression header block.  So EOF
    blocks internal to a file need to have their block read even if we're
    not going to write it and the container back out again.
    
    This was visible by the following experiment.
    
    // Create a CRAM with internal EOF markers
    samtools-1.12 cat in.bam in.bam -o out1.bam
    
    // Concatenate such files together, with code prior to this commit
    samtools-previous-commit cat out1.bam out1.bam -o out2.bam
    jkbonfield committed Apr 27, 2021
    Configuration menu
    Copy the full SHA
    ce6a60f View commit details
    Browse the repository at this point in the history