Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

bionemo-noodles

bionemo-noodles is a Python wrapper of noodles that supports memmap-based file I/O for FASTA files.

Installation

To install from PyPI, execute the following command:

pip install bionemo-noodles

Compatibility

bionemo-noodles has pre-built wheels for Python/Cython 3.10, 3.11, and 3.12, and is compatible with manylinux_2_28 on x86_64.

For a custom build configuration that is not currently supported on PyPI, reach out to: bionemofeedback@nvidia.com

Usage

An example torch.utils.data.Dataset using NvFaidx / bionemo-noodles:

import json
from pathlib import Path

import torch

from bionemo.noodles.nvfaidx import NvFaidx

class SimpleFastaDataset(torch.utils.data.Dataset):

    def __init__(self, fasta_path: Path, tokenizer):
        """Initialize the dataset."""
        super().__init__()
        self.fasta = NvFaidx(fasta_path)
        self.seqids = sorted(self.fasta.keys())
        self.tokenizer = tokenizer

    def write_idx_map(self, output_dir: Path):
        """Write the index map to the output directory."""
        with open(output_dir / "seq_idx_map.json", "w") as f:
            json.dump({seqid: idx for idx, seqid in enumerate(self.seqids)}, f)

    def __len__(self):
        """Get the length of the dataset."""
        return len(self.seqids)

    def __getitem__(self, idx: int) -> dict[str, torch.Tensor]:
        """Get an item from the dataset."""
        sequence = self.fasta[self.seqids[idx]].sequence().upper()
        tokenized_seq = self.tokenizer.text_to_ids(sequence)
        loss_mask = torch.ones_like(torch.tensor(tokenized_seq, dtype=torch.long), dtype=torch.long)
        return {
            "tokens": torch.tensor(tokenized_seq, dtype=torch.long),
            "position_ids": torch.arange(len(tokenized_seq), dtype=torch.long),
            "seq_idx": torch.tensor(idx, dtype=torch.long),
            "loss_mask": loss_mask,
        }

BioNeMo Framework Ecosystem Development

To install this sub-package locally (with --editable):

pip install -e .

To run unit tests, execute:

pytest -v .

To build wheels for different Python, Linux, and system architecture configurations, run the BioNeMo Sub-Package GitHub Actions Workflow (bionemo-subpackage-ci.yml)

Metadata

Release files for bionemo-noodles 0.1.2

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

Built distributions (wheels)

Table of built distributions (wheels) for bionemo-noodles 0.1.2
File Interpreter ABI Platform
bionemo_noodles-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
bionemo_noodles-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
bionemo_noodles-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details

Total release size: 829.0 kB

Release files / bionemo_noodles-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL bionemo_noodles-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
Size 278.0 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b32a6a49c96b1ef409ae726239bcfecadee49de91fdbf681dd8bcd3082de233b
BLAKE2b-256 checksum
How to use checksums
ae2ad8900358391bf85f77886e81e103d4ab75f1398b4977960a7b81415884a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

Release files / bionemo_noodles-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL bionemo_noodles-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
Size 275.5 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5460157d45c830edca04a22a17b7b5a66f528e57279d672bba4f0068914c0f98
BLAKE2b-256 checksum
How to use checksums
c40cff22aeca872d48695c81d752a4b8dd10a1543aacefc04c9473564b4c1806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

Release files / bionemo_noodles-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL bionemo_noodles-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
Size 275.5 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f0f8a4c1a314782fff136738dbd0e04d04498e50c26a6ee9b0bfd7236f4141c4
BLAKE2b-256 checksum
How to use checksums
81f9ee586c4056e48fd74e2d38856d01e9aaa64ce5e4334ea4aed6be0ecc0c68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

3 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