No project description provided
Project description
SeqPro (Sequence processing toolkit)
import seqpro as sp
SeqPro is a Python package for processing DNA/RNA sequences, with limited support for protein sequences. SeqPro is fully functional on its own but is heavily utilized by other packages including SeqData, MotifData, SeqExplainer, and EUGENe.
All functions in SeqPro take as input a string, a list of strings, a NumPy array of strings, a NumPy array of single character bytes (S1) or a NumPy array of one-hot encoded strings. There is also emerging integration with XArray through the seqpro.xr
submodule.
Computational bottelnecks or code that is impossible to vectorize with NumPy alone are accelerated with Numba e.g. padding sequences, one-hot encoding, converting from one-hot encoding to nucleotides, etc.
Installation
pip install seqpro
Sequence cleaners (cleaners
)
Remove sequences with ambiguous bases
# Padding
sp.pad_seqs(seqs, pad="right", pad_value="N", max_length=None)
# One-hot encoding
sp.ohe(seqs, alphabet=sp.alphabets.DNA)
# Decode one-hot encoding
sp.decode_ohe(ohe, ohe_axis=1, alphabet=sp.alphabets.DNA, unknown__char="N")
# Reverse complement
sp.reverse_complement(seqs, alphabet=sp.alphabets.DNA)
# k-let preserving shuffling
sp.k_shuffle(seqs, k=2, length_axis=1, seed=1234)
# Calculating GC content
sp.gc_content(seqs, normalize=True)
# Generating random sequences
sp.random_seqs(shape=(N, L), alphabet=sp.alphabets.DNA, seed=1234)
# Randomly jittering sequences
sp.jitter(seqs, max_jitter=128, length_axis=1, seed=1234)
Manipulating coverage
# Collapse coverage to a given bin width
sp.bin_coverage(coverage, bin_width=128, length_axis=1, normalize=False)
# Can jitter coverage and sequences so they stay aligned
sp.jitter((seqs, coverage), max_jitter=128, length_axis=1, seed=1234)
## One-hot encoding
```python
sp.ohe(seqs)
Sequence analysis (analyzers
)
Calculate sequence properties (e.g. GC content)
sp.gc_content(seqs)
sp.nucleotide_content(seqs)
More to come!
All contributions, including bug reports, documentation improvements, and enhancement suggestions are welcome. Everyone within the community is expected to abide by our code of conduct
Preparing sequences for sequence-to-function models
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
Hashes for seqpro-0.1.10-cp38-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2abb5088568ed9326503f27254a64192ca4b553bc5fdceb4b0fe36145323a6fb |
|
MD5 | c62d3991f8c4f125ed4d045f2ca095cb |
|
BLAKE2b-256 | 32e88ede0e28a9333260b970b64954360ea5f822c2c5ead5681fdbb894b6ae98 |