Skip to main content
description

Bio Dataset Manager: easily encode biological sequences into tensors


Coverage PyPI Latest Release Unit Tests
Powered by TaccLab
License

Authors:


- Fabio Bove | fabio.bove.dr@gmail.com
- Eugenio Bertolini |

What is it?

Bio Data Manager is a Python project designed for managing and processing bio-sequence data, including DNA, proteins, and SMILES strings. This tool facilitates the encoding of these sequences into tensors, which can then be used for AI computations and complex model implementations.


Project Structure

  • bio_data_manager/: Contains core modules for bioinformatics sequence processing and management.
  • bio_sequences/: Handles various operations related to biological sequences such as DNA and protein.

Installation

  1. Install it as a library
    • Using CPU:
      pip install bio-dataset-manager
      
    • Using CUDA:
      pip install bio-dataset-manager[cuda] -f https://download.pytorch.org/whl/torch_stable.html
      

Usage

Examples of the code can be found in the examples folder.

  1. import the modules
import torch
from bio_dataset_manager.bio_dataloader import BioDataloader
from bio_dataset_manager.bio_dataset import BioDataset
from bio_sequences.dna_sequence import DnaSequence
  1. create the dataset and dataloader
dataset = BioDataset(
        dataset_folder="path/to/dataset",
        sequences_limit=10,
        randomize_choice=True,
        pad_same_len=False,
        window_size=1,
        sequence_info=DnaSequence(),
        sequences=None,
    )

dataloader = BioDataloader(
        dataset=dataset,
        batch_size=5,
        shuffle=True,
        collate_fn=dataset.collate_fn,
        split_ratio=0.5,
        use_gpu=True if torch.cuda.is_available() else False
    )
  1. training loop example
epochs = 5
for epoch in range(epochs):
    with tqdm(total=len(dataloader.training_dataloader), desc=f"Epoch {epoch + 1}/{epochs}", unit="batch") as pbar:
        for batch in dataloader.training_dataloader:
            y_real, lengths = dataloader.process_batch(batch)
            time.sleep(0.1)
            pbar.update(1)
            pbar.set_postfix(
                loss_gen=f"0.0",
                loss_dis=f"0.0"
            )
    pbar.refresh()

Contributing

Feel free to submit issues or pull requests if you'd like to contribute to this project.


License

License

Metadata

Release files for bio-dataset-manager 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bio-dataset-manager 0.1.4
File Size Uploaded
bio_dataset_manager-0.1.4.tar.gz 47.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bio-dataset-manager 0.1.4
File Interpreter ABI Platform
bio_dataset_manager-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 84.3 kB

Release files / bio_dataset_manager-0.1.4.tar.gz

Download URL bio_dataset_manager-0.1.4.tar.gz
Size 47.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9ba4a1dcc8627c7dfd15b87dcb31f1f4254564ca70e748959c6f9ebb3510e50e
BLAKE2b-256 checksum
How to use checksums
5d98489800ee38cd48c401eb3d0a8d7c25669b7d5308ff256fd7ba585c20fa04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / bio_dataset_manager-0.1.4-py3-none-any.whl

Download URL bio_dataset_manager-0.1.4-py3-none-any.whl
Size 36.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
152e85a87926038b62baca0b7fcd8b9d902b0b39b13b9c5b11d84c7d79027cbd
BLAKE2b-256 checksum
How to use checksums
90c6f35905b28b243a9bb607e569b4d51b0fb9f0aa6c34e7af2302c608f6738c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page