Line 42: |
Line 42: |
| Opens as BAM file if the specified filename ends in .bam. Otherwise it is opened as a SAM file. | | Opens as BAM file if the specified filename ends in .bam. Otherwise it is opened as a SAM file. |
| Returns true if successfully opened for writing, false if not. | | Returns true if successfully opened for writing, false if not. |
| + | |- |
| + | | void Close() |
| + | | Close the file if there is one open. |
| |- | | |- |
| | bool ReadHeader(SamFileHeader& header) | | | bool ReadHeader(SamFileHeader& header) |
Line 151: |
Line 154: |
| | This method exists, but does not do anything and just returns false. This class is only for reading. | | | This method exists, but does not do anything and just returns false. This class is only for reading. |
| Returns false. | | Returns false. |
| + | |- |
| + | | void Close() |
| + | | Close the file if there is one open. |
| |- | | |- |
| | bool ReadHeader(SamFileHeader& header) | | | bool ReadHeader(SamFileHeader& header) |
Line 263: |
Line 269: |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool setFlag(int flag) | + | | bool setFlag(int16_t flag) |
| | Sets the bitwise FLAG to the passed in value. | | | Sets the bitwise FLAG to the passed in value. |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
Line 271: |
Line 277: |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool set1BasedPosition(int position) | + | | bool set1BasedPosition(int32_t 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. | | | 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. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool set0BasedPosition(int position) | + | | bool set0BasedPosition(int32_t 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. | | | 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. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | |bool setMapQuality(int mapQuality) | + | |bool setMapQuality(int8_t mapQuality) |
| | Sets the mapping quality. | | | Sets the mapping quality. |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
Line 291: |
Line 297: |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool set1BasedMatePosition(int matePosition) | + | | bool set1BasedMatePosition(int32_t 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. | | | 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. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool set0BasedMatePosition(int matePosition) | + | | bool set0BasedMatePosition(int32_t 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. | | | 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. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool setInsertSize(int insertSize) | + | | bool setInsertSize(int32_t insertSize) |
| | Sets the inferred insert size. | | | Sets the inferred insert size. |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
Line 331: |
Line 337: |
| | Returns true if the record is valid. This performs validation steps. TODO: the method exists, but it does not yet perform any checks, so just returns true. | | | Returns true if the record is valid. This performs validation steps. TODO: the method exists, but it does not yet perform any checks, so just returns true. |
| |- | | |- |
− | | int getBlockSize() | + | | int32_t getBlockSize() |
| | Returns the BAM block size of the record. | | | Returns the BAM block size of the record. |
| |- | | |- |
− | | const char* getReferenceName() | + | | const char* getReferenceName(SamFileHeader& header) |
| | Returns the reference sequence name (SAM format). | | | Returns the reference sequence name (SAM format). |
| |- | | |- |
− | | int getReferenceID() | + | | int32_t getReferenceID() |
| | Returns the reference sequence ID (BAM format). | | | Returns the reference sequence ID (BAM format). |
| |- | | |- |
− | | int get1BasedPosition() | + | | int32_t get1BasedPosition() |
| | Returns the 1-based (SAM formatted) leftmost position. | | | Returns the 1-based (SAM formatted) leftmost position. |
| |- | | |- |
− | | int get0BasedPosition() | + | | int32_t get0BasedPosition() |
| | Returns the 0-based (BAM formatted) leftmost position. | | | Returns the 0-based (BAM formatted) leftmost position. |
| |- | | |- |
− | | int getReadNameLength() | + | | int8_t getReadNameLength() |
| | Returns the length of the ReadName (QNAME). | | | Returns the length of the ReadName (QNAME). |
| |- | | |- |
− | | int getMapQuality() | + | | int8_t getMapQuality() |
| | Returns the map quality. | | | Returns the map quality. |
| |- | | |- |
− | | int getBin() | + | | int16_t getBin() |
| | Returns the BAM bin for the record. | | | Returns the BAM bin for the record. |
| |- | | |- |
− | | int getCigarLength() | + | | int16_t getCigarLength() |
| | Returns the length of the CIGAR in BAM format. | | | Returns the length of the CIGAR in BAM format. |
| |- | | |- |
− | | int getFlag() | + | | int16_t getFlag() |
| | Returns the flag. | | | Returns the flag. |
| |- | | |- |
− | | int getReadLength() | + | | int32_t getReadLength() |
| | Returns the length of the read. | | | Returns the length of the read. |
| |- | | |- |
− | | const char* getMateReferenceName() | + | | const char* getMateReferenceName(SamFileHeader& header) |
| | Returns the mate reference sequence name (SAM format). Returns the mate reference sequence name even if it is the same as the reference sequence name. | | | Returns the mate reference sequence name (SAM format). Returns the mate reference sequence name even if it is the same as the reference sequence name. |
| |- | | |- |
− | | const char* getMateReferenceNameOrEqual() | + | | const char* getMateReferenceNameOrEqual(SamFileHeader& header) |
| | Returns the mate reference sequence name (SAM format). Returns the mate reference sequence name, unless it is the same as the reference sequence name, then an "=" is returned.. | | | Returns the mate reference sequence name (SAM format). Returns the mate reference sequence name, unless it is the same as the reference sequence name, then an "=" is returned.. |
| |- | | |- |
− | | int getMateReferenceID() | + | | int32_t getMateReferenceID() |
| | Returns the mate reference sequence id (BAM format). | | | Returns the mate reference sequence id (BAM format). |
| |- | | |- |
− | | int get1BasedMatePosition() | + | | int32_t get1BasedMatePosition() |
| | Returns the 1-based (SAM formatted) mate leftmost position. | | | Returns the 1-based (SAM formatted) mate leftmost position. |
| |- | | |- |
− | | int get0BasedMatePosition() | + | | int32_t get0BasedMatePosition() |
| | Returns the 0-based (BAM formatted) mate leftmost position. | | | Returns the 0-based (BAM formatted) mate leftmost position. |
| |- | | |- |
− | | int getInsertSize() | + | | int32_t getInsertSize() |
| | Returns the insert size. | | | Returns the insert size. |
| + | |- |
| + | | int32_t get0BasedAlignmentEnd(); |
| + | | Returns the 0-based inclusive right-most position of the clipped sequence. |
| + | |- |
| + | | int32_t get1BasedAlignmentEnd(); |
| + | | Returns the 1-based inclusive right-most position of the clipped sequence. |
| + | |- |
| + | | int32_t get0BasedUnclippedStart(); |
| + | | Returns the 0-based inclusive left-most position adjusted for clipped bases. |
| + | |- |
| + | | int32_t get1BasedUnclippedStart(); |
| + | | Returns the 1-based inclusive left-most position adjusted for clipped bases. |
| + | |- |
| + | | int32_t get0BasedUnclippedEnd(); |
| + | | Returns the 0-based inclusive right-most position adjusted for clipped bases. |
| + | |- |
| + | | int32_t get1BasedUnclippedEnd(); |
| + | | Returns the 1-based inclusive right-most position adjusted for clipped bases. |
| |- | | |- |
| | const char* getReadName() | | | const char* getReadName() |