[med-svn] [Git][med-team/rampler][upstream] New upstream version 2.1.1

Andreas Tille (@tille) gitlab at salsa.debian.org
Fri Nov 25 13:47:44 GMT 2022



Andreas Tille pushed to branch upstream at Debian Med / rampler


Commits:
e306dd21 by Andreas Tille at 2022-11-25T12:08:17+01:00
New upstream version 2.1.1
- - - - -


6 changed files:

- + .github/workflows/rampler.yml
- − .travis.yml
- CMakeLists.txt
- src/main.cpp
- src/sampler.cpp
- src/sampler.hpp


Changes:

=====================================
.github/workflows/rampler.yml
=====================================
@@ -0,0 +1,52 @@
+name: rampler CI
+
+on:
+  push:
+  pull_request:
+    branches:
+      - master
+
+env:
+  BUILD_TYPE: Release
+
+jobs:
+  test:
+    strategy:
+      matrix:
+        compiler:
+          - g++
+          - g++-4.8
+          - clang++
+          - clang++-4.0
+
+    runs-on: ubuntu-18.04
+
+    steps:
+      - uses: actions/checkout at v2
+
+      - if: ${{ matrix.compiler == 'g++-4.8' }}
+        name: Setup GCC
+        uses: egor-tensin/setup-gcc at v1
+        with:
+          version: "4.8"
+          platform: x64
+
+      - if: ${{ matrix.compiler == 'clang++-4.0' }}
+        name: Setup Clang
+        uses: egor-tensin/setup-clang at v1
+        with:
+          version: "4.0"
+          platform: x64
+
+      - name: Configure CMake
+        run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
+        env:
+          CXX: ${{ matrix.compiler }}
+
+      - name: Build
+        run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }}
+
+      - name: Test
+        working-directory: ${{ github.workspace }}/build
+        run: |
+          bin/rampler --version


=====================================
.travis.yml deleted
=====================================
@@ -1,47 +0,0 @@
-dist: trusty
-
-language: cpp
-
-matrix:
-  include:
-    - name: "GCC 4.8 (Linux)"  # GCC 4.8.5 & CMake 3.9.2
-      os: linux
-      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 4.0 (Linux)"  # Clang 4.0 & CMake 3.9.2
-      os: linux
-      addons:
-        apt:
-          sources:
-            - llvm-toolchain-trusty-4.0
-          packages:
-            - clang-4.0
-            - cmake
-      env:
-        - SET_COMPILER="export CC=clang-4.0 && export CXX=clang++-4.0"
-
-    - name: "Clang Xcode 9.0 (OSX)"  # Clang 9.0.0 & CMake 3.9.2
-      os: osx
-      osx_image: xcode9
-
-before_install:
-  - eval "${SET_COMPILER}"
-
-install:
-  - mkdir build && cd build
-  - cmake -DCMAKE_BUILD_TYPE=Release .. && make
-
-script:
-  - ./bin/rampler --version
-
-notifications:
-  email:
-    on_failure: always


=====================================
CMakeLists.txt
=====================================
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.9)
+cmake_minimum_required(VERSION 3.11)
 
-project(rampler VERSION 2.0.0
+project(rampler VERSION 2.1.1
                 LANGUAGES CXX
                 DESCRIPTION "Rampler is a tool for subsampling or splitting FASTA/Q files.")
 
@@ -13,21 +13,51 @@ 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)
 
-if (NOT TARGET bioparser)
-  add_subdirectory(vendor/bioparser EXCLUDE_FROM_ALL)
+include(FetchContent)
+include(GNUInstallDirs)
+
+find_package(bioparser 3.0.15 QUIET)
+if (NOT bioparser_FOUND)
+  FetchContent_Declare(
+    bioparser
+    GIT_REPOSITORY https://github.com/rvaser/bioparser
+    GIT_TAG 3.0.15)
+
+  FetchContent_GetProperties(bioparser)
+  if (NOT bioparser_POPULATED)
+    FetchContent_Populate(bioparser)
+    add_subdirectory(
+      ${bioparser_SOURCE_DIR}
+      ${bioparser_BINARY_DIR}
+      EXCLUDE_FROM_ALL)
+  endif ()
 endif ()
-if (NOT TARGET biosoup)
-  add_subdirectory(vendor/bioparser/vendor/biosoup EXCLUDE_FROM_ALL)
+
+find_package(biosoup 0.10.0 QUIET)
+if (NOT biosoup_FOUND)
+  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}
+add_executable(rampler
   src/main.cpp
   src/sampler.cpp)
-target_link_libraries(${PROJECT_NAME}
-  bioparser
-  biosoup)
-target_compile_definitions(${PROJECT_NAME} PRIVATE
-  RAMPLER_VERSION="v${PROJECT_VERSION}")
 
-include(GNUInstallDirs)
-install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
+target_link_libraries(rampler
+  bioparser::bioparser
+  biosoup::biosoup)
+
+target_compile_definitions(rampler PRIVATE VERSION="${PROJECT_VERSION}")
+
+install(TARGETS rampler DESTINATION ${CMAKE_INSTALL_BINDIR})


=====================================
src/main.cpp
=====================================
@@ -13,8 +13,6 @@ std::atomic<std::uint32_t> biosoup::Sequence::num_objects{0};
 
 namespace {
 
-static const char* rampler_version = RAMPLER_VERSION;
-
 static struct option options[] = {
   {"out-directory", required_argument, nullptr, 'o'},
   {"version", no_argument, nullptr, 'v'},
@@ -33,11 +31,11 @@ std::unique_ptr<bioparser::Parser<biosoup::Sequence>> CreateParser(
   *name = (c == std::string::npos ? path : path.substr(c + 1));
 
   c = name->find('.');
-  *ext = (c == std::string::npos ? "" : name->substr(c, name->find('.', c + 1) - c));  // NOLINT
   *name = (c == std::string::npos ? *name : name->substr(0, c));
 
   if (is_suffix(path, ".fasta")    || is_suffix(path, ".fa") ||
       is_suffix(path, ".fasta.gz") || is_suffix(path, ".fa.gz")) {
+    *ext = ".fasta";
     try {
       return bioparser::Parser<biosoup::Sequence>::Create<bioparser::FastaParser>(path);  // NOLINT
     } catch (const std::invalid_argument& exception) {
@@ -47,6 +45,7 @@ std::unique_ptr<bioparser::Parser<biosoup::Sequence>> CreateParser(
   }
   if (is_suffix(path, ".fastq")    || is_suffix(path, ".fq") ||
       is_suffix(path, ".fastq.gz") || is_suffix(path, ".fq.gz")) {
+    *ext = ".fastq";
     try {
       return bioparser::Parser<biosoup::Sequence>::Create<bioparser::FastqParser>(path);  // NOLINT
     } catch (const std::invalid_argument& exception) {
@@ -103,7 +102,7 @@ int main(int argc, char** argv) {
   while ((arg = getopt_long(argc, argv, "o:h", options, nullptr)) != -1) {
     switch (arg) {
       case 'o': out_directory = optarg; break;
-      case 'v': std::cerr << rampler_version << std::endl; return 0;
+      case 'v': std::cerr << VERSION << std::endl; return 0;
       case 'h': Help(); return 0;
       default: return 1;
     }
@@ -149,14 +148,14 @@ int main(int argc, char** argv) {
   sampler.Initialize();
 
   if (split) {
-    sampler.Split(out_directory, atoi(input_parameters[2].c_str()));
+    sampler.Split(out_directory, std::atoll(input_parameters[2].c_str()));
   } else if (subsample) {
-    std::uint32_t reference_length = atoi(input_parameters[2].c_str());
+    std::uint64_t reference_length = std::atoll(input_parameters[2].c_str());
     for (std::uint32_t i = 3; i < input_parameters.size(); ++i) {
       sampler.Subsample(
           out_directory,
           reference_length,
-          atoi(input_parameters[i].c_str()));
+          std::atoll(input_parameters[i].c_str()));
     }
   }
 


=====================================
src/sampler.cpp
=====================================
@@ -10,8 +10,6 @@
 
 namespace rampler {
 
-constexpr uint32_t kChunkSize = 1024 * 1024 * 1024;  // ~ 1GB
-
 Sampler::Sampler(
     std::unique_ptr<bioparser::Parser<biosoup::Sequence>> sparser,
     const std::string& base_name,
@@ -42,8 +40,8 @@ void Sampler::Initialize() {
 
 void Sampler::Subsample(
     const std::string& out_directory,
-    std::uint32_t reference_length,
-    std::uint32_t coverage) {
+    std::uint64_t reference_length,
+    std::uint64_t coverage) {
   if (coverage * reference_length > sequences_length_) {
     std::cerr << "[rampler::Sampler::subsample] warning: "
               << "insufficient data for coverage of " << coverage
@@ -92,7 +90,7 @@ void Sampler::Subsample(
   ofs.close();
 }
 
-void Sampler::Split(const std::string& out_directory, std::uint32_t chunk_size) {  // NOLINT
+void Sampler::Split(const std::string& out_directory, std::uint64_t chunk_size) {  // NOLINT
   if (chunk_size > sequences_length_) {
     std::cerr << "[rampler::Sampler::split] warning: "
               << "insufficient data for chunk size " << chunk_size
@@ -100,7 +98,7 @@ void Sampler::Split(const std::string& out_directory, std::uint32_t chunk_size)
     return;
   }
 
-  uint32_t chunk_number = 0;
+  std::size_t chunk_number = 0;
 
   sparser_->Reset();
   while (true) {


=====================================
src/sampler.hpp
=====================================
@@ -35,10 +35,10 @@ class Sampler {
 
   void Subsample(
       const std::string& out_directory,
-      std::uint32_t reference_length,
-      std::uint32_t coverage);
+      std::uint64_t reference_length,
+      std::uint64_t coverage);
 
-  void Split(const std::string& out_directory, std::uint32_t chunk_size);
+  void Split(const std::string& out_directory, std::uint64_t chunk_size);
 
  private:
   std::unique_ptr<bioparser::Parser<biosoup::Sequence>> sparser_;



View it on GitLab: https://salsa.debian.org/med-team/rampler/-/commit/e306dd21ddcc1f7420a7034b9dd60795eea3d342

-- 
View it on GitLab: https://salsa.debian.org/med-team/rampler/-/commit/e306dd21ddcc1f7420a7034b9dd60795eea3d342
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/20221125/3801b3a8/attachment-0001.htm>


More information about the debian-med-commit mailing list