Skip to content

Commit 224e91b

Browse files
author
Andreas Grigorjew
committed
Compiles on Mac OS now and added edit distance in utils dir
1 parent 53b8a99 commit 224e91b

File tree

6 files changed

+72
-1
lines changed

6 files changed

+72
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
emerald
2+
cmake_install.cmake
3+
CMakeCache.txt
4+
Makefile
5+
CMakeFiles/

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.9)
2+
# Get project name from folder name
3+
get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
4+
string(REPLACE " " "_" ProjectId ${ProjectId})
5+
project(${ProjectId})
6+
set(CMAKE_CXX_STANDARD 17)
7+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
8+
# all .cpp files
9+
set(SOURCES src/main.cpp src/alpha_safe_paths.cpp src/optimal_paths.cpp src/safety_windows.cpp)
10+
add_executable(${ProjectId} ${SOURCES})
11+
# compiler flags for debugging
12+
if (APPLE)
13+
set(CMAKE_CXX_FLAGS "-O3 -openmp")
14+
else()
15+
set(CMAKE_CXX_FLAGS "-O3 -fopenmp")
16+
endif()
17+
18+
# GMP
19+
find_package(GMP REQUIRED)
20+
# if .h files are in other folder?
21+
include_directories(./ ${GMP_INCLUDE_DIR})
22+
target_link_libraries(${ProjectId} ${GMP_LIBRARY})
23+
# OpenMP
24+
#find_package(OpenMP REQUIRED)
25+
#target_link_libraries(${ProjectId} OpenMP::OpenMP_CXX)
26+
# runnable output file
27+
set_target_properties(${ProjectId} PROPERTIES OUTPUT_NAME "emerald")

FindGMP.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set(GMP_PREFIX "" CACHE PATH "path ")
2+
find_path(GMP_INCLUDE_DIR gmp.h gmpxx.h
3+
PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include )
4+
find_library(GMP_LIBRARY NAMES gmp libgmp
5+
PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)
6+
if(GMP_INCLUDE_DIR AND GMP_LIBRARY)
7+
get_filename_component(GMP_LIBRARY_DIR ${GMP_LIBRARY} PATH)
8+
set(GMP_FOUND TRUE)
9+
endif()
10+
if(GMP_FOUND)
11+
if(NOT GMP_FIND_QUIETLY)
12+
MESSAGE(STATUS "Found GMP: ${GMP_LIBRARY}")
13+
endif()
14+
elseif(GMP_FOUND)
15+
if(GMP_FIND_REQUIRED)
16+
message(FATAL_ERROR "Could not find GMP")
17+
endif()
18+
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ Run with $\alpha$ = 0.75 and $\Delta$ = 8.
3535
```
3636
Use edit distance with only optimal alignments and 100%-safety and multi threading:
3737
```
38-
./emerald -f example.fasta -a 1 -d 0 --costmat edit_distance.txt --gapcost 1 --startgap 0 --threads 8
38+
./emerald -f example.fasta -a 1 -d 0 --costmat utils/edit_distance.txt --gapcost 1 --startgap 0 --threads 8
3939
```

src/safety_windows.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <unordered_map>
12
#include <vector>
23
#include <gmpxx.h>
34

utils/edit_distance.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
0
2+
-1 0
3+
-1 -1 0
4+
-1 -1 -1 0
5+
-1 -1 -1 -1 0
6+
-1 -1 -1 -1 -1 0
7+
-1 -1 -1 -1 -1 -1 0
8+
-1 -1 -1 -1 -1 -1 -1 0
9+
-1 -1 -1 -1 -1 -1 -1 -1 0
10+
-1 -1 -1 -1 -1 -1 -1 -1 -1 0
11+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
12+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
13+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
14+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
15+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
16+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
17+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
18+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
19+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
20+
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0

0 commit comments

Comments
 (0)