Skip to content

Commit

Permalink
Merge pull request #7 from mrc-ide/develop
Browse files Browse the repository at this point in the history
First draft of Tapestry including a basic IBD model and inference via PT-MCMC.
  • Loading branch information
JasonAHendry authored Aug 15, 2023
2 parents 13ebff4 + f47aef8 commit a8474c5
Show file tree
Hide file tree
Showing 429 changed files with 169,807 additions and 323 deletions.
5 changes: 0 additions & 5 deletions .Rbuildignore

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build-Test
on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Tapestry
uses: actions/checkout@v3

- name: Checkout HTSlib
uses: actions/checkout@v3
with:
submodules: true # HTSlib uses 'htscodecs' as a submodule
repository: samtools/htslib
path: htslib

- name: Build and install HTSlib
run: |
cd htslib
autoreconf -i
./configure --prefix ${{github.workspace}}/htslib
make
make install
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -DHTSLIB_DIR=${{ github.workspace }}/htslib

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} -VV

37 changes: 0 additions & 37 deletions .github/workflows/checks_develop.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/checks_master.yaml

This file was deleted.

32 changes: 27 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
ignore/
# macOS
.DS_Store

# VSCode
.vscode

# Compilation
release/
build/
!build/cmake/modules/*

# Python
__pycache__
notebooks
*.ipynb
*.ipynb_checkpoints
*.egg
*.egg-info

# Run outputs
results

# Personal
src/dev*
dev*
images/*.ai
TODO.txt
105 changes: 105 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# ================================================================================
# Project Informationn
#
# ===============================================================================

cmake_minimum_required(VERSION 3.14)
project(apropos VERSION 0.0
DESCRIPTION "Tapestry: Inference from complex P.f. infections"
LANGUAGES CXX
)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/cmake/modules/")

# Compilation flags
set(COMPILE_TESTS ON)


# ================================================================================
# Use C++17
#
# ================================================================================

set(CMAKE_CXX_STANDARD 17) # required for <filesystem>
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# ================================================================================
# Install GoogleTest
#
# ================================================================================

if (COMPILE_TESTS)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()

# ================================================================================
# Compile `tapestry`
#
# ================================================================================

# Target executable
set(TARGET tapestry)

# Source files
set(SOURCES
src/bed.cpp
src/betabin.cpp
src/combinatorics.cpp
src/data.cpp
src/ibd.cpp
src/io.cpp
src/mcmcs.cpp
src/model_compare.cpp
src/model_fitting.cpp
src/models.cpp
src/parameters.cpp
src/particle_writers.cpp
src/particles.cpp
src/proposals.cpp
src/sampling.cpp
src/vcf.cpp
)

# Add the executable
add_executable(${TARGET} src/main.cpp ${SOURCES})

# --------------------------------------------------------------------------------
# Link htslib
# --------------------------------------------------------------------------------

# Define htslib_FOUND, htslib_INCLUDE_DIRS, htslib_LIBRARIES
find_package(HTSlib 1.4 REQUIRED)

# Link include directories and library to the executable
target_include_directories(${TARGET} PUBLIC ${HTSlib_INCLUDE_DIRS})
target_link_libraries(${TARGET} PUBLIC ${HTSlib_LIBRARIES})


# ================================================================================
# Compile tests
#
# ================================================================================

if (COMPILE_TESTS)
enable_testing()
set(TSOURCES
tests/test_combinatorics.cpp
tests/test_particle.cpp
tests/test_random.cpp
)
add_executable(test_tapestry ${TSOURCES} ${SOURCES})

target_include_directories(test_tapestry PUBLIC ${HTSlib_INCLUDE_DIRS})
target_link_libraries(test_tapestry GTest::gtest_main ${HTSlib_LIBRARIES})

include(GoogleTest)
gtest_discover_tests(test_tapestry)
endif()
46 changes: 20 additions & 26 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
Package: Tapestry
Type: Package
Title: Software for deconvoluting unphased polyclonal genotypes
Version: 0.1.0
Authors@R: as.person(c(
"Jason Hendry <[email protected]> [aut, cre]",
"Bob Verity <[email protected]> [aut]"
))
Description: Malaria infections often contain multiple genotypes. When
sequenced together, these produce a complex signal that is a mixture of the
individual genotypes. Like earlier programs like DEploid, Tapestry
attempts to pull these individual genotypes apart by exploiting allele
frequency imbalances within a sample. The difference in Tapestry is that we
assume a model of allele frequencies rather than a reference panel. We also
implement parallel tempered MCMC to ensure good mixing, and produce a
different set of outputs.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
LinkingTo:
Rcpp
Imports:
Rcpp
SystemRequirements: C++11
BugReports: https://github.com/mrc-ide/tapestry/issues
Package: Tapestry
Type: Package
Title: Software for deconvoluting unphased polyclonal genotypes
Version: 0.1.0
Authors@R: as.person(c(
"Jason Hendry <[email protected]> [aut, cre]",
"Bob Verity <[email protected]> [aut]"
))
Description: Malaria infections often contain multiple genotypes, and when
sequenced together these produce a complex signal that is a mixture of the
individual genotypes. Building on the framework of earlier programs like
DEploid and DEploidIBD, Tapestry attempts to pull these individual genotypes
apart by exploiting allele frequency imbalances within a sample, while
simultaneously estimating segments of identity by descent (IBD) between
sequences. Unlike previous programs, Tapestry uses advanced MCMC methods to
ensure that results are robust even for high complexity of infection (COI).
License: MIT + file LICENSE
Encoding: UTF-8
SystemRequirements: C++17
BugReports: https://github.com/mrc-ide/tapestry/issues
5 changes: 0 additions & 5 deletions NAMESPACE

This file was deleted.

7 changes: 0 additions & 7 deletions R/RcppExports.R

This file was deleted.

28 changes: 0 additions & 28 deletions R/Tapestry.R

This file was deleted.

31 changes: 0 additions & 31 deletions R/main.R

This file was deleted.

Loading

0 comments on commit a8474c5

Please sign in to comment.