Skip to content

Commit

Permalink
1.0.4 (#77)
Browse files Browse the repository at this point in the history
* trying to change class initializaiton to fix the bug reported in #76

* Changing auto* to auto to stop issue 76

* Changing auto* to auto to stop issue 76

* Updating the format of estimated false discovery rate output

* Fixed a bug with calculating coverage
  • Loading branch information
DanielOlson authored Jan 16, 2025
1 parent 1fdcf58 commit d04547b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/FASTAReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class FASTAReader {
std::ifstream file;

std::string line;
long long linePlace;
unsigned long long total_seq_length;
long long linePlace = 0;
unsigned long long total_seq_length = 0;

// change to queues
std::vector<SequenceWindow *> windows;
Expand All @@ -46,12 +46,12 @@ class FASTAReader {
double G_pctg;

symbol *overlapBuffer; // = NULL;
unsigned long overlapLength; // = 0;
unsigned long overlapLength = 0; // = 0;

std::string sequenceName; // = "";
unsigned long sequenceID; // = 0;
unsigned long readID; // = 0; // read id's may not be contiguous
unsigned long symbolsReadInSeq; // = 0;
std::string sequenceName = ""; // = "";
unsigned long sequenceID = 0; // = 0;
unsigned long readID = 0; // = 0; // read id's may not be contiguous
unsigned long symbolsReadInSeq = 0; // = 0;

bool doneReadingFile; // = false;
bool isReading;
Expand Down
2 changes: 1 addition & 1 deletion src/cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef ULTRA_CLI_HPP
#define ULTRA_CLI_HPP

#define ULTRA_VERSION_STRING "1.0.3"
#define ULTRA_VERSION_STRING "1.0.4"
#define DEBUG_STRING ""
#ifdef DEBUG_PRAGMA
#undef DEBUG_STRING
Expand Down
10 changes: 4 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main_wrapper(int argc, const char * argv[]) {
search_setting.bed_out = false;

// We first get the normal coverage
auto *ultra = new Ultra(&search_setting);
auto ultra = new Ultra(&search_setting);
ultra->AnalyzeFile();
ultra->OutputRepeats(true);
seq_length = ultra->reader->fastaReader->total_seq_length;
Expand Down Expand Up @@ -102,7 +102,7 @@ int main_wrapper(int argc, const char * argv[]) {
}
}

printf("(%zu/%zu): %g, %g, %s\n",(coverage.size()),
printf("(%zu/%zu): %.5f, %.5f, %s\n",(coverage.size()),
param_strings.size(),
real_coverage, fdr, arg_string.c_str());
}
Expand All @@ -113,7 +113,7 @@ int main_wrapper(int argc, const char * argv[]) {
double false_coverage = (double)shuffled_coverage[best_coverage_index] / (double)seq_length;
double fdr = false_coverage / real_coverage;

printf("Best coverage within FDR limit: %g, %g, %s\n", real_coverage,
printf("Best coverage within FDR limit: %.5f, %.5f, %s\n", real_coverage,
fdr,
param_strings[best_coverage_index].c_str());

Expand All @@ -136,9 +136,7 @@ int main_wrapper(int argc, const char * argv[]) {
}

// Perform the actual run


auto *ultra = new Ultra(settings);
auto ultra = new Ultra(settings);
ultra->AnalyzeFile();
ultra->OutputRepeats(true);
unsigned long long true_coverage = ultra->Coverage();
Expand Down
4 changes: 4 additions & 0 deletions src/ultra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ void Ultra::OutputRepeat(RepeatRegion *r, bool isSubRep) {
total_coverage += (r->sequenceStart + r->repeatLength) - rep_start;
}

if (r->sequenceStart + r->repeatLength > last_rep_end) {
last_rep_end = r->sequenceStart + r->repeatLength;
}

if (!settings->suppress_out)
for (auto writer : writers)
writer->WriteRepeat(r);
Expand Down
2 changes: 1 addition & 1 deletion src/ultra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Ultra {
bool firstRepeat = true;
unsigned long repeatBuffer = 2000;

unsigned long long total_coverage;
unsigned long long total_coverage = 0;
int last_read_id = 0;
unsigned long long last_rep_end = 0;

Expand Down

0 comments on commit d04547b

Please sign in to comment.