Skip to content

Commit 74a8359

Browse files
Merge pull request #321 from smithlabcode/summary-analysis
Adding a commant to do multiple analysis that all process the same BAM file
2 parents 393b138 + ff8a23d commit 74a8359

File tree

14 files changed

+1382
-251
lines changed

14 files changed

+1382
-251
lines changed

.cppcheck_suppress

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,8 @@ unusedStructMember
3232
# Ignore missing includes because if they are real things won't build
3333
missingInclude
3434
# Exclude external files
35-
*:*CLI11.hpp
36-
*:*json.hpp
37-
*:*asio*
3835
*:*smithlab_cpp*
39-
*:*ssl.hpp
40-
*:*indicators.hpp
36+
*:*popcnt.hpp
4137
# Problem caused by external files
4238
toomanyconfigs
4339
# More problems caused by external files -- with too many ifdefs

CMakeLists.txt

Lines changed: 14 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#
55
# Authors: Andrew D. Smith
66
#
7-
# This is free software: you can redistribute it and/or modify it
8-
# under the terms of the GNU General Public License as published by
9-
# the Free Software Foundation, either version 3 of the License, or
10-
# (at your option) any later version.
7+
# This is free software: you can redistribute it and/or modify it under the
8+
# terms of the GNU General Public License as published by the Free Software
9+
# Foundation, either version 3 of the License, or (at your option) any later
10+
# version.
1111
#
12-
# This software is distributed in the hope that it will be useful, but
13-
# WITHOUT ANY WARRANTY; without even the implied warranty of
14-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15-
# General Public License for more details.
12+
# This software is distributed in the hope that it will be useful, but WITHOUT
13+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15+
# more details.
1616

1717
# to find the version of cmake do
1818
# $ cmake --version
@@ -41,96 +41,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
4141

4242
configure_file(data/config.h.in config.h)
4343

44-
# Collect any global linker options as needed and then apply them
45-
# individually to targets
46-
set(GLOBAL_COMPILE_OPTIONS "")
47-
set(GLOBAL_LINKER_OPTIONS "")
48-
49-
if(USE_STATIC_LIBS)
50-
# This needs to come before finding any libraries so that the static
51-
# versions are identified
52-
message(STATUS "Enabling static linkage for all non-system libraries")
53-
message(STATUS "Configuring to clone ZLib")
54-
include(ExternalProject)
55-
set(ZLIB_CMAKE_ARGS
56-
-DZLIB_BUILD_EXAMPLES=off
57-
-DSKIP_INSTALL_FILES=on
58-
-DCMAKE_POSITION_INDEPENDENT_CODE=on
59-
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/src/zlib
60-
-DCMAKE_BUILD_TYPE=Release
61-
)
62-
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
63-
list(APPEND ZLIB_CMAKE_ARGS
64-
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
65-
)
66-
endif()
67-
ExternalProject_Add(
68-
ZLIB
69-
GIT_REPOSITORY https://github.com/madler/zlib.git
70-
GIT_TAG master
71-
CMAKE_ARGS ${ZLIB_CMAKE_ARGS}
72-
)
73-
# Include the built zlib headers and link against the built zlib library
74-
set(ZLIB_INCLUDE_DIR "${PROJECT_BINARY_DIR}/src/zlib/include")
75-
set(ZLIB_LIBRARY "${PROJECT_BINARY_DIR}/src/zlib/lib/libz.a")
76-
77-
# Create the CMake target for the built zlib
78-
add_library(ZLIB_IMPORTED INTERFACE)
79-
set_target_properties(ZLIB_IMPORTED PROPERTIES
80-
INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}
81-
INTERFACE_LINK_LIBRARIES ${ZLIB_LIBRARY}
82-
)
83-
84-
# This alias means we don't need to worry where zlib came from
85-
add_library(ZLIB::ZLIB ALIAS ZLIB_IMPORTED)
86-
87-
ExternalProject_Add(
88-
HTSLIB
89-
GIT_REPOSITORY https://github.com/samtools/htslib.git
90-
GIT_TAG master
91-
CONFIGURE_COMMAND ""
92-
# "autoreconf -i <SOURCE_DIR>; <SOURCE_DIR>/configure"
93-
BUILD_COMMAND make -C <SOURCE_DIR> lib-static -j
94-
INSTALL_COMMAND ""
95-
# make install
96-
TEST_COMMAND ""
97-
BUILD_BYPRODUCTS libhts.a
98-
)
99-
# ExternalProject_Add_Step(HTSLIB
100-
# bootstrap
101-
# COMMAND autoreconf -i <SOURCE_DIR>
102-
# DEPENDEES download
103-
# DEPENDERS configure
104-
# )
105-
ExternalProject_Get_Property(HTSLIB SOURCE_DIR)
106-
message(STATUS "SOURCE_DIR: ${SOURCE_DIR}")
107-
108-
# Include the built zlib headers and link against the built zlib library
109-
set(HTSLIB_INCLUDE_DIR "${SOURCE_DIR}/src/htslib/htslib")
110-
set(HTSLIB_LIBRARY "${SOURCE_DIR}/htslib.a")
111-
112-
# Create the CMake target for the built zlib
113-
add_library(HTSLIB_IMPORTED INTERFACE)
114-
set_target_properties(HTSLIB_IMPORTED PROPERTIES
115-
INTERFACE_INCLUDE_DIRECTORIES ${HTSLIB_INCLUDE_DIR}
116-
INTERFACE_LINK_LIBRARIES ${HTSLIB_LIBRARY}
117-
)
118-
set_target_properties(HTSLIB_IMPORTED PROPERTIES IMPORTED_LOCATION ${HTSLIB_LIBRARY})
119-
120-
# This alias means we don't need to worry where htslib came from
121-
add_library(HTSLIB::HTSLIB ALIAS HTSLIB_IMPORTED)
122-
123-
# Set static for the linker so the compiler's libraries will be static
124-
## ADS: using this instead of forcing -static for everything avoids the
125-
## static linkage that Aiso warns against, but also means it's not 100%
126-
## static linked ADS: can't do this if the compiler is AppleClang because
127-
## they don't have the libc++.a and the libgcc wouldn't make sense anyway.
128-
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") # macOS
129-
list(APPEND GLOBAL_LINKER_OPTIONS -static-libgcc -static-libstdc++)
130-
endif()
131-
132-
endif()
133-
13444
if(ENABLE_LTO)
13545
# Turn on LTO if we are building for distribution
13646
include(CheckIPOSupported)
@@ -147,17 +57,12 @@ if(STATIC_ANALYSIS)
14757
endif()
14858

14959
# ADS: set the most stringent warnings we can
150-
list(APPEND GLOBAL_COMPILE_OPTIONS
151-
-Wall -Wextra -Wpedantic -Werror -Wfatal-errors
60+
add_compile_options(
61+
-Wall
62+
-Wextra
63+
-Wpedantic
64+
-Werror
65+
-Wfatal-errors
15266
)
15367

154-
if(STRIP_PATHS_FROM_BINARIES)
155-
# This is set if we have configured to distribute
156-
set(PREFIX_MAP_ARG -ffile-prefix-map=)
157-
list(TRANSFORM STRIP_SUB_LIST PREPEND ${PREFIX_MAP_ARG})
158-
list(APPEND GLOBAL_COMPILE_OPTIONS ${STRIP_SUB_LIST})
159-
endif()
160-
161-
message(STATUS "Finished global compile and linker configuration")
162-
16368
add_subdirectory(src)

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ dnmtools_SOURCES += src/analysis/levels.cpp
222222
dnmtools_SOURCES += src/analysis/hypermr.cpp
223223
dnmtools_SOURCES += src/analysis/metagene.cpp
224224
dnmtools_SOURCES += src/analysis/autocorr.cpp
225+
dnmtools_SOURCES += src/analysis/methsummary.cpp
225226

226227
dnmtools_SOURCES += src/utils/clean-hairpins.cpp
227228
dnmtools_SOURCES += src/utils/guessprotocol.cpp

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ target_link_libraries(dnmtools PUBLIC
4343
nanopore
4444
symmetric-cpgs
4545
levels
46+
methsummary
4647
hmr
4748
hmr-rep
4849
hypermr

src/amrfinder/amrtester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ find_first_epiread_ending_after_position(const string &query_chrom,
8989
backup_to_start_of_current_record(in);
9090

9191
// we've hit the end of file without finding an epiread
92-
if (low_pos == eof - 2)
92+
if (low_pos + 2 == static_cast<std::streamoff>(eof))
9393
return -1;
9494

9595
if (!(in >> chrom >> start >> seq)) {

src/analysis/levels.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ main_levels(int argc, char *argv[]) { // NOLINT(*-avoid-c-arrays)
121121
const std::string meth_file = leftover_args.front();
122122
/****************** END COMMAND LINE OPTIONS *****************/
123123

124+
if (relaxed_mode)
125+
MSite::no_extra_fields = false;
126+
124127
if (!is_msite_file(meth_file))
125128
throw std::runtime_error{"malformed counts file: " + meth_file};
126129

0 commit comments

Comments
 (0)