libStatGen Software 1
ShiftIndelsTest Class Reference

Static Public Member Functions

static void testShift (const char *input, const char *output)
 

Detailed Description

Definition at line 20 of file ShiftIndels.h.

Member Function Documentation

◆ testShift()

void ShiftIndelsTest::testShift ( const char *  input,
const char *  output 
)
static

Definition at line 31 of file ShiftIndels.cpp.

32{
33 SamFile inSam, outSam;
34
35 assert(inSam.OpenForRead(input));
36 assert(outSam.OpenForWrite(output));
37
38
39 // Read the SAM Header.
40 SamFileHeader samHeader;
41 assert(inSam.ReadHeader(samHeader));
42 assert(outSam.WriteHeader(samHeader));
43
44
45 SamRecord samRecord;
46 int readNum = 1;
47 bool shiftResult = true;
48 while(inSam.ReadRecord(samHeader, samRecord))
49 {
50 if((readNum == 3)|| (readNum == 5))
51 {
52 shiftResult = false;
53 }
54 else
55 {
56 shiftResult = true;
57 }
58 ++readNum;
59
60 assert(samRecord.shiftIndelsLeft() == shiftResult);
61 assert(outSam.WriteRecord(samHeader, samRecord));
62 }
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
bool OpenForWrite(const char *filename, SamFileHeader *header=NULL)
Open a sam/bam file for writing with the specified filename, determining SAM/BAM from the extension (...
Definition: SamFile.cpp:223
bool WriteHeader(SamFileHeader &header)
Writes the specified header into the file.
Definition: SamFile.cpp:480
bool WriteRecord(SamFileHeader &header, SamRecord &record)
Writes the specified record into the file.
Definition: SamFile.cpp:632
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
bool shiftIndelsLeft()
Shift the indels (if any) to the left by updating the CIGAR.
Definition: SamRecord.cpp:368

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