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

SAM/BAM/CRAM readers don't support @CO header #315

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

SAM/BAM/CRAM readers don't support @CO header #315

athos opened this issue Jul 5, 2024 · 0 comments
Labels

Comments

@athos
Copy link
Member

athos commented Jul 5, 2024

The SAM/BAM/CRAM specification has the @CO header for one-line comments. It's defined as below:

@CO: One-line text comment. Unordered multiple @CO lines are allowed. UTF-8 encoding may be
used.
https://github.com/samtools/hts-specs/blob/be74ef71f3fad34eb86af83bd66338d7d569af99/SAMv1.tex#L356

However, the current implementation of the SAM/BAM reader doesn't read the @CO header properly.

Repro

$ samtools view -h header_comment.sam
@SQ	SN:chr1	LN:1000	M5:258e88dcbd3cd44d8e7ab43f6ecb6af0
@CO	This is a comment.
@CO	This is also a comment.
(require '[cljam.io.sam :as sam])

(with-open [r (sam/reader "header_comment.sam")]
  (sam/read-header r))
;=>
{:SQ [{:SN "chr1", :LN 1000, :M5 "258e88dcbd3cd44d8e7ab43f6ecb6af0"}],
 :CO [{:This is a comment. nil} {:This is also a comment. nil}]}

Note that the comment contents themselves are read as keywords including whitespaces.

@athos athos added the bug label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant