18 #include "TestFilter.h" 19 #include "TestValidate.h" 20 #include "SamFilter.h" 27 FilterTest::testFilter(FilterTest::SAM);
28 #ifdef __ZLIB_AVAILABLE__ 29 FilterTest::testFilter(FilterTest::BAM);
34 void FilterTest::testFilter(
FileType inputType)
50 validateHeader(samHeader);
53 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
54 validateRead1(samRecord);
60 std::string expectedCigar =
"2S1M2S";
61 assert(samRecord.
getCigar() == expectedCigar);
62 assert(samRecord.
getSequence() == TestValidate::READ1_SEQ);
63 assert(samRecord.
getQuality() == TestValidate::READ1_QUAL);
73 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
74 validateRead2(samRecord);
76 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
77 validateRead3(samRecord);
79 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
80 validateRead4(samRecord);
82 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
83 validateRead5(samRecord);
85 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
86 validateRead6(samRecord);
91 expectedCigar =
"2H5S1M2S";
92 assert(samRecord.
getCigar() == expectedCigar);
93 assert(samRecord.
getSequence() == TestValidate::READ6_SEQ);
94 assert(samRecord.
getQuality() == TestValidate::READ6_QUAL);
101 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
102 validateRead7(samRecord);
107 expectedCigar =
"5S1M3S3H";
108 assert(samRecord.
getCigar() == expectedCigar);
109 assert(samRecord.
getSequence() == TestValidate::READ7_SEQ);
110 assert(samRecord.
getQuality() == TestValidate::READ7_QUAL);
117 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
118 validateRead8(samRecord);
120 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
121 validateRead9(samRecord);
123 assert(inSam.
ReadRecord(samHeader, samRecord) ==
true);
124 validateRead10(samRecord);
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.
bool ReadHeader(SamFileHeader &header)
Reads the header section from the file and stores it in the passed in header.
int32_t get0BasedUnclippedEnd()
Returns the 0-based inclusive right-most position adjusted for clipped bases.
Filtering clipped the read.
int32_t getAlignmentLength()
Returns the length of the clipped sequence, returning 0 if the cigar is '*'.
const char * getSequence()
Returns the SAM formatted sequence string (SEQ), translating the base as specified by setSequenceTran...
Allows the user to easily read/write a SAM/BAM file.
const char * getQuality()
Returns the SAM formatted quality string (QUAL).
bool ReadRecord(SamFileHeader &header, SamRecord &record)
Reads the next record from the file & stores it in the passed in record.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM 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...
static FilterStatus softClip(SamRecord &record, int32_t numFrontClips, int32_t numBackClips)
Soft clip the record from the front and/or the back.
int32_t get0BasedPosition()
Get the 0-based(BAM) leftmost position of the record.
const char * getCigar()
Returns the SAM formatted CIGAR string.