Skip to main content

decode a one-hot numpy array to biological sequences

Project description

licence PyPI version

Description

onehot2seq is a command-line tool decoding a one-hot numpy array to DNA/RNA/protein sequences.

To encode sequences to a one-hot numpy array, use seq2onehot.
https://github.com/akikuno/seq2onehot

Installation

You can install onehot2seq using pip:

pip install onehot2seq

Usage

onehot2seq [options] -t/--type <dna/rna/protein> -i/--input <in.npy> -o/--output <out.txt/fasta>

Options

-a/--ambiguous: include ambiguous characters
-f/--format <txt/fasta>: output as a FASTA format (default: txt)

The ambigous characters are:

  • XBZJ for amino acid
  • NVHDBMRWSYK for DNA and RNA

The detail of ambiguous characters is described here:
https://meme-suite.org/meme/doc/alphabets.html

The header IDs of FASTA format are sequential numbers (e.g. >seq1, >seq2)

Examples

# Output DNA sequences
onehot2seq -t dna -i example/dna.npy -o dna.txt

# Output DNA sequences as a FASTA format
onehot2seq -t dna -f fasta -i example/dna.npy -o dna.fasta

# RNA sequences
onehot2seq -t rna -i example/rna.npy -o rna.txt

# Protein sequences
onehot2seq -t protein -i example/protein.npy -o protein.txt

One-hot array

The input file must contain 3d one-hot array of RxNxL (Read x Nucreotide/Amino acid x Letter)

  • The order of nucreotide is ACGT (+ NVHDBMRWSYK) for DNA, ACGU (+ NVHDBMRWSYK) for RNA
  • The order of amino acid is ACDEFGHIKLMNPQRSTVWY (+ XBZJ)

Project details


Download files

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

Source Distribution

onehot2seq-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

onehot2seq-0.0.2-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

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