Remove extraneous str casts #210
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: UniFrac CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: flake8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: install dependencies | |
run: python -m pip install --upgrade pip | |
- name: lint | |
run: | | |
pip install -q flake8 | |
flake8 unifrac setup.py | |
build-and-test: | |
needs: lint | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
os: [ubuntu-latest, macos-latest, linux-gpu-cuda] | |
exclude: | |
- os: macos-latest | |
python-version: '3.9' | |
- os: macos-latest | |
python-version: '3.10' | |
- os: linux-gpu-cuda | |
python-version: '3.8' | |
- os: linux-gpu-cuda | |
python-version: '3.9' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
shell: bash -l {0} | |
run: | | |
conda create --yes -n unifrac -c conda-forge -c bioconda python=${{ matrix.python-version }} | |
conda activate unifrac | |
conda config --add channels conda-forge | |
conda config --add channels bioconda | |
if [[ "$(uname -s)" == "Linux" ]]; | |
then | |
conda install --yes -c conda-forge -c bioconda gxx_linux-64 | |
else | |
conda install --yes -c conda-forge -c bioconda clangxx_osx-64 | |
fi | |
conda install --yes -c conda-forge -c bioconda "unifrac-binaries>=1.2" | |
conda install --yes -c conda-forge -c bioconda cython biom-format numpy "h5py>3.3.0" "scikit-bio>=0.5.8" nose | |
echo "$(uname -s)" | |
if [[ "$(uname -s)" == "Linux" ]]; | |
then | |
which x86_64-conda-linux-gnu-gcc | |
x86_64-conda-linux-gnu-gcc -v | |
x86_64-conda-linux-gnu-g++ -v | |
else | |
which clang | |
clang -v | |
fi | |
which h5c++ | |
pip install iow | |
pip install -e . | |
- name: Tests | |
shell: bash -l {0} | |
run: | | |
conda activate unifrac | |
# keep it low for runs in containers | |
# and a weird number to potentially catch potential bugs | |
export OMP_NUM_THREADS=3 | |
# diagnostic messages for debugging, if needed | |
export UNIFRAC_GPU_INFO=Y | |
ls -lrt $CONDA_PREFIX/lib/libhdf5_cpp* | |
nosetests | |
- name: Sanity checks | |
shell: bash -l {0} | |
run: | | |
conda activate unifrac | |
# keep it low for runs in containers | |
# and a weird number to potentially catch potential bugs | |
export OMP_NUM_THREADS=3 | |
# diagnostic messages for debugging, if needed | |
export UNIFRAC_GPU_INFO=Y | |
set -e | |
ssu -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre -o ci/test.dm -m unweighted | |
python -c "import skbio; dm = skbio.DistanceMatrix.read('ci/test.dm')" | |
pushd unifrac/tests | |
export UNIFRAC_TIMING_INFO=Y | |
python -c "import unifrac; unifrac.unweighted_to_file('data/crawford.biom','data/crawford.tre','../../ci/test.dm.h5')" | |
python -c "import unifrac,skbio; dm_u=unifrac.unweighted('data/crawford.biom','data/crawford.tre'); dm = skbio.DistanceMatrix.read('../../ci/test.dm'); t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import unifrac; unifrac.unweighted_to_file('data/crawford.biom','data/crawford.tre','../../ci/test2.dm.h5',permanova_perms=99,grouping_filename='data/crawford.group.tsv',grouping_columns='Treatment')" | |
python -c "import unifrac; unifrac.weighted_normalized_to_file('data/crawford.biom','data/crawford.tre','../../ci/test3.dm.h5',subsample_depth=2,pcoa_dims=2)" | |
export UNIFRAC_TIMING_INFO=N | |
popd | |
python -c "import h5py,skbio; f_u=h5py.File('ci/test.dm.h5','r'); dm_u=skbio.stats.distance.DistanceMatrix(f_u['matrix'][:,:],f_u['order'][:])" | |
python -c "import h5py,skbio; dm = skbio.DistanceMatrix.read('ci/test.dm'); f_u=h5py.File('ci/test.dm.h5','r'); dm_u=skbio.stats.distance.DistanceMatrix(f_u['matrix'][:,:],f_u['order'][:]); t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import h5py,skbio; dm = skbio.DistanceMatrix.read('ci/test.dm'); f_u=h5py.File('ci/test2.dm.h5','r'); dm_u=skbio.stats.distance.DistanceMatrix(f_u['matrix'][:,:],f_u['order'][:]); t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import h5py; f_u=h5py.File('ci/test2.dm.h5','r'); print(f_u.keys()); assert len(f_u['stat_methods'][:]) == 1" | |
python -c "import h5py; f_u=h5py.File('ci/test3.dm.h5','r'); print(f_u.keys()); assert len(f_u['pcoa_eigvals'][:]) == 2" | |
# repeat using unifrac's h5 interfaces | |
python -c "import unifrac; dm_u=unifrac.h5unifrac('ci/test.dm.h5'); dm_l=unifrac.h5unifrac_all('ci/test.dm.h5')" | |
python -c "import unifrac,skbio; dm = skbio.DistanceMatrix.read('ci/test.dm'); dm_u=unifrac.h5unifrac('ci/test.dm.h5'); t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import unifrac,skbio; dm = skbio.DistanceMatrix.read('ci/test.dm'); dm_u=unifrac.h5unifrac_all('ci/test.dm.h5')[0]; t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import unifrac,skbio; dm = skbio.DistanceMatrix.read('ci/test.dm'); dm_u=unifrac.h5unifrac('ci/test2.dm.h5'); t=abs(dm_u.data-dm.data).max(); print(t); assert t < 0.1" | |
python -c "import unifrac; st_l=unifrac.h5permanova_dict('ci/test2.dm.h5'); assert len(st_l) == 1" | |
python -c "import unifrac; pc=unifrac.h5pcoa('ci/test3.dm.h5'); print(pc); assert len(pc.eigvals) == 2" | |
ssu -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre --pcoa 3 --mode multi --subsample-depth 2 --n-subsamples 10 -r hdf5 -o ci/test4.dm.h5 -m unweighted | |
python -c "import unifrac; dm_u=unifrac.h5unifrac_all('ci/test4.dm.h5'); assert len(dm_u) == 10; print(dm_u[0]); print(dm_u[4]); print(dm_u[9]); dm_u.close(); assert len(dm_u) == 0" | |
if [[ "$(uname -s)" == "Linux" ]]; | |
then | |
MD5=md5sum | |
else | |
MD5='md5 -r' | |
fi | |
ssu -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre -o ci/test.dm.start0.stop3 -m unweighted --mode partial --start 0 --stop 3 | |
ssu -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre -o ci/test.dm.start3.stop5 -m unweighted --mode partial --start 3 --stop 5 | |
ssu -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre -o ci/test.dm.partial --mode merge-partial --partial-pattern "ci/test.dm.start*" | |
exp=$($MD5 ci/test.dm | awk '{ print $1 }') | |
obs=$($MD5 ci/test.dm.partial | awk '{ print $1 }') | |
python -c "assert '${obs}' == '${exp}'" | |
faithpd -i unifrac/tests/data/crawford.biom -t unifrac/tests/data/crawford.tre -o ci/test.faith.obs | |
tail -n +2 ci/test.faith.obs > ci/test.faith.header-removed.obs | |
exp1=$($MD5 unifrac/tests/data/test.faith.exp | awk '{ print $1 }') | |
obs1=$($MD5 ci/test.faith.header-removed.obs | awk '{ print $1 }') | |
python -c "assert '${obs1}' == '${exp1}'" | |