-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
89 lines (74 loc) · 4.03 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
cmake_minimum_required(VERSION 2.8.12)
project(VerifyBamID)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fPIC -Wno-format-security")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fPIC -Wno-unused-variable -Wno-unused-result ")
add_compile_definitions("DEBUG=$<CONFIG:Debug>")
add_definitions(-D__STDC_LIMIT_MACROS)
add_definitions(-D__ZLIB_AVAILABLE__)
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()
find_library(CURLLIB curl HINTS /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib64/ /usr/local/lib/)
if (NOT CURLLIB)
message(FATAL_ERROR "libcurl library not found")
endif ()
find_library(ZLIB z HINTS /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib64/ /usr/local/lib/ /usr/local/Cellar/zlib/1.2.11/lib/)
if (NOT ZLIB)
message(FATAL_ERROR "libz library not found")
endif ()
find_path(HTS_INCLUDE_DIRS htslib/bgzf.h HINTS /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib64/ /usr/local/include/)
if (NOT HTS_INCLUDE_DIRS)
message(FATAL_ERROR "libhts HTS_INCLUDE_DIRS not found")
endif ()
find_library(HTS_LIBRARIES hts HINTS /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib64/ /usr/local/lib/)
if (NOT HTS_LIBRARIES)
message(FATAL_ERROR "libhts HTS_LIBRARIES not found")
endif ()
find_package(BZip2)
if (NOT BZIP2_FOUND)
message(FATAL_ERROR "libbz2 library not found")
else ()
include_directories(${BZIP2_INCLUDE_DIRS})
set(BZIP2 ${BZIP2_LIBRARIES})
endif ()
find_library(LZMA lzma HINTS /usr/lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib64/ /usr/local/lib/)
if(NOT LZMA)
message(WARNING "liblzma library not found, if you specified --disable-lzma when compiling libhts, please ignore this warning")
set(LZMA "")
else()
set(LZMA ${LZMA_LIBRARIES})
endif()
add_subdirectory(statgen)
set(LIBSTATGEN_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/statgen")
add_subdirectory(samtools)
add_subdirectory(libVcf)
set(SOURCE_FILES main.cpp SVDcalculator.cpp ContaminationEstimator.cpp MathGenMin.cpp MathGold.cpp Random.cpp SimplePileupViewer.cpp params.cpp )
include_directories(statgen ${HTS_INCLUDE_DIRS} samtools libVcf Eigen)
add_executable(VerifyBamID ${SOURCE_FILES})
target_link_libraries(VerifyBamID statgen Vcf ${HTS_LIBRARIES} samtools ${ZLIB} ${BZIP2} ${LZMA} ${CURLLIB})
enable_testing()
add_test(NAME myTest1
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND VerifyBamID --DisableSanityCheck --BamFile resource/test/test.bam --SVDPrefix resource/test/hapmap_3.3.b37.dat --Reference resource/test/chr20.fa.gz --NumPC 2)
add_test(NAME myTest2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND sh -c "diff resource/test/expected/result.Ancestry result.Ancestry && rm result.Ancestry result.selfSM")
add_test(NAME myTest3
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND VerifyBamID --DisableSanityCheck --PileupFile resource/test/expected/result.Pileup --SVDPrefix resource/test/hapmap_3.3.b37.dat --Reference resource/test/chr20.fa.gz --NumPC 2)
add_test(NAME myTest4
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND sh -c "diff resource/test/expected/result.Ancestry result.Ancestry && rm result.Ancestry result.selfSM")
add_test(NAME myTest5
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND VerifyBamID --DisableSanityCheck --PileupFile resource/test/test.LongRead.pileup --SVDPrefix resource/test/hapmap_3.3.b37.dat --Reference resource/test/chr20.fa.gz --NumPC 2)
add_test(NAME myTest6
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND sh -c "diff resource/test/expected/test.LongRead.pileup.Ancestry result.Ancestry && rm result.Ancestry result.selfSM")
#add_test( NAME myTestPlot
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
# COMMAND sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/run.plot.sh -i ${CMAKE_CURRENT_SOURCE_DIR}/resource/test/hapmap_3.3.b37.dat.V -o ${CMAKE_CURRENT_SOURCE_DIR}/resource/test/hapmap -r 1000g -g grey)