Skip to content

Commit a7ccfe2

Browse files
committed
Adds the option of ignoring quality values in fastq or bam files
1 parent 1e01158 commit a7ccfe2

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

bamhash_checksum_bam.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ struct Baminfo {
2626
seqan::CharString bamFile;
2727
bool debug;
2828
bool noReadNames;
29+
bool noQuality;
2930

30-
Baminfo() : debug(false), noReadNames(false) {}
31+
Baminfo() : debug(false), noReadNames(false), noQuality(false) {}
3132

3233
};
3334

@@ -53,6 +54,7 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) {
5354
//add debug option:
5455
addOption(parser, seqan::ArgParseOption("d", "debug", "Debug mode. Prints full hex for each read to stdout"));
5556
addOption(parser, seqan::ArgParseOption("R", "no-readnames", "Do not use read names as part of checksum"));
57+
addOption(parser, seqan::ArgParseOption("Q", "no-quality", "Do not use read quality as part of checksum"));
5658

5759
// Parse command line.
5860
seqan::ArgumentParser::ParseResult res = seqan::parse(parser, argc, argv);
@@ -62,6 +64,7 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) {
6264

6365
options.debug = isSet(parser, "debug");
6466
options.noReadNames = isSet(parser, "no-readnames");
67+
options.noQuality = isSet(parser, "no-quality");
6568
getArgumentValue(options.bamFile, parser, 0);
6669

6770
return seqan::ArgumentParser::PARSE_OK;
@@ -132,7 +135,9 @@ int main(int argc, char const **argv) {
132135
}
133136

134137
seqan::append(string2hash, record.seq);
135-
seqan::append(string2hash, record.qual);
138+
if (!info.noQuality) {
139+
seqan::append(string2hash, record.qual);
140+
}
136141
seqan::clear(record);
137142

138143
// Get MD5 hash

bamhash_checksum_fastq.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ struct Fastqinfo {
1616
seqan::CharString fastq2;
1717
bool debug;
1818
bool noReadNames;
19+
bool noQuality;
1920
bool paired;
2021

21-
Fastqinfo() : debug(false), noReadNames(false) {}
22+
Fastqinfo() : debug(false), noReadNames(false), noQuality(false) {}
2223

2324
};
2425

@@ -43,6 +44,7 @@ parseCommandLine(Fastqinfo& options, int argc, char const **argv) {
4344
//add debug option:
4445
addOption(parser, seqan::ArgParseOption("d", "debug", "Debug mode. Prints full hex for each read to stdout"));
4546
addOption(parser, seqan::ArgParseOption("R", "no-readnames", "Do not use read names as part of checksum"));
47+
addOption(parser, seqan::ArgParseOption("Q", "no-quality", "Do not use read quality as part of checksum"));
4648

4749
// Parse command line.
4850
seqan::ArgumentParser::ParseResult res = seqan::parse(parser, argc, argv);
@@ -52,6 +54,7 @@ parseCommandLine(Fastqinfo& options, int argc, char const **argv) {
5254

5355
options.debug = isSet(parser, "debug");
5456
options.noReadNames = isSet(parser, "no-readnames");
57+
options.noQuality = isSet(parser, "no-quality");
5558
getArgumentValue(options.fastq1, parser, 0);
5659
if(getArgumentValueCount(parser, 0) > 1) {
5760
getArgumentValue(options.fastq2, parser, 0, 1);
@@ -158,7 +161,9 @@ int main(int argc, char const **argv) {
158161
seqan::append(string2hash1,"/1");
159162
}
160163
seqan::append(string2hash1, seq1);
161-
seqan::append(string2hash1, qual1);
164+
if (!info.noQuality) {
165+
seqan::append(string2hash1, qual1);
166+
}
162167

163168

164169
if (info.paired) {
@@ -167,7 +172,9 @@ int main(int argc, char const **argv) {
167172
seqan::append(string2hash2,"/2");
168173
}
169174
seqan::append(string2hash2, seq2);
170-
seqan::append(string2hash2, qual2);
175+
if (!info.noQuality) {
176+
seqan::append(string2hash2, qual2);
177+
}
171178
}
172179

173180
// Get MD5 hash

0 commit comments

Comments
 (0)