From cb8dca9359514c1569f57ccb988fb318f1ea8a48 Mon Sep 17 00:00:00 2001 From: Sam Horsfield Date: Tue, 26 Jan 2021 11:18:58 +0000 Subject: [PATCH] Corrects CMakeLists.txt for location of pthreads library. Also updates __main__.py, to opt-out of FMindexing rather than opt-in using --not-ref. Former-commit-id: 9519fa72f54fe359678cad1f21a204f7abb8d53f --- CMakeLists.txt | 28 ++++++++++++++++++---------- README.md | 8 ++++---- ggCaller/__init__.py | 2 +- ggCaller/__main__.py | 11 ++++++----- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fad63a7..9b587079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,26 +5,34 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconcepts -march=native") set(CMAKE_VERBOSE_MAKEFILE ON) -find_package(OpenMP) -find_library(pthread REQUIRED) -find_library(z REQUIRED) -find_library(bifrost REQUIRED) +# find pthreads +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +# find pybind and create python module find_package(pybind11 REQUIRED) pybind11_add_module(ggCaller_cpp src/call_ORFs.cpp src/ggCaller_bindings.cpp src/indexing.cpp src/match_string.cpp src/traversal.cpp src/unitigDict.cpp) +# check for conda environment IF( DEFINED ENV{CONDA_PREFIX} ) + # set conda directory SET(CONDA_DIR "$ENV{CONDA_PREFIX}") + # find Seqan3 packages find_path(SEQAN3_CLONE_DIR name bin PATHS ${CONDA_DIR} NO_DEFAULT_PATH) find_path(SEQAN3_INCLUDE_DIR name seqan PATHS "${SEQAN3_CLONE_DIR}/include" NO_DEFAULT_PATH) find_path(SEQAN3_SUBMODULES_DIR name submodules PATHS "${SEQAN3_INCLUDE_DIR}/seqan3" NO_DEFAULT_PATH) find_package(SeqAn3 REQUIRED HINT "${CONDA_PREFIX}/share/cmake/seqan3") + # link bifrost, zlib, seqan and pthreads + target_link_libraries(ggCaller_cpp PRIVATE seqan3::seqan3 ${CONDA_DIR}/lib/libbifrost.so ${CONDA_DIR}/lib/libz.so ${CONDA_DIR}/lib/libomp.so Threads::Threads) ELSE() + # find packages if conda not used find_package(SeqAn3 REQUIRED) -ENDIF() - -target_link_libraries(ggCaller_cpp PRIVATE seqan3::seqan3 pthread z bifrost) - -if(OpenMP_CXX_FOUND) + find_library(z REQUIRED) + find_library(bifrost REQUIRED) + find_package(OpenMP) + target_link_libraries(ggCaller_cpp PRIVATE seqan3::seqan3 bifrost z pthread) + # link OpenMP if found + if(OpenMP_CXX_FOUND) target_link_libraries(ggCaller_cpp PRIVATE OpenMP::OpenMP_CXX) -endif() \ No newline at end of file + endif() +ENDIF() \ No newline at end of file diff --git a/README.md b/README.md index 4b559683..1873c3fc 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ To run ggCaller using an existing Bifrost GFA file and Colours file, specify BOT - ```--graph ``` Input GFA - ```--colours ``` Input colours file -To enable filtering of artificially generated sequences via FMindexing (if sequences used to generate the GFA and Colours files were exclusively assembled genomes), additionally specify: -- ```--is-ref``` +To disable filtering of artificially generated sequences via FMindexing (if sequences used to generate the GFA and Colours files are not exclusively assembled genomes), additionally specify: +- ```--not-ref``` Note: Ensure the sequences used to build the graph are in the same directories as when the graph was built. @@ -92,11 +92,11 @@ argument. Bifrost uses kmer coverage filtering for read files to remove read err - Use existing graph which was built using assembled genomes only. -```ggcaller --graph graph.gfa --colours colours.bfg_colours --is-ref --out calls.fasta``` +```ggcaller --graph graph.gfa --colours colours.bfg_colours --out calls.fasta``` - Use existing graph which was built using reads or assembled genomes and reads. -```ggcaller --graph graph.gfa --colours colours.bfg_colours --out calls.fasta``` +```ggcaller --graph graph.gfa --colours colours.bfg_colours --not-ref --out calls.fasta``` Test data is available in the ```data``` directory. diff --git a/ggCaller/__init__.py b/ggCaller/__init__.py index 0d0b4136..b1d64524 100644 --- a/ggCaller/__init__.py +++ b/ggCaller/__init__.py @@ -2,4 +2,4 @@ '''ggCaller: a gene caller for Bifrost graphs''' -__version__ = '1.1.0' +__version__ = '1.1.1' diff --git a/ggCaller/__main__.py b/ggCaller/__main__.py index ad0a90f4..15e497a9 100644 --- a/ggCaller/__main__.py +++ b/ggCaller/__main__.py @@ -18,10 +18,11 @@ def get_options(): IO.add_argument('--colours', default=None, help='Bifrost colours file generated by Bifrost build. ') - IO.add_argument('--is-ref', - action="store_true", - default=False, - help='If using existing graph, was graph built with references or reads. ') + IO.add_argument('--not-ref', + action="store_false", + default=True, + help='If using existing graph, was not graph built exclusively with assembled genomes. ' + '[Default = False] ') IO.add_argument('--refs', default=None, help='List of reference genomes (one file path per line). ') @@ -73,7 +74,7 @@ def main(): # parse command line arguments graph_file = options.graph colours_file = options.colours - is_ref = bool(options.is_ref) + is_ref = bool(options.not_ref) refs_file = options.refs reads_file = options.reads codons = options.codons