Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gcgc

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcgc

GCGC is a preprocessing library for biological sequence model development.

  • 1.0.0
  • PyPI
  • Socket score

Maintainers
1

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}

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc