Skip to main content

nucleic acid or protein sequence to png converter

Project description

fasta2png

CircleCI

This package includes two programs:

  • fna2png: generates PNG images from nucleic acid (na) / nucleotide sequences in FASTA format representing different nucleic acids with different colors.
  • faa2png: generates PNG images from amino acid (aa) / protein sequences in FASTA format representing different amino acids (codons) with different colors.

Both programs scan the sequence and generates a (small) rectangle (configurable size with --pixel-size) for each nucleotide bases or for each amino acids (codons) from top-left to bottom-right. The aspect ratio of the PNG is also configurable (with --aspect-ratio). The PNG image is in RGBA format.

For nucleotide sequences, A, C, G, T is painted using different colors (U is same as T), and all other codes (N and others) are painted with white. The background of the image (meaning the remaining area in the image) is painted with black. These colors are also configurable.

For protein sequences, each amino acid/codon is painted using a different color. The gap (-) is painted as same as background. Only the background color is configurable, because there are so many (27) codes.

Installation

pip install fasta2png

Usage: fna2png

fna2png --input <fna_input_in_fasta_format> --output <output_filename_of_png>

There are various options to customize PNG output, see help fna2png --help for more info.

Usage: faa2png

faa2png --input <faa_input_in_fasta_format> --output <output_filename_of_png>

There are some options to customize PNG output, see help faa2png --help for more info.

Example: fna2png

NC_045512.2 is the SARS-CoV-2 (corona virus 2) complete genome sequenced by Chinese researchers in January 2020.

NC_045512.2.fna file below is https://www.ncbi.nlm.nih.gov/nuccore/NC_045512.2?report=fasta&log$=seqview&format=text.

$ fna2png --input NC_045512.2.fna --output NC_045512.2.png --pixel-size 8 --aspect-ratio 3 2

seqdesc: NC_045512.2 Severe acute respiratory syndrome coronavirus 2 isolate Wuhan-Hu-1, complete genome
seqlen: 29903

NC_045512.2.fna.png

Example: faa2png

This example is using the same SARS-CoV-2 sequence, but taking the sequence of the protein encoded by the first gene in its genome called ORF1ab.

YP_009724389.1.faa file below is https://www.ncbi.nlm.nih.gov/protein/YP_009724389.1?report=fasta&log$=seqview&format=text.

$ faa2png --input YP_009724389.1.faa --output YP_009724389.1.faa.png --pixel-size 4 --aspect-ratio 3 2

seqdesc: YP_009724389.1 orf1ab polyprotein [Severe acute respiratory syndrome coronavirus 2]
seqlen: 7096

YP_009724389.1.faa.png

Changes

  • v7: Pillow updated to 9.1.1, CI config updated.
  • v6: Pillow updated to 9.0.1.
  • v5: Pillow updated to 8.2.0.
  • v4: dont use.
  • v3: Pillow updated to v8.0.1.

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

fasta2png-7.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

fasta2png-7-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file fasta2png-7.tar.gz.

File metadata

  • Download URL: fasta2png-7.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for fasta2png-7.tar.gz
Algorithm Hash digest
SHA256 150647585a575baec9f4297cd3b90b73c378393895c393c4004e3b8d1f2b534b
MD5 07eb81b40a78001f7e955c6da0c72f67
BLAKE2b-256 7236bf1b6e7de7fe2bebb3769d0553fad7aacbd69c5ca4954184c7409b73bd31

See more details on using hashes here.

File details

Details for the file fasta2png-7-py3-none-any.whl.

File metadata

  • Download URL: fasta2png-7-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for fasta2png-7-py3-none-any.whl
Algorithm Hash digest
SHA256 6bf72a392598b5a58c50d0cf55741d2034465da7a2392a64241c6e3f3b7f16e1
MD5 06c11d7e0bee16b20a9cc5b70ccd86db
BLAKE2b-256 05ba77fc13607fa11fe022d0a6de97db35fcc5f054df2aa2c3c285adf5b63079

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