samtools / htsjdk

A Java API for high-throughput sequencing data (HTS) formats.
http://samtools.github.io/htsjdk/
283 stars 242 forks source link

Quick Question: Can we read a CRAM Header without reference ? #1407

Closed lindenb closed 5 years ago

lindenb commented 5 years ago

A quick question:

I'm writing a generic tool that scan some BAM/CRAM/VCF to find all the samples.

So, I just want to extract the ReadGroups from a CRAM file; Is it possible to access the data without setting a Reference path ? Just like we can extract the Dictionary with SAMSequenceDictionaryExtractor ?

Thanks.

cmnbroad commented 5 years ago

@lindenb The upper htsjdk layers (SamReader) currently require a reference for CRAM, so for now although although what you want is possible to do, it requires a small amount of CRAM-specific code (see the SAMSequenceDictionaryExtractor code, for example). A refactoring of the CRAM code is underway and the reference requirement will be relaxed in the future, but that won't be merged for a while.

lindenb commented 5 years ago

@cmnbroad thank you for your quick answer !