Difference between revisions of "C++ Class: SamFileHeader"

From Genome Analysis Wiki
Jump to navigationJump to search
Line 38: Line 38:
 
|}
 
|}
  
 +
 +
==== Proposed Accessors ====
 +
* HD
 +
** getVersion - returns the VN field (will only be one)
 +
* SQ
 +
** getRefSequenceCount - count of the number of SQ entries in the header
 +
** getRefSequenceName - gets the next reference sequence name.
 +
** getRefSequenceLength - gets the length associated with the specified reference sequence.
 +
* RG
 +
** getSampleID - for a specified Read Group....???? but SampleID is the key...maybe passing in a record?
 +
** getReadGroup - pass in record, return a read group structure?
 +
**
 +
*
 
'''NOTE: More Get Accessors will be coming.  Let me know if you need a specific one, and I can add that first'''
 
'''NOTE: More Get Accessors will be coming.  Let me know if you need a specific one, and I can add that first'''

Revision as of 18:58, 12 April 2010

SamFileHeader

This class allows a user to get/set the fields in a SAM/BAM Header.

This class is part of libbam.

Setting fields in the Header

The SamFileHeader class contains accessors to set the header lines of a SAM/BAM header. By using these set methods to setup the header, they can be pulled back out using the get accessors or the header can be later written to a SAM/BAM file. The methods found in the SamFileHeader class for setting fields are:

Method Name Description
bool SamFileHeader::addHeaderLine(const char* type, const char* tag, int value) Adds the type, tag, and integer value to the header.

Returns true if successfully added, false if not. NOTE: currently, this method will only do one tag per type on a line. If a type has multiple tags, then the whole line needs to be added at once.

bool SamFileHeader::addHeaderLine(const char* type, const char* tag, const char* value) Adds the type, tag, and const char* value to the header.

Returns true if successfully added, false if not. NOTE: currently, this method will only do one tag per type on a line. If a type has multiple tags, then the whole line needs to be added at once.

bool SamFileHeader::addHeaderLine(const char* headerLine) Adds the already setup/formatted headerLine to the header. It is assumed that the line does not contain a “\n”.

Returns true if successfully added, false if not.


Getting fields from the Header

Method Name Description
const char* SamFileHeader::getTagSO() Return the value of the SO tag. If the field does not exist, "unsorted" is returned.


Proposed Accessors

  • HD
    • getVersion - returns the VN field (will only be one)
  • SQ
    • getRefSequenceCount - count of the number of SQ entries in the header
    • getRefSequenceName - gets the next reference sequence name.
    • getRefSequenceLength - gets the length associated with the specified reference sequence.
  • RG
    • getSampleID - for a specified Read Group....???? but SampleID is the key...maybe passing in a record?
    • getReadGroup - pass in record, return a read group structure?

NOTE: More Get Accessors will be coming. Let me know if you need a specific one, and I can add that first