Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#817 closed request (fixed)

access misc text in BamHeader

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.13
Component: omic Version: 0.12.1
Keywords: Cc:

Description

Current interface (0.12) can only translate tid to chromosome number and vice versa, i.e., rows starting with @SG can be accessed. There in way to access other things in the header. Specifically I want the @RG rows to access sample names typically encoded with something like:

@RG	ID:foo	PL:ILLUMINA	SM:tumor

Change History (7)

comment:1 Changed 4 years ago by Peter

Milestone: yat 0.x+yat 0.13

comment:2 Changed 4 years ago by Peter

There's no functionality to help with this in htslib. We have a char* text and uint32_t l_text, so the question is what we want:

  1. Const access to the raw data, possibly as a std::string (just because we prefer C++).
  2. Set string
  3. Some interface to solve wish in description with something like
std::string read_group("foo", "SM");

comment:3 Changed 4 years ago by Peter

(In [3408]) Implement functions to get/set free text in BamHeader?. As setting the header text modifies underlying data, copy and assignment are now implemented as hard copy (rather than the implicit pointer copy as before). It also means that the bam_hdr_t* is no longer owned by InBamFile?, but is now owned by BamHeader? and destroyed in its destructor.

refs #817

comment:4 Changed 4 years ago by Peter

Status: newassigned

comment:5 Changed 4 years ago by Peter

(In [3409]) refs #817. Fix bug that struct was not updated in text(1) function (in libbam mode); add test to catch bug.

comment:6 Changed 4 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [3410]) add two new functions read_group and program_group to access data in BamHeader?. closes #817

comment:7 Changed 4 years ago by Peter

(In [3412]) throw exception rather than returnining empty string when ID or KEY is missing in header. refs #817

Note: See TracTickets for help on using tickets.