Skip to content

Commit

Permalink
Add pycoverm (#52941)
Browse files Browse the repository at this point in the history
* Add `pycoverm`

* Move build command to script

* Add `cmake` build depedency

* Require `cxx` compiler

* Add `make` as a build requirement

* Remove `linux-aarch64` build

* Bump to 0.6.2

* Update sha256sum

* Remove `test.py` from the list of test files

* Remove cross-compilation
  • Loading branch information
apcamargo authored Dec 21, 2024
1 parent 67ac7a2 commit a442e72
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/pycoverm/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -ex

export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="$CC"
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="$CC"
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1

$PYTHON -m pip install . -vv --no-deps --no-build-isolation
cargo-bundle-licenses --format yaml --output THIRDPARTY.yml
58 changes: 58 additions & 0 deletions recipes/pycoverm/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% set name = "pycoverm" %}
{% set version = "0.6.2" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: e5e96e55ee2756d0cbd1db383e136cd2c1e232204f25b015ce956b7a6f4ddee2

build:
number: 0
run_exports:
- {{ pin_subpackage('pycoverm', max_pin="x.x") }}

requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- {{ compiler("rust") }}
- {{ stdlib("c") }}
- python
- maturin >=1.7,<2
- make
- cmake
- cargo-bundle-licenses
host:
- pip
- maturin >=1.7,<2
- python
run:
- python
- numpy >=1.16,<3

test:
files:
- test.bam
imports:
- pycoverm
commands:
- pip check
requires:
- pip

about:
home: /~https://github.com/apcamargo/pycoverm
license: GPL-3.0
license_file:
- LICENSE
- THIRDPARTY.yml
summary: Python bindings for CoverM

extra:
additional-platforms:
- osx-arm64
skip-lints:
- version_constraints_missing_whitespace # see /~https://github.com/bioconda/bioconda-recipes/issues/51185
25 changes: 25 additions & 0 deletions recipes/pycoverm/run_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python

import unittest

import numpy as np
import pycoverm


class TestPycoverm(unittest.TestCase):
def setUp(self):
self.bam_file = "test.bam"

def test_is_bam_sorted(self):
result = pycoverm.is_bam_sorted(self.bam_file)
self.assertIsInstance(result, bool)

def test_get_coverages_from_bam(self):
result = pycoverm.get_coverages_from_bam([self.bam_file])
self.assertIsInstance(result[0], list)
self.assertIsInstance(result[1], np.ndarray)
self.assertAlmostEqual(result[1].sum(), 30.173173904418945)


if __name__ == "__main__":
unittest.main()
Binary file added recipes/pycoverm/test.bam
Binary file not shown.

0 comments on commit a442e72

Please sign in to comment.