libStatGen Software 1
SamRecordHelperTest Class Reference

Static Public Member Functions

static void testSamRecordHelper (const char *fileName)
 

Detailed Description

Definition at line 21 of file TestSamRecordHelper.h.

Member Function Documentation

◆ testSamRecordHelper()

void SamRecordHelperTest::testSamRecordHelper ( const char *  fileName)
static

Definition at line 31 of file TestSamRecordHelper.cpp.

32{
33 SamFile inSam;
34 assert(inSam.OpenForRead(fileName));
35 SamFileHeader samHeader;
36 assert(inSam.ReadHeader(samHeader));
37 validateHeader(samHeader);
38
39 SamRecord samRecord;
40 assert(inSam.ReadRecord(samHeader, samRecord) == true);
41 validateRead1(samRecord);
42
43 // Validate the entire sequence matches.
44 assert(SamRecordHelper::checkSequence(samRecord,
45 TestValidate::READ1_POS,
46 TestValidate::READ1_SEQ.c_str()) == 0);
47
48 // The read start position is 1010.
49 // The sequence is CCGAA.
50 assert(SamRecordHelper::checkSequence(samRecord, 1010, "CCGAA") == 0);
51
52 // Test not matching.
53 assert(SamRecordHelper::checkSequence(samRecord, 1010, "NNNNN") == -1);
54
55 // Test match, but not at the start.
56 assert(SamRecordHelper::checkSequence(samRecord, 1011, "CGA") == 1);
57
58 // Test match not at the start, but to the end.
59 assert(SamRecordHelper::checkSequence(samRecord, 1011, "CGAA") == 1);
60
61 // Test run over the end.
62 assert(SamRecordHelper::checkSequence(samRecord, 1011, "CGAAC") == -1);
63
64}
This class allows a user to get/set the fields in a SAM/BAM Header.
Definition: SamFileHeader.h:35
Allows the user to easily read/write a SAM/BAM file.
Definition: SamFile.h:36
bool ReadHeader(SamFileHeader &header)
Reads the header section from the file and stores it in the passed in header.
Definition: SamFile.cpp:450
bool ReadRecord(SamFileHeader &header, SamRecord &record)
Reads the next record from the file & stores it in the passed in record.
Definition: SamFile.cpp:514
bool OpenForRead(const char *filename, SamFileHeader *header=NULL)
Open a sam/bam file for reading with the specified filename, determing the type of file and SAM/BAM b...
Definition: SamFile.cpp:93
static int checkSequence(SamRecord &record, int32_t pos0Based, const char *sequence)
Helper method that checks if the record's read sequence starting at the specified 0-based reference p...
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52

The documentation for this class was generated from the following files: