semvec/pypi-packages huggingface dataset:
fpbase-client 0.1.2
A Python client for the FPBase REST API
Requires Python: >=3.10

# FPBase Client

A Python client for the FPBase REST API with local SQLite caching.

## Installation

```bash
git clone https://github.com/joemans3/fpbase-client.git
cd fpbase-client
pip install -e .
```

## Basic Usage

```python
from fpbase_client import FPBaseAPI, find_proteins_by_name, find_spectra_by_name

# Using the API client directly
api = FPBaseAPI()
proteins = api.search_by_name("GFP")  # Partial match
proteins = api.search_by_name("EGFP", partial_match=False)  # Exact match

# Using the local database (faster, works offline)
proteins = find_proteins_by_name("GFP")  # Partial match
proteins = find_proteins_by_name("EGFP", exact=True)  # Exact match

# Advanced API queries
# For advanced users who need more specific queries, use get_proteins() with filters
proteins = api.get_proteins(
    name__icontains='green',
    default_state__qy__gte=0.7,
    default_state__brightness__gte=0.5
)

# Find spectra
spectra = find_spectra_by_name("EGFP", exact=True)
# returns a list of dictionaries with the following keys:
# name, slug, spectra
# spectra is a list of dictionaries with the following keys:
# state, ec, max, data: (state name in string, exctinction coefficient in M^-1 cm^-1, wavelength at max excitation or emission based on state, List[List[float, float]] representing the wavelength and intensity of the spectrum (note: intensity is from 0-1))


# Get all data
all_proteins = api.get_all_proteins()
all_spectra = api.get_all_spectra()

# Reinstall local database
from fpbase_client import reinstall_DB
reinstall_DB()  # This will delete and repopulate the local cache
```

## Available Methods

### API Methods
- `search_by_name(name, partial_match=True)`: Search proteins by name
- `get_proteins(**kwargs)`: Advanced protein search with filters
- `get_all_proteins()`: Get all proteins
- `get_all_spectra()`: Get all spectra

### Local Database Methods
- `find_proteins_by_name(name, exact=False)`: Search proteins by name using local cache
- `find_spectra_by_name(name, exact=False)`: Search spectra by name using local cache
- `reinstall_DB()`: Delete and repopulate the local database cache

## Advanced Search Fields

The `get_proteins()` method supports various fields and lookups (see [FPBase API docs](https://www.fpbase.org/api/)):

- `name`: icontains, iendswith, istartswith, iexact
- `seq`: icontains, iendswith, istartswith, cdna_contains
- `default_state__ex_max`: around, range, lte, gte, exact
- `default_state__em_max`: around, range, lte, gte, exact
- `default_state__lifetime`: gte, lte, range, exact
- And many more...

Example:
```python
proteins = api.get_proteins(
    name__icontains='green',
    default_state__qy__gte=0.7,
    primary_reference__year__gte=2020
)
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
calpi 1.1
Calculate Pi easily with the Calpi library

The CalPi library is currently in its alpha development phase.

Disclaimer:

    At the recommended iteration setting of 4,000, CalPi can reliably compute up to 1,000 digits of Ï€. Reducing the iteration count may significantly decrease the accuracy of the results. Increasing iterations beyond 50,000 is possible but may cause instability or potential failures in the libraryâ€™s calculations.

Functionality:

    The CalPi library is designed to calculate up to 1,000 digits of Ï€ with high precision, offering a practical tool for applications requiring precise values of Ï€ for mathematical or scientific computations. CalPi is ideal for environments that need consistent precision with moderate computational resources, like educational purposes or high-accuracy simulations.

Usage Example:
```python
from decimal import Decimal, getcontext
from calpi import calpiinfo  

# Create an instance of calpiinfo
pi_calculator = calpiinfo()

# Example usage of the calpi function to calculate Pi
amount = 100  # The number of digits of Pi you want to calculate
iterations = 1000  # Number of iterations for the Chudnovsky algorithm

# Calculate Pi with high precision
calculated_pi = pi_calculator.calpi(amount, iterations)
print(f"Calculated Pi with {amount} digits: {calculated_pi}")

# Example usage of the binaryencode function to convert a string to binary
text = "Hello, World!"  # The string to be encoded
binary_encoded = pi_calculator.binaryencode(text)
print(f"Binary Encoding of '{text}': {binary_encoded}")

# Example usage of the binarydecode function to decode the binary string back to text
binary_string = binary_encoded  # Using the previously encoded binary string
decoded_text = pi_calculator.binarydecode(binary_string)
print(f"Decoded Binary String: {decoded_text}")

```

This will output:

3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105

A note from the developer:
 This is my first library- Whether it recieves more features and updates as time progresses is uncertain, love you guys <3

For Further Reading on each feature of Calpi, visit:
https://calpi-docs.onrender.com