[med-svn] [Git][med-team/libbioparser-dev][upstream] New upstream version 3.0.13

Michael R. Crusoe gitlab at salsa.debian.org
Mon Mar 8 16:26:52 GMT 2021



Michael R. Crusoe pushed to branch upstream at Debian Med / libbioparser-dev


Commits:
e20f3084 by Michael R. Crusoe at 2021-03-08T17:10:31+01:00
New upstream version 3.0.13
- - - - -


10 changed files:

- .gitmodules
- .travis.yml
- CMakeLists.txt
- + Config.cmake.in
- README.md
- test/fasta_parser_test.cpp
- test/fastq_parser_test.cpp
- test/mhap_parser_test.cpp
- test/paf_parser_test.cpp
- test/sam_parser_test.cpp


Changes:

=====================================
.gitmodules
=====================================
@@ -1,4 +1,2 @@
 
-[submodule "vendor/biosoup"]
-	path = vendor/biosoup
-	url = https://github.com/rvaser/biosoup
+


=====================================
.travis.yml
=====================================
@@ -1,46 +1,39 @@
-dist: trusty
-
 language: cpp
 
 matrix:
   include:
-    - name: "GCC 4.8 (Linux)"  # GCC 4.8.5 & CMake 3.9.2
+    - name: "GCC 4.8 (Linux)"  # GCC 4.8.5 & CMake 3.12.4
       os: linux
+      dist: xenial
       addons:
         apt:
           sources:
             - ubuntu-toolchain-r-test
           packages:
             - g++-4.8
-            - cmake
       env:
         - SET_COMPILER="export CC=gcc-4.8 && export CXX=g++-4.8"
 
-    - name: "Clang 3.5 (Linux)"  # Clang 3.5.0 & CMake 3.9.2
+    - name: "Clang 3.5 (Linux)"  # Clang 3.5.2 & CMake 3.12.4
       os: linux
+      dist: xenial
       addons:
         apt:
-          sources:
-            - llvm-toolchain-trusty-3.5
           packages:
             - clang-3.5
-            - cmake
       env:
         - SET_COMPILER="export CC=clang-3.5 && export CXX=clang++-3.5"
 
-    - name: "Clang Xcode 9.0 (OSX)"  # Clang 9.0.0 & CMake 3.9.2
+    - name: "Clang Xcode 9.4 (OSX)"  # Clang 9.4.1 & CMake 3.15.5
       os: osx
-      osx_image: xcode9
+      osx_image: xcode9.4
 
 before_install:
   - eval "${SET_COMPILER}"
-  - git clone https://github.com/google/googletest && cd googletest && mkdir build && cd build && git checkout 703bd9c
-  - cmake -DCMAKE_CXX_FLAGS="-std=c++11" .. && make && sudo make install
-  - cd ../../
 
 install:
   - mkdir build && cd build
-  - cmake -Dbioparser_build_tests=ON -DCMAKE_BUILD_TYPE=Release .. && make
+  - cmake -DCMAKE_BUILD_TYPE=Release .. && make
 
 script:
   - ./bin/bioparser_test


=====================================
CMakeLists.txt
=====================================
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.9)
+cmake_minimum_required(VERSION 3.11)
 
-project(bioparser VERSION 3.0.12
+project(bioparser VERSION 3.0.13
                   LANGUAGES CXX
                   DESCRIPTION "Bioparser is a c++ header only parsing library for several formats in bioinformatics (FASTA/Q, MHAP/PAF/SAM), with support for zlib compressed files.")
 
@@ -13,31 +13,108 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
 
-find_package(ZLIB REQUIRED)
-add_library(${PROJECT_NAME} INTERFACE)
-target_link_libraries(${PROJECT_NAME} INTERFACE
-  ZLIB::ZLIB)
+if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+  set(bioparser_main_project ON)
+endif ()
+option(bioparser_install "Generate install target" ${bioparser_main_project})
+option(bioparser_build_tests "Build unit tests" ${bioparser_main_project})
 
-target_include_directories(${PROJECT_NAME} INTERFACE
-  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+find_package(ZLIB 1.2.8 REQUIRED)
 
-option(bioparser_build_tests "Build bioparser unit tests" OFF)
 if (bioparser_build_tests)
-  find_package(GTest REQUIRED)
-  if (NOT TARGET biosoup)
-    add_subdirectory(vendor/biosoup EXCLUDE_FROM_ALL)
+  find_package(biosoup 0.10.0 QUIET)
+  find_package(GTest 1.10.0 QUIET)
+
+  if (NOT biosoup_FOUND)
+    include(FetchContent)
+
+    FetchContent_Declare(
+      biosoup
+      GIT_REPOSITORY https://github.com/rvaser/biosoup
+      GIT_TAG 0.10.0)
+
+    FetchContent_GetProperties(biosoup)
+    if (NOT biosoup_POPULATED)
+      FetchContent_Populate(biosoup)
+      add_subdirectory(
+        ${biosoup_SOURCE_DIR}
+        ${biosoup_BINARY_DIR}
+        EXCLUDE_FROM_ALL)
+    endif ()
   endif ()
-  add_executable(${PROJECT_NAME}_test
+
+  if (NOT GTest_FOUND)
+    include(FetchContent)
+
+    FetchContent_Declare(
+      googletest
+      GIT_REPOSITORY https://github.com/google/googletest
+      GIT_TAG release-1.10.0)
+
+    FetchContent_GetProperties(googletest)
+    if (NOT googletest_POPULATED)
+      FetchContent_Populate(googletest)
+      add_subdirectory(
+        ${googletest_SOURCE_DIR}
+        ${googletest_BINARY_DIR}
+        EXCLUDE_FROM_ALL)
+      add_library(GTest::Main ALIAS gtest_main)
+    endif ()
+  endif ()
+endif ()
+
+add_library(bioparser INTERFACE)
+add_library(${PROJECT_NAME}::bioparser ALIAS bioparser)
+
+target_include_directories(bioparser INTERFACE
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+  $<INSTALL_INTERFACE:include>)
+
+target_link_libraries(bioparser INTERFACE
+  ZLIB::ZLIB)
+
+if (bioparser_install)
+  include(GNUInstallDirs)
+  include(CMakePackageConfigHelpers)
+
+  configure_package_config_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+    INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+  write_basic_package_version_file(
+    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+    COMPATIBILITY SameMajorVersion)
+
+  install(
+    TARGETS bioparser
+    EXPORT ${PROJECT_NAME}Targets)
+  install(
+    DIRECTORY include/bioparser
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+  install(
+    EXPORT ${PROJECT_NAME}Targets
+    NAMESPACE ${PROJECT_NAME}::
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+  install(
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+          ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+endif ()
+
+if (bioparser_build_tests)
+  add_executable(bioparser_test
     test/parser_test.cpp
     test/fasta_parser_test.cpp
     test/fastq_parser_test.cpp
     test/mhap_parser_test.cpp
     test/paf_parser_test.cpp
     test/sam_parser_test.cpp)
-  target_link_libraries(${PROJECT_NAME}_test
-    ${PROJECT_NAME}
-    biosoup
+
+  target_link_libraries(bioparser_test
+    bioparser
+    biosoup::biosoup
     GTest::Main)
-  target_compile_definitions(${PROJECT_NAME}_test PRIVATE
-    BIOPARSER_DATA_PATH="${PROJECT_SOURCE_DIR}/test/data/")
+
+  target_compile_definitions(bioparser_test
+    PRIVATE TEST_DATA="${PROJECT_SOURCE_DIR}/test/data/")
 endif ()


=====================================
Config.cmake.in
=====================================
@@ -0,0 +1,7 @@
+ at PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+find_dependency(ZLIB)
+
+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME at Targets.cmake")
+check_required_components("@PROJECT_NAME@")


=====================================
README.md
=====================================
@@ -3,28 +3,47 @@
 [![Latest GitHub release](https://img.shields.io/github/release/rvaser/bioparser.svg)](https://github.com/rvaser/bioparser/releases/latest)
 [![Build status for gcc/clang](https://travis-ci.com/rvaser/bioparser.svg?branch=master)](https://travis-ci.com/rvaser/bioparser)
 
-Bioparser is a c++ header only parsing library for several formats in bioinformatics (FASTA/Q, MHAP/PAF/SAM), with support for zlib compressed files.
+Bioparser is a c++ header only parsing library for several bioinformatics formats (FASTA/Q, MHAP/PAF/SAM), with support for zlib compressed files.
 
 ## Usage
 
-If you would like to add bioparser to your project via CMake, add the following:
+To build bioparser run the following commands:
+```bash
+git clone https://github.com/rvaser/bioparser && cd bioparser && mkdir build && cd build
+cmake -DCMAKE_BUILD_TYPE=Release .. && make
+```
+which will create install targets and unit tests. Running `make install` will create a package on your system that can be searched and linked with:
+```cmake
+find_package(bioparser)
+target_link_libraries(<target> bioparser::bioparser)
+```
+On the other hand, you can include bioparser as a submodule and add it to your project with the following:
 ```cmake
 if (NOT TARGET bioparser)
   add_subdirectory(<path_to_submodules>/bioparser EXCLUDE_FROM_ALL)
 endif ()
-target_link_libraries(<your_exe> bioparser)
+target_link_libraries(<target> bioparser::bioparser)
 ```
 
 If you are not using CMake, include the appropriate header file directly to your project and link with zlib.
 
+#### Build options
+
+- `bioparser_install`: generate install target
+- `bioparser_build_tests`: build unit tests
+
 #### Dependencies
-- gcc 4.8+ or clang 3.5+
-- (optional) cmake 3.9+
-- zlib
+- gcc 4.8+ | clang 3.5+
+- zlib 1.2.8+
+- (optional) cmake 3.11+
+
+###### Hidden
+- (bioparser_test) biosoup 0.10.0
+- (bioparser_test) googletest 1.10.0
 
 ## Examples
 
-### FASTA parser
+#### FASTA parser
 
 ```cpp
 #include "bioparser/fasta_parser.hpp"
@@ -43,7 +62,7 @@ auto p = bioparser::Parser<Sequence>::Create<bioparser::FastaParser>(path);
 auto s = p->Parse(-1);
 ```
 
-### FASTQ parser
+#### FASTQ parser
 
 ```cpp
 #include "bioparser/fastq_parser.hpp"
@@ -61,16 +80,19 @@ auto p = bioparser::Parser<Sequence>::Create<bioparser::FastqParser>(path);
 
 // parse in chunks
 std::vector<std::unique_ptr<Sequence>> s;
-std::uint32_t chunk_size = 500 * 1024 * 1024;  // 500 MB
-for (auto t = p->parse(chunk_size); !t.empty(); t = p->parse(chunk_size)) {
+while (true) {
+  auto c = p->Parse(1ULL << 30);  // 1 GB
+  if (c.empty()) {
+    break;
+  }
   s.insert(
       s.end(),
-      std::make_move_iterator(t.begin()),
-      std::make_move_iterator(t.end()));
+      std::make_move_iterator(c.begin()),
+      std::make_move_iterator(c.end()));
 }
 ```
 
-### MHAP parser
+#### MHAP parser
 
 ```cpp
 #include "bioparser/mhap_parser.hpp"
@@ -99,7 +121,7 @@ auto p = bioparser::Parser<Overlap>::Create<bioparser::MhapParser>(path);
 auto o = p->Parse(-1);
 ```
 
-### PAF parser
+#### PAF parser
 
 ```cpp
 #include "bioparser/paf_parser.hpp"
@@ -128,7 +150,7 @@ auto p = bioparser::Parser<Overlap>::Create<bioparser::PafParser>(path);
 auto o = p->Parse(-1);
 ```
 
-### SAM parser
+#### SAM parser
 
 ```cpp
 #include "bioparser/sam_parser.hpp"
@@ -166,20 +188,6 @@ friend bioparser::PafParser<Overlap>;
 friend bioparser::SamParser<Overlap>;
 ```
 
-## Unit tests
-
-To build and run bioparser unit tests run the following commands:
-
-```bash
-git clone --recursive https://github.com/rvaser/bioparser.git bioparser
-cd bioparser && mkdir build && cd build
-cmake -Dbioparser_build_tests=ON -DCMAKE_BUILD_TYPE=Release .. && make
-./bin/bioparser_test
-```
-
-#### Dependencies
-- gtest
-
 ## Acknowledgement
 
 This work has been supported in part by the Croatian Science Foundation under the project Single genome and metagenome assembly (IP-2018-01-5886).


=====================================
test/fasta_parser_test.cpp
=====================================
@@ -15,7 +15,7 @@ namespace test {
 class BioparserFastaTest: public ::testing::Test {
  public:
   void Setup(const std::string& file) {
-    p = Parser<biosoup::Sequence>::Create<FastaParser>(BIOPARSER_DATA_PATH + file);  // NOLINT
+    p = Parser<biosoup::Sequence>::Create<FastaParser>(TEST_DATA + file);
   }
 
   void Check(bool is_trimmed = true) {


=====================================
test/fastq_parser_test.cpp
=====================================
@@ -13,7 +13,7 @@ namespace test {
 class BioparserFastqTest: public ::testing::Test {
  public:
   void Setup(const std::string& file) {
-    p = Parser<biosoup::Sequence>::Create<FastqParser>(BIOPARSER_DATA_PATH + file);  // NOLINT
+    p = Parser<biosoup::Sequence>::Create<FastqParser>(TEST_DATA + file);
   }
 
   void Check() {


=====================================
test/mhap_parser_test.cpp
=====================================
@@ -43,7 +43,7 @@ struct MhapOverlap: public biosoup::Overlap {
 class BioparserMhapTest: public ::testing::Test {
  public:
   void Setup(const std::string& file) {
-    p = Parser<MhapOverlap>::Create<MhapParser>(BIOPARSER_DATA_PATH + file);
+    p = Parser<MhapOverlap>::Create<MhapParser>(TEST_DATA + file);
   }
 
   void Check() {


=====================================
test/paf_parser_test.cpp
=====================================
@@ -49,7 +49,7 @@ struct PafOverlap: public biosoup::Overlap {
 class BioparserPafTest: public ::testing::Test {
  public:
   void Setup(const std::string& file) {
-    p = Parser<PafOverlap>::Create<PafParser>(BIOPARSER_DATA_PATH + file);
+    p = Parser<PafOverlap>::Create<PafParser>(TEST_DATA + file);
   }
 
   void Check() {


=====================================
test/sam_parser_test.cpp
=====================================
@@ -54,7 +54,7 @@ struct SamOverlap: public biosoup::Overlap {
 class BioparserSamTest: public ::testing::Test {
  public:
   void Setup(const std::string& file) {
-    p = Parser<SamOverlap>::Create<SamParser>(BIOPARSER_DATA_PATH + file);
+    p = Parser<SamOverlap>::Create<SamParser>(TEST_DATA + file);
   }
 
   void Check() {



View it on GitLab: https://salsa.debian.org/med-team/libbioparser-dev/-/commit/e20f3084a5916994eaf3b1f784aff2f9584bc2e4

-- 
View it on GitLab: https://salsa.debian.org/med-team/libbioparser-dev/-/commit/e20f3084a5916994eaf3b1f784aff2f9584bc2e4
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210308/4b188431/attachment-0001.htm>


More information about the debian-med-commit mailing list