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
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ install installdirs: SUBDIRS := $(filter-out src/smithlab_cpp src/abismal, $(SUB
AM_CPPFLAGS = -I $(top_srcdir)/src/common -I $(top_srcdir)/src/smithlab_cpp -I $(top_srcdir)/src/bamxx

AM_CXXFLAGS = -Wall -Wextra -Wpedantic -Wno-unknown-attributes
CXXFLAGS += -O3 -DNDEBUG # default has optimization on

EXTRA_DIST = \
README.md \
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ AM_INIT_AUTOMAKE([subdir-objects foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG(C++)
AC_PROG_CXX

# Set CXXFLAGS only if the user hasn't set them
AS_IF([test "x$CXXFLAGS_set" != "xset"], [
CXXFLAGS="-O3 -DNDEBUG"
])
AC_MSG_NOTICE([CXXFLAGS is $CXXFLAGS])

AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AC_PROG_RANLIB

Expand Down
4 changes: 2 additions & 2 deletions data/md5sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ d41d8cd98f00b204e9800998ecf8427e tests/two_epialleles.amr
001b9d966f62fa439b24cf2198cc3de5 tests/reads.counts.sym
2b8a0406015458be51b8b1c9e58b3602 tests/tRex1_promoters.roi.bed
9bdb361091d1c0626df30be8ba2c408c tests/reads.sam
00ca55777ac7d9cd87823bdf293a3d7f tests/reads.fmt.sam
98a7f3ae4bb296c32b6751e326977c51 tests/reads.fmt.srt.uniq.sam
fa21ade51680ef2752768f02e32eb2e8 tests/reads.xcounts
14e8f72fde8d0f669b17da6cf4a908b6 tests/reads.unxcounts
dd6657967ff946ad4f194f1a29051f94 tests/reads.fmt.sam
5c8375a9f70163f5c89608147fe21693 tests/reads.fmt.srt.uniq.sam
2 changes: 1 addition & 1 deletion src/abismal
15 changes: 11 additions & 4 deletions src/common/bam_record_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,10 @@ revcomp_byte_then_reverse(unsigned char *const a, unsigned char *const b) {
*p1 = byte_revcomp_table[*p1];
}

/// Take an alignment in bam1_t format and reverse complement the sequence
/// directly by manipulating the bytes in the binary encoding.
static inline void
revcomp_seq_by_byte(bam1_t *const aln) {
revcomp_seq_by_byte_impl(bam1_t *const aln) {
const size_t l_qseq = get_l_qseq(aln);
auto seq = bam_get_seq(aln);
const size_t num_bytes = (l_qseq + 1) / 2; // integer ceil / 2
Expand All @@ -481,6 +483,11 @@ revcomp_seq_by_byte(bam1_t *const aln) {
}
}

void
revcomp_qseq(bam_rec &aln) {
revcomp_seq_by_byte_impl(aln.b);
}

// places seq of b at the end of seq of c
// assumes 0 < c_seq_len - b_seq_len <= a_seq_len
// also assumes that c_seq_len has been figured out
Expand Down Expand Up @@ -542,7 +549,7 @@ static inline void
flip_conversion(bam1_t *aln) {
aln->core.flag ^= BAM_FREVERSE; // ADS: flip the "reverse" bit

revcomp_seq_by_byte(aln);
revcomp_seq_by_byte_impl(aln);

// ADS: don't like *(cv + 1) below, but no HTSlib function for it?
auto cv = bam_aux_get(aln, "CV");
Expand Down Expand Up @@ -872,7 +879,7 @@ standardize_format(const string &input_format, bam1_t *aln) {

// reverse complement if needed
if (bam_is_rev(aln))
revcomp_seq_by_byte(aln);
revcomp_seq_by_byte_impl(aln);
}
else if (input_format == "bismark") {
// ADS: Previously we modified the read names at the first
Expand Down Expand Up @@ -904,7 +911,7 @@ standardize_format(const string &input_format, bam1_t *aln) {
throw dnmt_error(err_code, "bam_aux_append");

if (bam_is_rev(aln))
revcomp_seq_by_byte(aln); // reverse complement if needed
revcomp_seq_by_byte_impl(aln); // reverse complement if needed
}
// ADS: the condition below should be checked much earlier, ideally
// before the output file is created
Expand Down
3 changes: 3 additions & 0 deletions src/common/bam_record_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,7 @@ rlen_from_cigar(const bamxx::bam_rec &aln) {
return bam_cigar2rlen(get_n_cigar(aln), bam_get_cigar(aln));
}

void
revcomp_qseq(bamxx::bam_rec &aln);

#endif
13 changes: 7 additions & 6 deletions src/common/dnmtools_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@

#include "dnmtools_utils.hpp"

#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>

using std::string;
using std::copy;
using std::ostringstream;
using std::ostream_iterator;
using std::ostringstream;
using std::string;

auto
get_command_line(const int argc, const char **const argv) -> string {
if (argc == 0) return string();
get_command_line(const int argc, char *argv[]) -> std::string {
if (argc == 0)
return std::string{};
std::ostringstream cmd;
cmd << '"';
copy(argv, argv + (argc - 1), ostream_iterator<const char *>(cmd, " "));
Expand Down
2 changes: 1 addition & 1 deletion src/common/dnmtools_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#include <string>

auto
get_command_line(const int argc, const char **const argv) -> std::string;
get_command_line(const int argc, char *argv[]) -> std::string;

#endif
Loading