Skip to content

Commit

Permalink
Merge pull request #48 from bacpop/fix-pipepines
Browse files Browse the repository at this point in the history
Fix Compatibility issues (fix Pipeline)
  • Loading branch information
johnlees authored Feb 26, 2025
2 parents 2b9bce5 + 486fa32 commit 4354922
Show file tree
Hide file tree
Showing 203 changed files with 29 additions and 38,340 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on: [push]

jobs:
build-linux:
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10"]
os: [ubuntu-latest, ubuntu-22.04]
python-version: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -28,8 +29,13 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install and run_test.py
- name: Install
shell: bash -l {0}
run: |
python -m pip install --no-deps --ignore-installed -v .
cd test && python run_test.py
- name: Test
shell: bash -l {0}
working-directory: test
run: |
python run_test.py
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.19)
project(SCE)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ version selection")
cmake_policy(SET CMP0104 OLD) # Can't get CUDA_ARCHITECTURES to work with NEW

# Variable definitions
Expand All @@ -19,7 +19,7 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")

if(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS")
set(CMAKE_LD_FLAGS "${CMAKE_LDFLAGS} -Wl,--as-needed")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ffast-math -funroll-loops -m64")

Expand All @@ -29,13 +29,14 @@ if(DEFINED ENV{CONDA_PREFIX})
link_directories($ENV{CONDA_PREFIX}/lib)
link_directories($ENV{CONDA_PREFIX}/lib/intel64)
else()
find_package(OpenMP)
find_package(OpenMP)
endif()

# Add libraries
find_package(ZLIB)
find_package(ZLIB REQUIRED)
find_package(Boost REQUIRED)
find_package(pybind11 REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/vendor)
include_directories(${Boost_INCLUDE_DIRS})

# Check for CUDA and compiles GPU library
include(CheckLanguage)
Expand All @@ -46,7 +47,7 @@ if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
set(CUDA_OPTS "-Wreorder -Xcompiler -fPIC -Xcompiler -Wall -Xcompiler -fopenmp -Xptxas -dlcm=ca --cudart static --relocatable-device-code=false")
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 80 86 90)
set(CMAKE_CUDA_ARCHITECTURES "80;86;90" CACHE STRING "CUDA architectures")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
string(APPEND CUDA_OPTS " -G")
Expand Down
5 changes: 0 additions & 5 deletions boost/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions boost/extract

This file was deleted.

1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dependencies:
- libgomp
- tqdm
- ffmpeg
- boost-cpp
2 changes: 1 addition & 1 deletion mandrake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

'''Visualisation of pathogen population structure'''

__version__ = '1.2.3'
__version__ = '1.2.4'
6 changes: 3 additions & 3 deletions mandrake/sce.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from functools import partial
import numpy as np
import pandas as pd

# C++ extensions
from SCE import wtsne
try:
Expand All @@ -31,8 +30,9 @@ def save_input(I, J, dists, names, output_prefix):
sys.stderr.write("Distances calculated, but not running SCE\n")
sys.exit(1)

pd.Series(names).to_csv(output_prefix + '.names.txt',
sep='\n', header=False, index=False)
pd.Series(names).to_csv(
output_prefix + ".names.txt", header=False, index=False
)

_saveDists(output_prefix, I, J, dists, names)

Expand Down
2 changes: 1 addition & 1 deletion src/kseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ typedef struct __kstring_t {
for (i = ks->begin; i < ks->end; ++i) \
if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \
} else i = 0; /* never come to here! */ \
if (str->m - str->l < i - ks->begin + 1) { \
if (str->m - str->l < (size_t)(i - ks->begin + 1)) { \
str->m = str->l + (i - ks->begin) + 1; \
kroundup32(str->m); \
str->s = (char*)realloc(str->s, str->m); \
Expand Down
3 changes: 2 additions & 1 deletion src/pairsnp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdio.h>
#include <string>
#include <zlib.h>
#include <omp.h>

#include "kseq.h"
#include "progress.hpp"
Expand Down Expand Up @@ -196,7 +197,7 @@ pairsnp(const char *fasta, int n_threads, int dist, int knn) {
#pragma omp parallel for schedule(static) reduction(+:len) num_threads(n_threads)
for (uint64_t i = 0; i < n_seqs; i++) {
// Cannot throw in an openmp block, short circuit instead
if (interrupt || PyErr_CheckSignals() != 0) {
if (interrupt || (omp_get_thread_num() == 0 && PyErr_CheckSignals() != 0)) {
interrupt = true;
} else {
std::vector<int> comp_snps(n_seqs);
Expand Down
8 changes: 4 additions & 4 deletions src/wtsne.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ std::vector<double> conditional_probabilities(const std::vector<uint64_t> &I,
// https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/manifold/_utils.pyx
#pragma omp parallel for schedule(static) num_threads(n_threads)
for (uint64_t sample_idx = 0; sample_idx < n_samples; ++sample_idx) {
real_t beta_min = -std::numeric_limits<real_t>::infinity();
real_t beta_max = std::numeric_limits<real_t>::infinity();
real_t beta_min = -std::numeric_limits<real_t>::max();
real_t beta_max = std::numeric_limits<real_t>::max();
real_t beta = 1.0;
real_t sum_Pi, sum_disti_Pi, entropy, entropy_diff;
for (int l = 0; l < n_steps; ++l) {
Expand Down Expand Up @@ -105,14 +105,14 @@ std::vector<double> conditional_probabilities(const std::vector<uint64_t> &I,

if (entropy_diff > 0.0) {
beta_min = beta;
if (beta_max == std::numeric_limits<real_t>::infinity()) {
if (beta_max == std::numeric_limits<real_t>::max()) {
beta *= 2.0;
} else {
beta = (beta + beta_max) * 0.5;
}
} else {
beta_max = beta;
if (beta_min == -std::numeric_limits<real_t>::infinity()) {
if (beta_min == -std::numeric_limits<real_t>::max()) {
beta *= 0.5;
} else {
beta = (beta + beta_min) * 0.5;
Expand Down
40 changes: 0 additions & 40 deletions vendor/alloca.h

This file was deleted.

144 changes: 0 additions & 144 deletions vendor/assert.h

This file was deleted.

Loading

0 comments on commit 4354922

Please sign in to comment.