Skip to main content

GCGC is a preprocessing library for biological sequence model development.

Project description

GCGC

GCGC is a tool for feature processing on Biological Sequences.

code style black

Installation

GCGC is primarily intended to be used as part of a larger workflow inside Python.

To install via pip:

$ pip install gcgc

If you'd like to use code that helps gcgc's tokenizers integrate with common third party libraries, either install those packages separately, or use gcgc's extras.

$ pip install 'gcgc[pytorch,hf]'

Documentation

The GCGC documentation is at gcgc.trenthauck.com, please see it for examples.

Quick Start

The easiest way to get started is to import the kmer tokenizer, configure it, then start tokenizing.

from gcgc import KmerTokenizer

kmer_tokenizer = KmerTokenizer(alphabet="unambiguous_dna")
encoded = kmer_tokenizer.encode("ATCG")
print(encoded)

sample output:

[1, 6, 7, 8, 5, 2]

This output includes the "bos" token, the "eos" token, and the four nucleotide tokens in between.

You can go the other way and convert the integers to strings.

from gcgc import KmerTokenizer

kmer_tokenizer = KmerTokenizer(alphabet="unambiguous_dna")
decoded = kmer_tokenizer.decode(kmer_tokenizer.encode("ATCG"))
print(decoded)

sample output:

['>', 'A', 'T', 'C', 'G', '<']

There's also the vocab for the kmer tokenizer.

from gcgc import KmerTokenizer

kmer_tokenizer = KmerTokenizer(alphabet="unambiguous_dna")
print(kmer_tokenizer.vocab.stoi)

sample output:

{'|': 0, '>': 1, '<': 2, '#': 3, '?': 4, 'G': 5, 'A': 6, 'T': 7, 'C': 8}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcgc-1.0.0.tar.gz (481.7 kB view details)

Uploaded Source

Built Distribution

gcgc-1.0.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file gcgc-1.0.0.tar.gz.

File metadata

  • Download URL: gcgc-1.0.0.tar.gz
  • Upload date:
  • Size: 481.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for gcgc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a5bfa1ca3b71dcb6b7ba70ad7d060584129606f754a0349fc0d14614f358d31b
MD5 77e30c48c0bec219d4f010b995707ce8
BLAKE2b-256 0780a45a6f4dfdd9dfcb4a2f6c505478dcdf50eb45fdefabbf9ff10b444e5147

See more details on using hashes here.

File details

Details for the file gcgc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gcgc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for gcgc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d15698541cec68b5eec5684b2c24898de11fdadb9e5032651f57ea2655ede7a
MD5 0b075b0af2fad93ce5fc11a8a2b07202
BLAKE2b-256 df9d5c6558dd772a632593a86ab41b045ae4d14155b7c46a19889beb61269f7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page