Changes

From Genome Analysis Wiki
Jump to navigationJump to search
no edit summary
Line 15: Line 15:  
A SAM Header Record is comprised of  Tag/Value pairs.  Each tag only appears once within a specific record.
 
A SAM Header Record is comprised of  Tag/Value pairs.  Each tag only appears once within a specific record.
   −
A SAM Header can have 0 or 1 HD records, 0 or 1 PG records, 0 or more SQ Records, and 0 or more RG records.  The SQ records are keyed off of the SN, Sequence Name, tag.  This tag must be unique between SQ records.  The RG records are keyed off of the ID, Unique Read Group Identifier, tag.  This tag must be unique between SQ records.
+
A SAM Header can have 0 or 1 HD records, 0 or more PG records, 0 or more SQ Records, and 0 or more RG records.  The PG records are keyed off of the ID tag.  The SQ records are keyed off of the SN, Sequence Name, tag.  The RG records are keyed off of the ID, Unique Read Group Identifier, tag.  The keys must be unique for that record type within the file.
   −
The SamFileHeader also contains Comments, type CO.  They are not included as part of the SamHeaderRecord class since they do not contain Tag/Value pairs.
+
The '''SamFileHeader''' also contains Comments, type CO.  They are not included as part of the '''SamHeaderRecord''' class since they do not contain Tag/Value pairs.
    
=== Setting fields in the Header ===
 
=== Setting fields in the Header ===
Line 52: Line 52:  
Returns true if the tag was successfully set.
 
Returns true if the tag was successfully set.
 
|-
 
|-
| <code>bool SamFileHeader::setPGTag(const char* tag, const char* value)</code>
+
| <code>bool SamFileHeader::setPGTag(const char* tag, const char* value, const char* id)</code>
| Set the specified tag to the specified value in the PG header.
+
| Set the specified tag to the specified value in the PG header with the specified id.  If the header does not yet exist, the header is added and so is the ID tag with the value set to the passed in id.  A tag is removed by passing in value = "".  The ID tag may not be modified or removed after it is set.
 +
Returns true if the tag was successfully set.
 
|-
 
|-
 
| <code>bool SamFileHeader::setSQTag(const char* tag, const char* value, const char* name)</code>
 
| <code>bool SamFileHeader::setSQTag(const char* tag, const char* value, const char* name)</code>
Line 99: Line 100:  
Returns true if successfully removed or if it didn't exist in the first place.  Returns false if the record still exists.
 
Returns true if successfully removed or if it didn't exist in the first place.  Returns false if the record still exists.
 
|-
 
|-
| <code>bool SamFileHeader::removePG()</code>
+
| <code>bool SamFileHeader::removePG(const char* id)</code>
| Remove the PG record.
+
| Remove the PG record associated with the specified id.
 
Returns true if successfully removed or if it didn't exist in the first place.  Returns false if the record still exists.
 
Returns true if successfully removed or if it didn't exist in the first place.  Returns false if the record still exists.
 
|-
 
|-
Line 173: Line 174:  
| Returns the value associated with the specified HD tag.  Returns "" if the tag does not exist in the header.
 
| Returns the value associated with the specified HD tag.  Returns "" if the tag does not exist in the header.
 
|-
 
|-
| <code>const char* SamFileHeader::getPGTagValue(const char* tag)</code>
+
| <code>const char* SamFileHeader::getPGTagValue(const char* tag, const char* id)</code>
| Returns the value associated with the specified PG tag.  Returns "" if the tag does not exist in the header.
+
| Returns the value associated with the specified tag on the PG line with the specified id.  Returns "" if the tag does not exist in the specified line or if the specified line does not exist.
 
|-
 
|-
 
| <code>const char* SamFileHeader::getSQTagValue(const char* tag, const char* name)</code>
 
| <code>const char* SamFileHeader::getSQTagValue(const char* tag, const char* name)</code>
Line 180: Line 181:  
|-
 
|-
 
| <code>const char* SamFileHeader::getRGTagValue(const char* tag, const char* id)</code>
 
| <code>const char* SamFileHeader::getRGTagValue(const char* tag, const char* id)</code>
| Returns the value associated with the specified tag on the RG line with the specified sequence name.  Returns "" if the tag does not exist in the specified line or if the specified line does not exist.
+
| Returns the value associated with the specified tag on the RG line with the specified id.  Returns "" if the tag does not exist in the specified line or if the specified line does not exist.
 
|}
 
|}
   Line 195: Line 196:  
| Get the HD object.  Returns NULL if there is no HD record.
 
| Get the HD object.  Returns NULL if there is no HD record.
 
|-
 
|-
| <code>SamHeaderPG* SamFileHeader::getPG()</code>
+
| <code>SamHeaderPG* SamFileHeader::getPG(const char* id)</code>
| Get the PG object.  Returns NULL if there is no PG record.
+
| Get the PG object with the specified id.  Returns NULL if there is no PG record with that key.
 
|-
 
|-
 
| <code>SamHeaderSQ* SamFileHeader::getSQ(const char* name)</code>
 
| <code>SamHeaderSQ* SamFileHeader::getSQ(const char* name)</code>
Line 202: Line 203:  
|-
 
|-
 
| <code>SamHeaderRG* SamFileHeader::getRG(const char* id)</code>
 
| <code>SamHeaderRG* SamFileHeader::getRG(const char* id)</code>
| Get the RG object with the specified sequence name.  Returns NULL if there is no RG object with that key.
+
| Get the RG object with the specified id.  Returns NULL if there is no RG object with that key.
 
|}
 
|}
  

Navigation menu