Skip to content

Commit 40e437e

Browse files
author
sena
committed
writing in basic statistics that encoding is oxfor nanopore if --nano specified
1 parent f06eb4b commit 40e437e

2 files changed

Lines changed: 32 additions & 25 deletions

File tree

src/Module.cpp

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ const string ModuleBasicStatistics::module_name = "Basic Statistics";
381381
ModuleBasicStatistics::
382382
ModuleBasicStatistics(const FalcoConfig &config)
383383
: Module(ModuleBasicStatistics::module_name) {
384-
filename_stripped = config.filename_stripped;
384+
is_nanopore = config.nanopore;
385+
filename_stripped = config.filename_stripped;
385386
}
386387

387388
void
@@ -396,32 +397,37 @@ ModuleBasicStatistics::summarize_module(FastqStats &stats) {
396397
// These seem to always be the same on FastQC
397398
// File type
398399
file_type = "Conventional base calls";
399-
400-
// File encoding
401-
const char lowest_char = stats.lowest_char;
402-
403-
//copied from FastQC:
404-
static const size_t SANGER_ENCODING_OFFSET = 33;
405-
static const char ILLUMINA_1_3_ENCODING_OFFSET = 64;
406-
if (lowest_char < 33) {
407-
throw runtime_error("No known encoding with chars < 33. Yours was " +
408-
std::to_string(lowest_char) + ")");
409-
}
410-
else if (lowest_char < 64) {
411-
file_encoding = "Sanger / Illumina 1.9";
412-
stats.encoding_offset = SANGER_ENCODING_OFFSET - Constants::quality_zero;
413-
}
414-
else if (lowest_char == ILLUMINA_1_3_ENCODING_OFFSET+1) {
415-
file_encoding = "Illumina 1.3";
416-
stats.encoding_offset = ILLUMINA_1_3_ENCODING_OFFSET - Constants::quality_zero;
417-
}
418-
else if (lowest_char <= 126) {
419-
file_encoding = "Illumina 1.5";
420-
stats.encoding_offset = ILLUMINA_1_3_ENCODING_OFFSET - Constants::quality_zero;
400+
if (is_nanopore) {
401+
file_encoding = "Oxford Nanopore";
402+
//stats.encoding_offset = ?
421403
}
422404
else {
423-
throw runtime_error("No known encodings with chars > 126 (Yours was " +
424-
std::to_string(lowest_char) + ")");
405+
// File encoding
406+
const char lowest_char = stats.lowest_char;
407+
408+
//copied from FastQC:
409+
static const size_t SANGER_ENCODING_OFFSET = 33;
410+
static const char ILLUMINA_1_3_ENCODING_OFFSET = 64;
411+
if (lowest_char < 33) {
412+
throw runtime_error("No known encoding with chars < 33. Yours was " +
413+
std::to_string(lowest_char) + ")");
414+
}
415+
else if (lowest_char < 64) {
416+
file_encoding = "Sanger / Illumina 1.9";
417+
stats.encoding_offset = SANGER_ENCODING_OFFSET - Constants::quality_zero;
418+
}
419+
else if (lowest_char == ILLUMINA_1_3_ENCODING_OFFSET+1) {
420+
file_encoding = "Illumina 1.3";
421+
stats.encoding_offset = ILLUMINA_1_3_ENCODING_OFFSET - Constants::quality_zero;
422+
}
423+
else if (lowest_char <= 126) {
424+
file_encoding = "Illumina 1.5";
425+
stats.encoding_offset = ILLUMINA_1_3_ENCODING_OFFSET - Constants::quality_zero;
426+
}
427+
else {
428+
throw runtime_error("No known encodings with chars > 126 (Yours was " +
429+
std::to_string(lowest_char) + ")");
430+
}
425431
}
426432

427433
// Poor quality reads

src/Module.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class Module {
102102

103103
class ModuleBasicStatistics : public Module {
104104
public:
105+
bool is_nanopore;
105106
std::string file_type;
106107
std::string file_encoding;
107108
std::string filename_stripped;

0 commit comments

Comments
 (0)