Line 92: |
Line 92: |
| // Successfully read a record from the file, so check to see | | // Successfully read a record from the file, so check to see |
| // if it is valid. | | // if it is valid. |
− | if(samRecord.isValid()) | + | if(samRecord.isValid(samHeader)) |
| { | | { |
| // It is valid, so write it. | | // It is valid, so write it. |
Line 196: |
Line 196: |
| // Successfully read a record from the file, so check to see | | // Successfully read a record from the file, so check to see |
| // if it is valid. | | // if it is valid. |
− | if(samRecord.isValid()) | + | if(samRecord.isValid(samHeader)) |
| { | | { |
| // It is valid, so write it. | | // It is valid, so write it. |
Line 259: |
Line 259: |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool setReferenceID(int referenceID) | + | | bool setReferenceName(SamFileHeader& header, const char* referenceName) |
− | | 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. | + | | Sets the reference sequence name. The reference id is calculated using the header. |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
Line 279: |
Line 279: |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
− | | bool setMateReferenceID(int mateReferenceID) | + | | bool setMateReferenceName(SamFileHeader& header, const char* referenceName) |
− | | 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. | + | | Sets the mate reference sequence name. The mate reference id is calculated using the header. |
| Returns true if successfully set, false if not. | | Returns true if successfully set, false if not. |
| |- | | |- |
Line 320: |
Line 320: |
| ! width=""|Description | | ! width=""|Description |
| |- | | |- |
− | | bool isValid() | + | | bool isValid(SamFileHeader& header) |
| | 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() | | | int getBlockSize() |
| | Returns the BAM block size of the record. | | | Returns the BAM block size of the record. |
| + | |- |
| + | | const char* getReferenceName() |
| + | | Returns the reference sequence name (SAM format). |
| |- | | |- |
| | int getReferenceID() | | | int getReferenceID() |
− | | Returns the reference sequence id (BAM format). | + | | Returns the reference sequence ID (BAM format). |
| |- | | |- |
| | int get1BasedPosition() | | | int get1BasedPosition() |
Line 352: |
Line 355: |
| | int getReadLength() | | | int getReadLength() |
| | Returns the length of the read. | | | Returns the length of the read. |
| + | |- |
| + | | const char* getMateReferenceName() |
| + | | 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() |
| + | | 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() | | | int getMateReferenceID() |