Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
aa2e7d2
src/abismal: Updating submodule
andrewdavidsmith Nov 29, 2025
209e01b
src/CMakeLists.txt: replacing all individual 'objects' with libraries…
andrewdavidsmith Nov 29, 2025
a3d9b6c
src/utils/CMakeLists.txt src/radmeth/CMakeLists.txt src/mlml/CMakeLis…
andrewdavidsmith Nov 29, 2025
2363a6d
src/common/nlohmann/json.hpp: adding the nlohmann json lib
andrewdavidsmith Nov 29, 2025
806edec
data/LICENSE: adding the nlohmann json lib
andrewdavidsmith Nov 29, 2025
7a7a36f
configure.ac: adding version check for htslib
andrewdavidsmith Nov 29, 2025
5d6619f
src/analysis/nanopore.cpp: moving to using the htslib functions for m…
andrewdavidsmith Nov 29, 2025
1dfc8d0
cmake/FindHTSLIB.cmake: fixing the way version numbers are parsed to …
andrewdavidsmith Nov 29, 2025
ea55710
multiple CMakeLists.txt: moving the find_package for htslib to the sr…
andrewdavidsmith Nov 29, 2025
cdfc313
multiple CMakeLists.txt: moving the find_package for htslib to the sr…
andrewdavidsmith Nov 29, 2025
42b5919
src/CMakeLists.txt: ensuring threads are obtained
andrewdavidsmith Nov 29, 2025
3c074d2
src/analysis/nanopore.cpp: fixing check for mods only at cpgs by cons…
andrewdavidsmith Dec 1, 2025
663ac60
src/analysis/nanopore.cpp: removing deadcode
andrewdavidsmith Dec 1, 2025
bebb47c
src/analysis/nanopore.cpp: fixing bug that iterated over rpos incorre…
andrewdavidsmith Dec 1, 2025
6cc713e
src/analysis/nanopore.cpp: added a function to check that h is the 1s…
andrewdavidsmith Dec 1, 2025
adfcdd7
src/analysis/nanopore.cpp: fixing a bug that counted the first read t…
andrewdavidsmith Dec 1, 2025
b881b20
src/common/bam_record_utils.hpp: fixing return type of get_n_targets …
andrewdavidsmith Dec 1, 2025
0f075fa
src/analysis/nanopore.cpp: using the get_n_targets function
andrewdavidsmith Dec 1, 2025
d91aa10
src/analysis/nanopore.cpp: fixing typo
andrewdavidsmith Dec 1, 2025
90c567f
src/radmeth/radmeth_lgamma.hpp: renaming the namespace to have dnmtoo…
andrewdavidsmith Dec 2, 2025
04376bd
src/radmeth/radmeth_lgamma.hpp to src/common/dnmtools_lgamma.hpp: to …
andrewdavidsmith Dec 2, 2025
adea4b4
src/radmeth/radmeth_optimize_gamma.cpp: using dnmtools_lgamma.hpp
andrewdavidsmith Dec 2, 2025
d8cb97d
.github/workflows/dnmtools_build_ubuntu.yml: trying to build with mos…
andrewdavidsmith Dec 3, 2025
864c36e
.github/workflows/dnmtools_build_ubuntu.yml: debugging
andrewdavidsmith Dec 3, 2025
e851860
.github/workflows/dnmtools_build_ubuntu.yml: more debugging
andrewdavidsmith Dec 3, 2025
d72c2a4
.github/workflows/dnmtools_build_ubuntu.yml: more debugging
andrewdavidsmith Dec 3, 2025
0ed26f1
.github/workflows/dnmtools_build_ubuntu.yml: more debugging
andrewdavidsmith Dec 3, 2025
4fea44b
.github/workflows/dnmtools_build_ubuntu.yml: more debugging
andrewdavidsmith Dec 4, 2025
82ff8e5
.github/workflows/dnmtools_build_ubuntu.yml: adding checks back
andrewdavidsmith Dec 4, 2025
07fa4f9
.github/workflows/dnmtools_distcheck_ubuntu.yml and .github/workflows…
andrewdavidsmith Dec 4, 2025
d4ef53f
Makefile.am: changes to reflect renaming of radmeth_lgamma.hpp to dnm…
andrewdavidsmith Dec 4, 2025
196c7a2
Makefile.am: adding another dependency for packaging
andrewdavidsmith Dec 4, 2025
8877af8
src/analysis/pmd.cpp: cleanup
andrewdavidsmith Dec 4, 2025
b49068e
.cppcheck_suppress: update header; not sure if it should be there
andrewdavidsmith Dec 5, 2025
e0e7beb
CPPLINT.cfg: update copyright
andrewdavidsmith Dec 5, 2025
cfbeca3
src/common/dnmtools_lgamma.hpp: fixing my name
andrewdavidsmith Dec 5, 2025
9d0288f
src/analysis/nanopore.cpp: tweak
andrewdavidsmith Dec 5, 2025
41efc92
src/analysis/nanopore.cpp src/dnmtools.cpp src/CMakeLists.txt configu…
andrewdavidsmith Dec 15, 2025
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
28 changes: 11 additions & 17 deletions .cppcheck_suppress
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# MIT License
# This file is part of dnmtools
#
# Copyright (c) 2024 Andrew Smith
# Copyright (C) 2023-2025 Andrew D. Smith
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# Authors: Andrew D. Smith
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This software is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.

missingIncludeSystem
constVariablePointer
Expand Down
36 changes: 32 additions & 4 deletions .github/workflows/dnmtools_build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,56 @@ jobs:
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get install -y libhts-dev libgsl-dev
run: |
sudo apt-get update
sudo apt-get install -y \
libgsl-dev \
libcurl4-gnutls-dev \
libdeflate-dev \
liblzma-dev \
zlib1g-dev \
libbz2-dev
- name: Build and install htslib (for recent version)
run: |
git clone --recursive https://github.com/samtools/htslib.git
cd htslib
make -j4
sudo make install prefix=/usr
- name: Generate configure script
run: ./autogen.sh
- name: Configure for GCC
run: ./configure CXX="g++"
- name: Build with g++
run: make -j4
- name: Test the g++ build
run: make -j4 check-TESTS
run: make -j4 check
build-with-clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get install -y libhts-dev libgsl-dev
run: |
sudo apt-get update
sudo apt-get install -y \
libgsl-dev \
libcurl4-gnutls-dev \
libdeflate-dev \
liblzma-dev \
zlib1g-dev \
libbz2-dev
- name: Build and install htslib (for recent version)
run: |
git clone --recursive https://github.com/samtools/htslib.git
cd htslib
make -j4
sudo make install prefix=/usr
- name: Generate configure script
run: ./autogen.sh
- name: Configure for Clang
run: ./configure CXX="clang++"
- name: Build with clang++
run: make -j4
- name: Test the clang++ build
run: make -j4 check-TESTS
run: make -j4 check
29 changes: 15 additions & 14 deletions .github/workflows/dnmtools_distcheck_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get version number
id: vn
run: |
awk '/AC_INIT/ {print "vn="$2}' configure.ac | sed "s/\[//; s/\]//; s/,//" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Update packages
run: sudo apt-get update
- name: Install dependencies
run: sudo apt-get install -y libhts-dev libgsl-dev samtools
run: |
sudo apt-get update
sudo apt-get install -y \
libgsl-dev \
libcurl4-gnutls-dev \
libdeflate-dev \
liblzma-dev \
zlib1g-dev \
libbz2-dev
- name: Build and install htslib (for recent version)
run: |
git clone --recursive https://github.com/samtools/htslib.git
cd htslib
make -j4
sudo make install prefix=/usr
- name: Generate configure script
run: ./autogen.sh
- name: configure
run: ./configure
- name: Generate the source archive
run: make dist
- name: Upload the archive
uses: actions/upload-artifact@v4
with:
name: dnmtools-${{ steps.vn.outputs.vn }}.tar.gz
path: dnmtools-${{ steps.vn.outputs.vn }}.tar.gz
- name: make distcheck
run: make -j4 distcheck
28 changes: 11 additions & 17 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# MIT License
# This file is part of dnmtools
#
# Copyright (c) 2025 Andrew Smith
# Copyright (C) 2023-2025 Andrew D. Smith
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# Authors: Andrew D. Smith
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This software is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
set noparent
filter=-runtime/references
filter=-build/include_subdir
Expand Down
15 changes: 12 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ ACLOCAL_AMFLAGS = -I m4

SUBDIRS := src/smithlab_cpp src/abismal
install installdirs: SUBDIRS := $(filter-out src/smithlab_cpp src/abismal, $(SUBDIRS))
AM_CPPFLAGS = -I $(top_srcdir)/src/common -I $(top_srcdir)/src/smithlab_cpp -I $(top_srcdir)/src/bamxx
AM_CPPFLAGS = \
-I $(top_srcdir)/src/common \
-I $(top_srcdir)/src/smithlab_cpp \
-I $(top_srcdir)/src/bamxx
if BUILD_NANOPORE
AM_CPPFLAGS += -DBUILD_NANOPORE
endif

AM_CXXFLAGS = -Wall -Wextra -Wpedantic -Wno-unknown-attributes

Expand Down Expand Up @@ -168,9 +174,9 @@ libdnmtools_a_SOURCES = \
src/common/dnmtools_utils.cpp

libdnmtools_a_SOURCES += \
src/common/dnmtools_lgamma.hpp \
src/common/Interval.hpp \
src/common/Interval6.hpp \
src/bamxx/bamxx.hpp \
src/common/dnmtools_gaussinv.hpp \
src/common/bam_record_utils.hpp \
src/common/counts_header.hpp \
Expand All @@ -190,14 +196,17 @@ libdnmtools_a_SOURCES += \
src/common/dnmtools_utils.hpp \
src/common/dnmt_error.hpp

libdnmtools_a_SOURCES += \
src/bamxx/bamxx.hpp \
src/common/nlohmann/json.hpp

# ADS: additional radmeth sources to help isolate the parts using GSL for
# optimization
libdnmtools_a_SOURCES += \
src/radmeth/radmeth_optimize_series.hpp \
src/radmeth/radmeth_optimize_gamma.hpp \
src/radmeth/radmeth_optimize_params.hpp \
src/radmeth/radmeth_model.hpp \
src/radmeth/radmeth_lgamma.hpp \
src/radmeth/radmeth_utils.hpp \
src/radmeth/radmeth_design.hpp

Expand Down
11 changes: 11 additions & 0 deletions cmake/FindHTSLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ if(HTSLIB_INCLUDE_DIR AND EXISTS "${HTSLIB_INCLUDE_DIR}/htslib/hts.h")
set(HTSLIB_VERSION_MINOR "")
set(HTSLIB_VERSION_PATCH "")
endif()

# Make sure the version numbers don't have leading zeros
# The minor version is encoded in such a way that it often will
foreach(part HTSLIB_VERSION_MAJOR HTSLIB_VERSION_MINOR HTSLIB_VERSION_PATCH)
if(${${part}} MATCHES "^[0]+$")
set(${part} "0")
else()
string(REGEX REPLACE "^0+" "" ${part} "${${part}}")
endif()
endforeach()

# Set canonical variables
set(HTSLIB_MAJOR_VERSION "${HTSLIB_VERSION_MAJOR}")
set(HTSLIB_MINOR_VERSION "${HTSLIB_VERSION_MINOR}")
Expand Down
40 changes: 40 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ AC_ARG_WITH([libdeflate],
[AS_HELP_STRING([--with-libdeflate], [use libdeflate for BAM output])],
[with_libdeflate=yes], [with_libdeflate=no])

dnl arg for building with mods support in 'counts'
AC_ARG_WITH([htsmods],
[AS_HELP_STRING([--with-htsmods], [use HTSLib 'mods' to support Nanopore])],
[with_htsmods=yes], [with_htsmods=no])

dnl check for required libraries
AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_FAILURE(["pthread library not found"])])
AC_SEARCH_LIBS([gzopen], [z], [], [AC_MSG_FAILURE(["Zlib library not found"])])
Expand All @@ -64,6 +69,41 @@ AS_IF([test "x$with_libdeflate" = "xyes"],
[AC_MSG_ERROR([--with-libdeflate specified but libdeflate not found])])
])
AC_SEARCH_LIBS([hts_version], [hts], [], [AC_MSG_FAILURE([$hts_fail_msg])])
AC_CHECK_HEADERS([htslib/hts.h], [], [AC_MSG_ERROR([hts.h not found])])
# Require HTS_VERSION >= 102000
AS_IF([test "x$with_htsmods" = "xyes"],
[
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([[
#include <htslib/hts.h>
#if !defined(HTS_VERSION)
# error HTS_VERSION not defined
#endif
#if HTS_VERSION < 102000
# error htslib library too old
#endif
]], [[]])
], [have_htsmods_version=yes], [have_htsmods_version=no])
],
[have_htsmods_version=yes]
)

AC_COMPUTE_INT(
[hts_version_macro],
[HTS_VERSION],
[#include <htslib/hts.h>],
[AC_MSG_ERROR([Could not compute HTS_VERSION])]
)
AC_MSG_NOTICE([Detected htslib version: $hts_version_macro])

AS_IF([test "x$have_htsmods_version" != "xyes"], [
AC_MSG_ERROR([
HTSLib version must be at least 102000 (v1.20) for mods support
])
])
AM_CONDITIONAL([BUILD_NANOPORE], [test "x$with_htsmods" = "xyes"])

AC_SEARCH_LIBS([cblas_dgemm], [gslcblas], [], [AC_MSG_FAILURE([$gsl_fail_msg])])
AC_SEARCH_LIBS([gsl_blas_dgemm], [gsl], [], [AC_MSG_FAILURE([$gsl_fail_msg])])

Expand Down
29 changes: 27 additions & 2 deletions data/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ details.
========================================================================

Additional licenses/copyrights that apply to DNMTools pre-built binaries,
which link statically to GSL (GNU Scientific Library), ZLib, HTSlib and
libdeflate.
which link statically to GSL (GNU Scientific Library), ZLib, HTSlib,
libdeflate and Niels Lohmann's JSON library.

========================================================================
GNU Scientific Library
Expand Down Expand Up @@ -125,3 +125,28 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

========================================================================
JSON

MIT License

Copyright (c) 2013-2025 Niels Lohmann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 14 additions & 39 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

if(NOT TARGET smithlab_cpp)
if(BUILD_NANOPORE)
find_package(HTSLIB 1.20 REQUIRED)
add_compile_definitions(BUILD_NANOPORE)
else()
find_package(HTSLIB REQUIRED)
endif()
find_package(Threads REQUIRED)

if(NOT TARGET bamxx)
add_subdirectory(bamxx)
endif()
if(NOT TARGET smithlab_cpp)
Expand All @@ -32,43 +40,10 @@ add_executable(dnmtools dnmtools.cpp)
target_include_directories(dnmtools PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(dnmtools PUBLIC
dnmtools_objs
smithlab_cpp
bamxx
abismal_objs
radmeth
format-reads
uniq
bsrate
methcounts
nanopore
symmetric-cpgs
levels
methsummary
hmr
hmr-rep
hypermr
methentropy
pmd
roimethstat
autocorr
cpgbins
multimethstat
mlml
methstates
allelicmeth
amrfinder
amrtester
fast-liftover
metagene
lift-filter
clean-hairpins
guessprotocol
merge-bsrate
merge-methcounts
covered
recovered
xcounts
unxcounts
selectsites
kmersites
dnmtools_analysis_objs
dnmtools_utils_objs
dnmtools_radmeth_objs
dnmtools_mlml_objs
dnmtools_amrfinder_objs
)
Loading