kmer-generator
Get a kmer list given a single DNA or RNA sequence.
Base sets
Kmers can be generated using the standart four nucleotide codes A, C, T (or U), and G, and also all anbiguous codes of IUPAC convention (https://www.bioinformatics.org/sms/iupac.html).
Install
$ pip install KmerGenerator
Usage
Instance the class and store in a object.
from KmerGenerator import KmerGenerator, BaseSet
kgenerator = KmerGenerator()
Print IUPAC convention code used in KmerGenerator.
kgenerator.base_set_descriptions()
The output is:
A => Adenine
C => Cytosine
G => Guanine
T => Thymine
U => Uracil
R => A or G
Y => C or T
S => G or C
W => A or T
K => G or T
M => A or C
B => C or G or T
D => A or G or T
H => A or C or T
V => A or C or G
N => any
Note: To generate kmers with ambiguous IUPAC codes (R, Y, S, ...), create an instance of the class and set the base_set parameter.
Set objects containing example sequence, kmer length, and base_set Enum.
sequence = 'AUCAUCAUGGGAUAUAUUGGCCCCCUAARCUUAUAUCUCUGGSAAUGACUCUAUAUU'
k = 3
base_set = BaseSet.Dubious2
Then, generate kmer.
kmers = kgenerator.count_kmer(sequence, k, base_set)
print(kmers)
The output:
[{'AAU': 1}, {'AAR': 1}, {'ACU': 1}, {'AUA': 3}, {'AUC': 3}, {'AUG': 2}, {'AUU': 2}, {'ARC': 1}, {'CAU': 2}, {'CCC': 1}, {'CCU': 1}, {'CUA': 2}, {'CUC': 2}, {'CUG': 1}, {'CUU': 1}, {'GAC': 1}, {'GAU': 1}, {'GCC': 1}, {'GGA': 1}, {'GGC': 1}, {'GGG': 1}, {'GGS': 1}, {'GSA': 1}, {'UAA': 1}, {'UAU': 3}, {'UCA': 2}, {'UCU': 2}, {'UGA': 1}, {'UGG': 3}, {'UUA': 1}, {'UUG': 1}, {'RCU': 1}, {'SAA': 1}]
Notice that only kmers with a frequency higher than zero are returned.
Release files for KmerGenerator 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| KmerGenerator-0.0.4.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| KmerGenerator-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / KmerGenerator-0.0.4.tar.gz
| Download URL | KmerGenerator-0.0.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6722b78cc5b7bacc3df87d29cda0691f14b25fe29c74acbafe5ff872f80b3347
|
|
BLAKE2b-256 checksum How to use checksums |
d343ef37a4f6a10b0cc100944d95712b0c4a3c8050742b0d3c328f103ee4aa15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
|
Release files / KmerGenerator-0.0.4-py3-none-any.whl
| Download URL | KmerGenerator-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e0c05f53cc465a5a4b294a3d17f0a84d32d5942551b1cdd92292284bfd07ba9
|
|
BLAKE2b-256 checksum How to use checksums |
0240a152bd3e38d569fb742cb9a5131dd3ad404594c22b87e0b79cf11c4f8de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
|