Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

20 changes: 8 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,16 @@
EXTRA_DIST = README.md LICENSE Configuration example.fq test

ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I $(top_srcdir)/src

### ADS: use AM_CXXFLAGS if these are needed
## AM_CXXFLAGS = -Wall -Wextra -Wpedantic -Wno-unknown-attributes

TESTS = test/falco.test
TEST_EXTENSIONS = .test

bin_PROGRAMS = falco

falco_CXXFLAGS = $(OPENMP_CXXFLAGS) $(AM_CXXFLAGS)
falco_CPPFLAGS = -DPROGRAM_PATH=\"$(abspath $(top_srcdir))\"
# ADS: fix the order of user and project set vars; shouldn't need to worry about
# setting CXXFLAGS in configure.ac
AM_CXXFLAGS = -Wall -Wextra -Wpedantic
if ENABLE_HTS
falco_CPPFLAGS += -DUSE_HTS
CPPFLAGS += -DUSE_HTS
endif

bin_PROGRAMS = falco

falco_SOURCES = \
src/falco.cpp \
src/FastqStats.cpp \
Expand All @@ -52,4 +46,6 @@ falco_SOURCES = \
src/smithlab_utils.hpp \
src/aux.hpp

TESTS = test/falco.test
TEST_EXTENSIONS = .test
CLEANFILES = tests_build/test_data.tgz
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ AS_IF([test "x$CXXFLAGS_set" != "xset"], [
])
AC_MSG_NOTICE([CXXFLAGS is $CXXFLAGS])

AC_DEFINE_UNQUOTED([PROGRAM_PATH], ["$srcdir"],
[The PROGRAM_PATH variable])

AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AC_OPENMP([C++]) dnl make sure we have openmp for multi-core in falco
dnl AC_OPENMP([C++]) dnl make sure we have openmp for multi-core in falco

dnl check for the Zlib library
AC_CHECK_LIB([z], [zlibVersion], [],
Expand Down
4 changes: 3 additions & 1 deletion src/FalcoConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "FastqStats.hpp"
#include "html_template.hpp"

#include "config.h"

#include <sys/stat.h>
#include <unistd.h>

Expand All @@ -25,7 +27,7 @@
#include <fstream>
#include <sstream>

const std::string FalcoConfig::FalcoVersion = "1.2.5";
const std::string FalcoConfig::FalcoVersion = VERSION;

/*********************************************************/
/************** DEFAULT VALUES FOR FILES *****************/
Expand Down
39 changes: 23 additions & 16 deletions src/HtmlMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@

#include "HtmlMaker.hpp"

#include "config.h"

#include <algorithm>
#include <chrono>
#include <fstream>
#include <sstream>
#include <regex>

void
HtmlMaker::put_data(const std::string &placeholder, const std::string &data) {
Expand All @@ -29,38 +32,42 @@ HtmlMaker::put_data(const std::string &placeholder, const std::string &data) {

// at least one placeholder found
while (pos != std::string::npos) {
html_boilerplate.replace(pos, placeholder.size(), data);
html_boilerplate.replace(pos, std::size(placeholder), data);
pos = html_boilerplate.find(placeholder, pos + 1);
}
}

// Comments out html pieces if analyses were skipped
void
HtmlMaker::put_comment(std::string &comment_begin, std::string &comment_end,
bool done) {
// put html comments if analysis was skipped
if (!done) {
const bool done) {
if (!done) { // put html comments if analysis was skipped
put_data(comment_begin, "<!--");
put_data(comment_end, "-->");
}

// otherwise delete placeholder
else {
else { // otherwise delete placeholder
put_data(comment_begin, "");
put_data(comment_end, "");
}
}

void
HtmlMaker::put_file_details(const FalcoConfig &falco_config) {
// Put file name in filename placeholder
put_data("{{filename}}", falco_config.filename_stripped);
using namespace std::string_literals;
static const auto left_tag = "\\{\\{"s;
static const auto right_tag = "\\}\\}"s;

// Put date on date placeholder
auto tmp =
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::string time_fmt = std::string(ctime(&tmp));
put_data("{{date}}", time_fmt);
}
std::regex filename_re(left_tag + "filename"s + right_tag);
std::regex_replace(html_boilerplate, filename_re,
falco_config.filename_stripped);

HtmlMaker::HtmlMaker() { html_boilerplate = FalcoConfig::html_template; }
using system_clock = std::chrono::system_clock;
auto time_unformatted = system_clock::to_time_t(system_clock::now());
std::string time_formatted = std::string(ctime(&time_unformatted));

std::regex date_re(left_tag + "date"s + right_tag);
std::regex_replace(html_boilerplate, date_re, time_formatted);

std::regex version_re(left_tag + "version"s + right_tag);
std::regex_replace(html_boilerplate, version_re, VERSION);
}
4 changes: 2 additions & 2 deletions src/HtmlMaker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
class HtmlMaker {
public:
std::string html_boilerplate;
HtmlMaker();
HtmlMaker() : html_boilerplate{FalcoConfig::html_template} {}
// Fill data from module
void put_data(const std::string &placeholder, const std::string &data);

// Comment or remove placeholders
void put_comment(std::string &comment_begin,
std::string &comment_end,
bool done);
const bool done);

// Put file details and date
void put_file_details(const FalcoConfig &falco_config);
Expand Down
54 changes: 0 additions & 54 deletions src/Makefile

This file was deleted.

25 changes: 12 additions & 13 deletions src/falco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@
* General Public License for more details.
*/

#include <chrono>
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>

#include "FalcoConfig.hpp"
#include "FastqStats.hpp"
#include "HtmlMaker.hpp"
#include "Module.hpp"

#include "OptionParser.hpp"
#include "StreamReader.hpp"
#include "smithlab_utils.hpp"

#include "config.h"

#include <chrono>
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>

// Function to get seconds elapsed in program
static std::size_t
get_seconds_since(
Expand Down Expand Up @@ -162,7 +166,7 @@ write_results(const FalcoConfig &falco_config, FastqStats &stats,
log_process("Writing text report to " + qc_data_file);

// put header
qc_data_txt << "##Falco\t" + FalcoConfig::FalcoVersion + "\n";
qc_data_txt << "##Falco\t" + std::string{VERSION} + "\n";
if (do_call)
qc_data_txt << "##Call\t" << falco_config.call << "\n";
}
Expand Down Expand Up @@ -262,17 +266,12 @@ write_results(const FalcoConfig &falco_config, FastqStats &stats,
html << html_maker.html_boilerplate;
}

[[nodiscard]] inline bool
file_exists(const std::string &file_name) {
return access(file_name.data(), F_OK) == 0;
}

int
main(int argc, char *argv[]) {

try {
static const std::string FALCO_VERSION =
"falco " + FalcoConfig::FalcoVersion;
"falco " + std::string{VERSION};
bool help = false;
bool version = false;

Expand Down Expand Up @@ -633,7 +632,7 @@ main(int argc, char *argv[]) {
// check if all filenames exist
bool all_files_exist = true;
for (std::size_t i = 0; i < std::size(all_seq_filenames); ++i) {
if (!file_exists(all_seq_filenames[i])) {
if (!std::filesystem::exists(all_seq_filenames[i])) {
std::cerr << "ERROR! File does not exist: " << all_seq_filenames[i]
<< '\n';
all_files_exist = false;
Expand Down
2 changes: 1 addition & 1 deletion src/html_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ p {


</div>
<div class="footer">Falco 1.2.5
<div class="footer">Falco {{version}}
</div>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
Expand Down
Loading