Calculate shannon entropy of biological sequences
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seqshannon-1.0.0.tar.gz.
File metadata
- Download URL: seqshannon-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace4fa1d6280be64ce0d4448150faecb680f1e336d5383bf51e9e99d4912ecb8
|
|
| MD5 |
66f1d9f553f77b5f4d0b4940ab555db9
|
|
| BLAKE2b-256 |
1b80b0510bcd222a8ddea03cb0e6e9df225c151f469442c6e1b7d800d0e63a7c
|
File details
Details for the file seqshannon-1.0.0-py3-none-any.whl.
File metadata
- Download URL: seqshannon-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14cd7a380b8e5c82ac80794f739ec9988370e0aea4c6259da629db94e5f0b311
|
|
| MD5 |
ef70f5cc07b45bbcd28a8b4e5884e4f8
|
|
| BLAKE2b-256 |
18963d549837a565b71448d817cb191a6a4fff5af1953f761111dff869ae3bb9
|