35{
37
38 if(inputType == SAM)
39 {
41 }
42 else
43 {
45 }
46
47
50 validateHeader(samHeader);
51
53 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
54 validateRead1(samRecord);
55
56
57
60 std::string expectedCigar = "2S1M2S";
61 assert(samRecord.
getCigar() == expectedCigar);
62 assert(samRecord.
getSequence() == TestValidate::READ1_SEQ);
63 assert(samRecord.
getQuality() == TestValidate::READ1_QUAL);
64
68
69
71
72
73 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
74 validateRead2(samRecord);
75
76 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
77 validateRead3(samRecord);
78
79 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
80 validateRead4(samRecord);
81
82 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
83 validateRead5(samRecord);
84
85 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
86 validateRead6(samRecord);
87
88
91 expectedCigar = "2H5S1M2S";
92 assert(samRecord.
getCigar() == expectedCigar);
93 assert(samRecord.
getSequence() == TestValidate::READ6_SEQ);
94 assert(samRecord.
getQuality() == TestValidate::READ6_QUAL);
95
100
101 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
102 validateRead7(samRecord);
103
104
107 expectedCigar = "5S1M3S3H";
108 assert(samRecord.
getCigar() == expectedCigar);
109 assert(samRecord.
getSequence() == TestValidate::READ7_SEQ);
110 assert(samRecord.
getQuality() == TestValidate::READ7_QUAL);
111
116
117 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
118 validateRead8(samRecord);
119
120 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
121 validateRead9(samRecord);
122
123 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
124 validateRead10(samRecord);
125}
Allows the user to easily read/write a SAM/BAM file.
bool ReadHeader(SamFileHeader &header)
Reads the header section from the file and stores it in the passed in header.
bool ReadRecord(SamFileHeader &header, SamRecord &record)
Reads the next record from the file & stores it in the passed in record.
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...
@ CLIPPED
Filtering clipped the read.
static FilterStatus softClip(SamRecord &record, int32_t numFrontClips, int32_t numBackClips)
Soft clip the record from the front and/or the back.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
int32_t getAlignmentLength()
Returns the length of the clipped sequence, returning 0 if the cigar is '*'.
int32_t get0BasedUnclippedEnd()
Returns the 0-based inclusive right-most position adjusted for clipped bases.
int32_t get0BasedUnclippedStart()
Returns the 0-based inclusive left-most position adjusted for clipped bases.
int32_t get0BasedAlignmentEnd()
Returns the 0-based inclusive rightmost position of the clipped sequence.
int32_t get0BasedPosition()
Get the 0-based(BAM) leftmost position of the record.
const char * getCigar()
Returns the SAM formatted CIGAR string.
const char * getQuality()
Returns the SAM formatted quality string (QUAL).
const char * getSequence()
Returns the SAM formatted sequence string (SEQ), translating the base as specified by setSequenceTran...