fasta2png


Namefasta2png JSON
Version 8 PyPI version JSON
download
home_pagehttps://github.com/metebalci/fasta2png
Summarynucleic acid or protein sequence to png converter
upload_time2023-10-02 14:26:50
maintainer
docs_urlNone
authorMete Balci
requires_python
licenseGPLv3
keywords fasta fna faa png
VCS
bugtrack_url
requirements Pillow
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# fasta2png

[![CircleCI](https://circleci.com/gh/metebalci/fasta2png/tree/master.svg?style=svg)](https://circleci.com/gh/metebalci/fasta2png/tree/master)

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 file and generate an image containing solid squares (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 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.

For nucleotide sequences, multi-FASTA format accepted and either a single image containing the (sequentially) combined sequence or one image for each sequence is generated. This is controlled with `--multi-mode` option.

For protein sequqnces, multi-FASTA format is not supported at the moment, an image only for the first sequence will be generated. If you require this feature, please create an issue.

# Installation

```
pip install fasta2png
```

# multi-FASTA format options

For fna files, `--multi-mode` can be set to:

- `f` or `first`: only processes the first sequence (ignores the multi-FASTA format)
- `c` or `combined`: creates a single image containing all sequences combined
- `s` or `separate`: creates one image for each sequence

# output options

For fna files, `--output` is optional. If it is not given, the name/identifier in the file is used as the output file name (with `.png` suffix automatically added).

If a multi-FASTA file is given with `--multi-mode=s`:

- if `--output` is given, it is used as a prefix, and file names are formed as `<prefix><seqnum>.png`, and `<seqnum>` starts from 1. 

- if `--output` is not given, the name/identifier of the sequence is used and only `.png` is added.

# Example: fna2png

[NC_045512.2](https://www.ncbi.nlm.nih.gov/nuccore/NC_045512) 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](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](YP_009724389.1.faa.png)

# Changes

- v8: Pillow updated to 9.3.0. multi-FASTA format supported for fna files.
- 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/metebalci/fasta2png",
    "name": "fasta2png",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "fasta,fna,faa,png",
    "author": "Mete Balci",
    "author_email": "metebalci@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/79/05c746e00456acfd68975741b4be3c15c8fe5497d55f82f22ed80bc5a3c4/fasta2png-8.tar.gz",
    "platform": null,
    "description": "\n# fasta2png\n\n[![CircleCI](https://circleci.com/gh/metebalci/fasta2png/tree/master.svg?style=svg)](https://circleci.com/gh/metebalci/fasta2png/tree/master)\n\nThis package includes two programs:\n\n- `fna2png`: generates PNG images from nucleic acid (na) / nucleotide sequences in FASTA format representing different nucleic acids with different colors.\n\n- `faa2png`: generates PNG images from amino acid (aa) / protein sequences in FASTA format representing different amino acids (codons) with different colors.\n\nBoth programs scan the file and generate an image containing solid squares (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 configurable (with `--aspect-ratio`). The PNG image is in RGBA format.\n\nFor 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.\n\nFor 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.\n\nFor nucleotide sequences, multi-FASTA format accepted and either a single image containing the (sequentially) combined sequence or one image for each sequence is generated. This is controlled with `--multi-mode` option.\n\nFor protein sequqnces, multi-FASTA format is not supported at the moment, an image only for the first sequence will be generated. If you require this feature, please create an issue.\n\n# Installation\n\n```\npip install fasta2png\n```\n\n# multi-FASTA format options\n\nFor fna files, `--multi-mode` can be set to:\n\n- `f` or `first`: only processes the first sequence (ignores the multi-FASTA format)\n- `c` or `combined`: creates a single image containing all sequences combined\n- `s` or `separate`: creates one image for each sequence\n\n# output options\n\nFor fna files, `--output` is optional. If it is not given, the name/identifier in the file is used as the output file name (with `.png` suffix automatically added).\n\nIf a multi-FASTA file is given with `--multi-mode=s`:\n\n- if `--output` is given, it is used as a prefix, and file names are formed as `<prefix><seqnum>.png`, and `<seqnum>` starts from 1. \n\n- if `--output` is not given, the name/identifier of the sequence is used and only `.png` is added.\n\n# Example: fna2png\n\n[NC_045512.2](https://www.ncbi.nlm.nih.gov/nuccore/NC_045512) is the SARS-CoV-2 (corona virus 2) complete genome sequenced by Chinese researchers in January 2020.\n\nNC_045512.2.fna file below is https://www.ncbi.nlm.nih.gov/nuccore/NC_045512.2?report=fasta&log$=seqview&format=text.\n\n```\n$ fna2png --input NC_045512.2.fna --output NC_045512.2.png --pixel-size 8 --aspect-ratio 3 2\n\nseqdesc: NC_045512.2 Severe acute respiratory syndrome coronavirus 2 isolate Wuhan-Hu-1, complete genome\nseqlen: 29903\n```\n\n![NC_045512.2.fna.png](NC_045512.2.fna.png)\n\n# Example: faa2png\n\nThis 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.\n\nYP_009724389.1.faa file below is https://www.ncbi.nlm.nih.gov/protein/YP_009724389.1?report=fasta&log$=seqview&format=text.\n\n```\n$ faa2png --input YP_009724389.1.faa --output YP_009724389.1.faa.png --pixel-size 4 --aspect-ratio 3 2\n\nseqdesc: YP_009724389.1 orf1ab polyprotein [Severe acute respiratory syndrome coronavirus 2]\nseqlen: 7096\n```\n\n![YP_009724389.1.faa.png](YP_009724389.1.faa.png)\n\n# Changes\n\n- v8: Pillow updated to 9.3.0. multi-FASTA format supported for fna files.\n- v7: Pillow updated to 9.1.1, CI config updated.\n- v6: Pillow updated to 9.0.1.\n- v5: Pillow updated to 8.2.0.\n- v4: dont use.\n- v3: Pillow updated to v8.0.1.\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "nucleic acid or protein sequence to png converter",
    "version": "8",
    "project_urls": {
        "Homepage": "https://github.com/metebalci/fasta2png"
    },
    "split_keywords": [
        "fasta",
        "fna",
        "faa",
        "png"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27c72b5c9421b43a746867495fd2edba127cefe890b7f72b84a6e12100eca821",
                "md5": "e8ad3225086b9b76e14de7952c2bc440",
                "sha256": "31f6d4eeaa0a897e17fd1654d1dfe3cbeea69ee8ea7b0319728e1f3a910f22b5"
            },
            "downloads": -1,
            "filename": "fasta2png-8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e8ad3225086b9b76e14de7952c2bc440",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18856,
            "upload_time": "2023-10-02T14:26:48",
            "upload_time_iso_8601": "2023-10-02T14:26:48.264276Z",
            "url": "https://files.pythonhosted.org/packages/27/c7/2b5c9421b43a746867495fd2edba127cefe890b7f72b84a6e12100eca821/fasta2png-8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb7905c746e00456acfd68975741b4be3c15c8fe5497d55f82f22ed80bc5a3c4",
                "md5": "1fc17de804c1c357e8d19bca5a1576bc",
                "sha256": "85c14409b1f738c7caefa468bd64f9fffdaa20ff82a4e8987bc2dbf8837a59b3"
            },
            "downloads": -1,
            "filename": "fasta2png-8.tar.gz",
            "has_sig": false,
            "md5_digest": "1fc17de804c1c357e8d19bca5a1576bc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17723,
            "upload_time": "2023-10-02T14:26:50",
            "upload_time_iso_8601": "2023-10-02T14:26:50.239421Z",
            "url": "https://files.pythonhosted.org/packages/fb/79/05c746e00456acfd68975741b4be3c15c8fe5497d55f82f22ed80bc5a3c4/fasta2png-8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-02 14:26:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "metebalci",
    "github_project": "fasta2png",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "9.3.0"
                ]
            ]
        }
    ],
    "lcname": "fasta2png"
}
        
Elapsed time: 0.12054s