Skip to main content

SeqShannon

SeqShannon is a Python package that calculates the Shannon entropy of biological sequences. It works for both nucleotide and amino acid sequences.

Description

SeqShannon is a Python package that reads a FASTA file and calculates the Shannon entropy for each biological sequence in the file. It utilizes the BioPython library for parsing FASTA files. The results can be easily written to an output file or printed in the console.

The Shannon entropy is a measure of the uncertainty or randomness of a set of data. In the context of biological sequences, such as DNA or protein sequences, the Shannon entropy can provide insights into the variability and complexity of the sequence.

Installation

You can install SeqShannon using pip:

pip install seqshannon

Usage

SeqShannon can be used as a command-line tool or as a Python library.

Command-line usage

Use a fasta file as input. By default, the package prints out the identifier and calculated Shannon entropy for each sequence in the input file.

seqshannon -i example.fasta

You can also specify a file to save the output.

seqshannon -i example.fasta -o output.txt

Example

Here are the contents of an example FASTA file:

>example_1
VLSISYSRSESSLE
>example_2
TIGQRKPSTFSWSS
>example_3
RAASRSSWERGP

Running SeqShannon on this file will yield the following output:

example_1 2.4137995646056805
example_2 3.09306920777189
example_3 2.6258145836939115

Python library usage

You can calculate the Shannon entropy of the given sequence by importing shannon_entropy.

>>> from seqshannon import shannon_entropy
>>> from Bio.Seq import Seq
>>> sequence = Seq("ATGCATGC")
>>> entropy = shannon_entropy(sequence)
>>> print(entropy)
2.0

Contact

For any issues or suggestions, please contact Wojciech Dobrychłop.

License

SeqShannon is licensed under the MIT License. See the LICENSE file for more details.

Metadata

Release files for seqshannon 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seqshannon 1.0.0
File Size Uploaded Provenance Actions
seqshannon-1.0.0.tar.gz 4.7 kB Without provenance Details for seqshannon-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seqshannon 1.0.0
File Interpreter ABI Platform Actions
seqshannon-1.0.0-py3-none-any.whl Python 3 none any Details for seqshannon-1.0.0-py3-none-any.whl

Total release size: 9.4 kB

Release files / seqshannon-1.0.0.tar.gz

Download URL seqshannon-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ace4fa1d6280be64ce0d4448150faecb680f1e336d5383bf51e9e99d4912ecb8
BLAKE2b-256 checksum
How to use checksums
1b80b0510bcd222a8ddea03cb0e6e9df225c151f469442c6e1b7d800d0e63a7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / seqshannon-1.0.0-py3-none-any.whl

Download URL seqshannon-1.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14cd7a380b8e5c82ac80794f739ec9988370e0aea4c6259da629db94e5f0b311
BLAKE2b-256 checksum
How to use checksums
18963d549837a565b71448d817cb191a6a4fff5af1953f761111dff869ae3bb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for seqshannon 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page