Changes

From Genome Analysis Wiki
Jump to navigationJump to search
4,054 bytes added ,  14:51, 16 March 2010
no edit summary
Line 75: Line 75:  
}
 
}
 
</pre>
 
</pre>
 +
 +
 +
== Setting fields in a SAM/BAM Record ==
 +
The SamRecord class contains accessors to set the fields of a SAM/BAM record.  They are used for creating a record that is not read from a SAM/BAM file.  By using these set methods to setup the record, they can be pulled back out using the get accessors or the record can be later written as either a SAM/BAM record. 
 +
This methods found in the SamRecord class for setting fields are:
 +
{| class="wikitable" style="width:100%" border="1"
 +
|+ style="font-size:150%"|'''SamFile Class Methods'''
 +
!  width=""|Method Name
 +
!  width=""|Description
 +
|-
 +
| bool setReadName(const char* readName)
 +
| Sets QNAME to the passed in name.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setFlag(int flag)
 +
| Sets the bitwise FLAG to the passed in value.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setReferenceID(int referenceID)
 +
| Sets the reference sequence id.  The reference name is not currently stored.  A map to the header needs to be done to get this (which is done when writing a SAM file).  THIS is an opportunity for improvement.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool set1BasedPosition(int position)
 +
| Sets the leftmost position.  The value passed in is 1-based (SAM formatted).  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool set0BasedPosition(int position)
 +
| Sets the leftmost position.  The value passed in is 0-based (BAM formatted).  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
|bool setMapQuality(int mapQuality)
 +
| Sets the mapping quality.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setCigar(const char* cigar)
 +
| Sets the cigar string to the passed in CIGAR.  This is a SAM formatted CIGAR string.  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setMateReferenceID(int mateReferenceID)
 +
| Sets the mate reference sequence id.  The mate reference name is not currently stored.  A map to the header needs to be done to get this (which is done when writing a SAM file).  THIS is an opportunity for improvement.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool set1BasedMatePosition(int matePosition)
 +
| Sets the leftmost mate position.  The value passed in is 1-based (SAM formatted).  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool set0BasedMatePosition(int matePosition)
 +
| Sets the leftmost mate position.  The value passed in is 0-based (BAM formatted).  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setInsertSize(int insertSize)
 +
| Sets the inferred insert size.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setSequence(const char* seq)
 +
| Sets the sequence string to the passed in string.  This is a SAM formatted sequence string.  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
| bool setQuality(const char* quality)
 +
| Sets the quality string to the passed in string.  This is a SAM formatted quality string.  Internal processing handles switching between SAM/BAM formats when read/written.
 +
Returns true if successfully set, false if not.
 +
|-
 +
|  bool addTag(const char* tag, char vtype, const char* value)
 +
| Adds a tag to the record with the specified tag, vtype, and value.  Vtype can be SAM/BAM vtype.  Internal processing handles switching between SAM/BAM vtypes when read/written.
 +
Returns true if successfully set, false if not.
 +
|}
 +
 +
 +
== Retrieving fields from a SAM/BAM Record ==
 +
The SamRecord class contains accessors to access the fields of a SAM/BAM record.  They assume that the class has already been populated, either by using the set commands or by calling SamFile::ReadRecord.

Navigation menu