Skip to content

Commit a38143d

Browse files
authored
Merge pull request #384 from pachterlab/devel
merging from devel
2 parents 83bde90 + 94e00d9 commit a38143d

File tree

846 files changed

+186112
-6013
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

846 files changed

+186112
-6013
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ release/
2020
.vscode/
2121
ext/htslib/src/htslib-stamp
2222
ext/htslib/tmp/
23+
ext/bifrost/tmp/
24+
ext/bifrost/build/
25+
ext/bifrost/src/bifrost-stamp/
2326
.snakemake
27+
*.swp
28+
*.swo
29+
30+
ext/zlib-ng/src/
31+
ext/zlib-ng/build/
32+
ext/zlib-ng/tmp/
33+
src/.Rhistory

CMakeLists.txt

+44-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
cmake_minimum_required(VERSION 2.8.12)
1+
cmake_minimum_required(VERSION 3.0.0)
22

33
project(kallisto)
44

55
include(GNUInstallDirs)
66

77

88
option(USE_HDF5 "Compile with HDF5 support" OFF) #OFF by default
9+
option(USE_BAM "Compile with HTSLIB support" OFF) # OFF by default
910

1011
if(USE_HDF5)
1112
add_compile_definitions("USE_HDF5=ON")
1213
endif(USE_HDF5)
1314

15+
if(NOT USE_BAM)
16+
add_compile_definitions("NO_HTSLIB=ON")
17+
endif()
18+
1419
set(EXT_PROJECTS_DIR ${PROJECT_SOURCE_DIR}/ext)
1520
set(CMAKE_CXX_FLAGS_PROFILE "-g")
1621

@@ -28,12 +33,20 @@ if(${CMAKE_VERSION} VERSION_LESS 3.1)
2833
# remove this block once CMake >=3.1 has fixated in the ecosystem
2934
add_compile_options(-std=c++11)
3035
else()
36+
include(CheckCXXCompilerFlag)
37+
check_cxx_compiler_flag(-std=c++17 COMPILER_SUPPORTS_CXX17)
38+
if(COMPILER_SUPPORTS_CXX17)
39+
set(CMAKE_CXX_STANDARD 17)
40+
else()
3141
set(CMAKE_CXX_STANDARD 11)
42+
endif()
3243
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3344
set(CMAKE_CXX_EXTENSIONS OFF)
3445
endif()
3546

3647
#add_compile_options(-Wall -Wno-unused-function)
48+
add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
49+
set(PROJECT_BIFROST_CMAKE_CXX_FLAGS "-Wno-subobject-linkage -Wno-return-type") # Suppress bifrost warning
3750

3851
if(LINK MATCHES static)
3952
message("static build")
@@ -43,17 +56,46 @@ ENDIF(LINK MATCHES static)
4356

4457

4558
include(ExternalProject)
59+
if (USE_BAM)
4660
ExternalProject_Add(htslib
4761
PREFIX ${PROJECT_SOURCE_DIR}/ext/htslib
4862
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/htslib
4963
BUILD_IN_SOURCE 1
50-
CONFIGURE_COMMAND autoheader && autoconf && ${PROJECT_SOURCE_DIR}/ext/htslib/configure
64+
CONFIGURE_COMMAND autoreconf -i && autoheader && autoconf && ${PROJECT_SOURCE_DIR}/ext/htslib/configure
5165
--prefix=${PREFIX} --disable-bz2 --disable-lzma --disable-libcurl
5266
BUILD_COMMAND make lib-static
5367
INSTALL_COMMAND ""
5468
)
69+
endif(USE_BAM)
70+
71+
ExternalProject_Add(bifrost
72+
PREFIX ${PROJECT_SOURCE_DIR}/ext/bifrost
73+
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/bifrost
74+
BUILD_IN_SOURCE 1
75+
CONFIGURE_COMMAND mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_CXX_FLAGS=${PROJECT_BIFROST_CMAKE_CXX_FLAGS}
76+
BUILD_COMMAND cd build && make
77+
INSTALL_COMMAND ""
78+
)
5579

80+
if (ZLIBNG)
81+
message("zlib-ng enabled.")
82+
ExternalProject_Add(zlib-ng
83+
PREFIX ${PROJECT_SOURCE_DIR}/ext/zlib-ng
84+
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/zlib-ng
85+
BUILD_IN_SOURCE 1
86+
CONFIGURE_COMMAND mkdir -p zlib-ng && cd zlib-ng && cmake .. -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${PREFIX}
87+
BUILD_COMMAND cd zlib-ng && make
88+
INSTALL_COMMAND ""
89+
)
90+
endif(ZLIBNG)
91+
92+
if (USE_BAM)
5693
include_directories(${htslib_PREFIX}/src/htslib)
94+
endif(USE_BAM)
95+
include_directories(${EXT_PROJECTS_DIR}/bifrost/build/src)
96+
97+
ExternalProject_Get_Property(bifrost install_dir)
98+
include_directories(${install_dir}/src)
5799

58100

59101

ext/bifrost/.gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
6+
# Compiled Dynamic libraries
7+
*.so
8+
9+
# Compiled Static libraries
10+
*.lai
11+
*.la
12+
*.a
13+
14+
# From SWIG
15+
*_wrap.cxx
16+
graph.py
17+
18+
# Other
19+
*.pyc
20+
*.dot
21+
*.contigs
22+
*.graph
23+
*.txt
24+
*.out
25+
*.swp
26+
*.bf
27+
*~
28+
\#*
29+
.\#*
30+
build/
31+
CB_Project/
32+
old/
33+
dist/
34+
debug/
35+
*.dSYM/*
36+
prof
37+
BFGraph
38+
Naive
39+
data/
40+
core
41+
man/
42+
example/output/

ext/bifrost/.gitmodules

Whitespace-only changes.

ext/bifrost/CMakeLists.txt

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
cmake_minimum_required(VERSION 3.0.0)
2+
3+
project(Bifrost)
4+
5+
find_package(Threads REQUIRED)
6+
7+
# To enable a larger default k-mer size, replace MAX_KMER_SIZE with a larger multiple of 32: actual maximum k-mer size will be MAX_KMER_SIZE-1.
8+
SET(MAX_KMER_SIZE "32" CACHE STRING "MAX_KMER_SIZE")
9+
SET(MAX_GMER_SIZE "${MAX_KMER_SIZE}" CACHE STRING "MAX_GMER_SIZE")
10+
# Enable architecture optimizations
11+
SET(COMPILATION_ARCH "native" CACHE STRING "COMPILATION_ARCH")
12+
# Enable AVX2 instructions
13+
SET(ENABLE_AVX2 "ON" CACHE STRING "ENABLE_AVX2")
14+
15+
# Set some default compile flags
16+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
18+
19+
set_property(SOURCE BlockedBloomFilter.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -funroll-loops")
20+
21+
22+
#check if we are on arm64 and apple, if so, disable AVX2
23+
if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
24+
message("Disabling AVX2 instructions on arm64")
25+
set(ENABLE_AVX2 "OFF")
26+
set(COMPILATION_ARCH "OFF")
27+
endif(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
28+
29+
if(COMPILATION_ARCH MATCHES "OFF")
30+
message("Disabling native architecture compilation (including AVX2)")
31+
else(COMPILATION_ARCH MATCHES "OFF")
32+
message("Compilation architecture: ${COMPILATION_ARCH}")
33+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${COMPILATION_ARCH}")
34+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${COMPILATION_ARCH}")
35+
endif(COMPILATION_ARCH MATCHES "OFF")
36+
37+
if(ENABLE_AVX2 MATCHES "OFF")
38+
message("Disabling AVX2 instructions")
39+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-avx2")
40+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-avx2")
41+
endif(ENABLE_AVX2 MATCHES "OFF")
42+
43+
# Manages build types
44+
if(NOT CMAKE_BUILD_TYPE)
45+
set(CMAKE_BUILD_TYPE "Release")
46+
endif(NOT CMAKE_BUILD_TYPE)
47+
48+
if(CMAKE_BUILD_TYPE MATCHES Debug)
49+
message("Build type: Debug")
50+
add_compile_options(-g)
51+
else(CMAKE_BUILD_TYPE MATCHES Debug)
52+
if(CMAKE_BUILD_TYPE MATCHES Profile)
53+
message("Build type: Profiling")
54+
add_compile_options(-pg)
55+
set(CMAKE_SHARED_LINKER_FLAGS "-pg")
56+
set(CMAKE_EXE_LINKER_FLAGS "-pg")
57+
else(CMAKE_BUILD_TYPE MATCHES Profile)
58+
message("Build type: Release")
59+
add_compile_options(-O3)
60+
endif(CMAKE_BUILD_TYPE MATCHES Profile)
61+
endif(CMAKE_BUILD_TYPE MATCHES Debug)
62+
63+
MATH(EXPR PRINT_MAX_KMER_SIZE "${MAX_KMER_SIZE}-1")
64+
message("Maximum k-mer size: " ${PRINT_MAX_KMER_SIZE})
65+
66+
MATH(EXPR PRINT_MAX_GMER_SIZE "${MAX_GMER_SIZE}-1")
67+
message("Maximum g-mer size: " ${PRINT_MAX_GMER_SIZE})
68+
69+
add_subdirectory(src)

ext/bifrost/Changelog.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
### Changelog
2+
3+
API only.
4+
5+
* **15-06-2022**
6+
* Function `CompactedDBG()::write()` takes additional arguments with default values:
7+
* `compress_output` indicates whether the output should be compressed
8+
* `write_index_file` indicates whether an index file should be generated to enable faster graph loading
9+
* `GFA_output`, `FASTA_output` and `BFG_output` to select the output file format (previously, setting `outputGFA` set to false would automatically make `write()` output the graph in FASTA format).
10+
11+
Beware that the new arguments come with default values which could override the default values of the previous versions of `write()`, e.g, the default value of parameter `FASTA_output` (`write()` with 8 parameters) could be used as the default value of parameter `verbose` if your code is not updated (`write()` with 5 parameters).
12+
* There exists two versions of `CompactedDBG::read()` and `ColoredCDBG::read()`, the "usual" (slower) graph reading function and the same function with an additional index graph file as input. Using the index graph file as input considerably speeds-up the graph loading in memory. The "usual" graph reading function will automatically use the graph index file if available.
13+
* **04-28-2022**
14+
* Color files generated prior to version 1.0.6.2 are **not** compatible with version 1.0.6.2 and onward.
15+
* `CompactedDBG::simplify()` and `ColoredCDBG::simplify()` now return true even if no simplification was performed ("null-simplification" in case all input parameters are set to false). The goal is to only return false if the graph is invalid or in case of unexpected behavior.
16+
* **08-29-2018**
17+
* `UnitigColors::const_iterator` only considers now the k-mer positions of the unitig mapping provided in the `UnitigMap`/`UnitigColorMap` parameter of `UnitigColors::begin()`.
18+
* **08-28-2018**
19+
* Functions `CDBG_Data_t::serialize()` and `CCDBG_Data_t::serialize()` have now one parameter which is a `const_UnitigMap`/`const_UnitigColorMap` reference representing the (reference) unitig to which the data are associated to.
20+
* **08-23-2018**
21+
* Function `UnitigMap::toString()` was ambiguous as if it would generate the string of the mapped sequence or the string of the reference unitig used in the mapping. It has been replaced by two functions: `UnitigMap::mappedSequenceToString()` and `UnitigMap::referenceUnitigToString()`.
22+
* **08-07-2018**
23+
* Add de Bruijn graphs merging functions (`CompactedDBG::merge()` and `ColoredCDBG::merge()`) and addition assignment operators (`CompactedDBG::operator+=()` and `ColoredCDBG::operator+=()`, same as `merge()` but uses only one thread).
24+
* Add de Bruijn graphs comparison functions `CompactedDBG::operator==()`, `CompactedDBG::operator!=()`, `ColoredCDBG::operator==()` and `ColoredCDBG::operator!=()`.
25+
* Delete `CompactedDBG::empty()` and `ColoredCDBG::empty()` to be consistent with STD containers (those functions were emptying the graph of its content while `empty()` of STD containers returns whether the container is empty). Now, to empty the graph, use `CompactedDBG::clear()` and `ColoredCDBG::clear()`.
26+
* Major changes in the abstract class `CDBG_Data_t` and `CCDBG_Data_t`:
27+
* All the functions are now **non**-static.
28+
* Function `join()` is renamed `concat()` and works a bit differently (have a look at the doc). Quickly, `join()` was concatenating two unitigs A and B such that the result was A=AB and B was deleted from the graph. Now, `concat()` deletes A and B from the graph and adds a new unitig C=AB.
29+
* Function `sub()` is renamed `extract()`.
30+
* Add the functions `merge()` and `clear()` which **must** be overloaded too in the derived class of `CDBG_Data_t` and `CCDBG_Data_t`.

0 commit comments

Comments
 (0)