Metadata-Version: 2.5
Name: biocutils
Version: 0.5.0
Summary: Utilities to use across the biocpy packages.
Project-URL: Homepage, https://github.com/BiocPy/biocutils
Project-URL: Documentation, https://biocpy.github.io/biocutils/
Project-URL: Source, https://github.com/BiocPy/biocutils
Project-URL: Bug Tracker, https://github.com/BiocPy/biocutils/issues
Author-email: Aaron Lun <infinite.monkeys.with.keyboards@gmail.com>, Jayaram Kancherla <jayaram.kancherla@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2023 Aaron Lun
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: AUTHORS.md
License-File: LICENSE.txt
Keywords: bioinformatics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: importlib-metadata>=9.0.0; python_full_version < '3.8'
Requires-Dist: numpy
Provides-Extra: testing
Requires-Dist: pandas>=2.0.0; extra == 'testing'
Requires-Dist: pytest-cov>=4.0.0; extra == 'testing'
Requires-Dist: pytest>=7.0.0; extra == 'testing'
Requires-Dist: scipy; extra == 'testing'
Requires-Dist: setuptools>=68.0.0; extra == 'testing'
Description-Content-Type: text/markdown

<!-- These are examples of badges you might want to add to your README:
     please update the URLs accordingly

[![Built Status](https://api.cirrus-ci.com/github/<USER>/biocutils.svg?branch=main)](https://cirrus-ci.com/github/<USER>/biocutils)
[![ReadTheDocs](https://readthedocs.org/projects/biocutils/badge/?version=latest)](https://biocutils.readthedocs.io/en/stable/)
[![Coveralls](https://img.shields.io/coveralls/github/<USER>/biocutils/main.svg)](https://coveralls.io/r/<USER>/biocutils)
[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/biocutils.svg)](https://anaconda.org/conda-forge/biocutils)
[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Twitter)](https://twitter.com/biocutils)
-->

# Utilities for BiocPy

[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)
[![PyPI-Server](https://img.shields.io/pypi/v/biocutils.svg)](https://pypi.org/project/biocutils/)
[![Monthly Downloads](https://pepy.tech/badge/biocutils/month)](https://pepy.tech/project/biocutils)
![Unit tests](https://github.com/BiocPy/biocutils/actions/workflows/pypi-test.yml/badge.svg)

## Motivation

This repository contains a variety of simple utilities for the [BiocPy](https://github.com/BiocPy) project,
mostly convenient aspects of R that aren't provided by base Python.
The aim is to simplify development of higher-level packages like [**scranpy**](https://github.com/BiocPy/scranpy) and [**singler**](https://github.com/BiocPy/singler)
that would otherwise have to implement these methods individually.

## Available utilities

### `match`

```python
import biocutils
biocutils.match(["A", "C", "E"], ["A", "B", "C", "D", "E"])
## [0, 2, 4]
```

### `factor`

```python
import biocutils
biocutils.factorize(["A", "B", "B", "A", "C", "D", "C", "D"])
## (['A', 'B', 'C', 'D'], [0, 1, 1, 0, 2, 3, 2, 3])
```

### `intersect`

```python
import biocutils
biocutils.intersect(["A", "B", "C", "D"], ["D", "A", "E"])
## ['A', 'D']
```

### `union`

```python
import biocutils
biocutils.union(["A", "B", "C", "D"], ["D", "A", "E"])
## ['A', 'B', 'C', 'D', 'E']
```

### `subset`

```python
import biocutils
biocutils.subset(["A", "B", "C", "D", "E"], [0, 2, 4])
## ['A', 'C', 'E']

import numpy as np
y = np.array([10, 20, 30, 40, 50])
biocutils.subset(y, [0, 2, 4])
## array([10, 30, 50])
```

### `is_list_of_type`

Checks if all elements of a list or tuple are of the same type.

```python
import biocutils
import numpy as np

x = [np.random.rand(3), np.random.rand(3, 2)]
biocutils.is_list_of_type(x, np.ndarray)
## True
```

and many more. Check out the [documentation](https://biocpy.github.io/BiocUtils/api/modules.html) for more information.
