Skip to main content

seq_tools

PyPI version Python 3.9+ Tests Code style: black License

A Python package for manipulating and analyzing nucleic acid sequences (DNA and RNA) in pandas DataFrames.

Features

  • Batch operations: Work with sequences in pandas DataFrames for efficient processing
  • Sequence manipulation: Convert between DNA/RNA, reverse complement, add sequences
  • Structure prediction: Fold RNA sequences using ViennaRNA
  • Analysis tools: Calculate molecular weights, extinction coefficients, edit distances
  • CLI interface: Command-line tools for quick sequence operations
  • Python API: Full programmatic access to all functionality

Installation

pip install rna_seq_tools

Quick Start

Command Line Interface

# Get help
seq-tools --help

# Convert RNA to DNA
seq-tools to-dna "AUCG"

# Fold RNA sequence
seq-tools fold "GGGGUUUUCCCC"

# Calculate molecular weight
seq-tools mw "ATCG"

Python API

import pandas as pd
from seq_tools import sequences_to_dataframe, fold, get_molecular_weight_df, to_rna_df

# Create a DataFrame from sequences
sequences = ["ATCG", "GCTA", "AAAA"]
df = sequences_to_dataframe(sequences)

# Convert to RNA
df = to_rna_df(df)

# Fold RNA sequences
df = fold(df)

# Calculate molecular weights
df = get_molecular_weight_df(df, "RNA", double_stranded=False)

print(df)

Single Sequence Functions

For single sequence operations, import from the sequence module:

from seq_tools.sequence import to_dna, to_rna, get_reverse_complement, get_molecular_weight

# Convert sequences
rna_seq = to_rna("ATCG")  # Returns "AUCG"
dna_seq = to_dna("AUCG")  # Returns "ATCG"

# Reverse complement
rc = get_reverse_complement("ATCG", "DNA")  # Returns "CGAT"

# Molecular weight
mw = get_molecular_weight("ATCG", "DNA")  # Returns 1307.80

CLI Commands

add

Add a sequence to the 5' and/or 3' end of sequences.

seq-tools add -p5 "AAAA" "GGGGUUUUCCCC"
seq-tools add -p5 "AAAA" -p3 "CCCC" input.csv

ec

Calculate the extinction coefficient for each sequence.

seq-tools ec "GGGGUUUUCCCC"
seq-tools ec input.csv -nt RNA -ds  # RNA, double-stranded

edit-distance

Calculate the average edit distance of a sequence library.

seq-tools edit-distance input.csv
seq-tools edit-distance input.csv --parallel --workers 4

fold

Fold RNA sequences using ViennaRNA.

seq-tools fold "GGGGUUUUCCCC"
seq-tools fold input.csv

mw

Calculate the molecular weight for each sequence.

seq-tools mw "ATCG"
seq-tools mw input.csv -nt DNA -ds  # DNA, double-stranded

rc

Calculate reverse complement for each sequence.

seq-tools rc "ATCG"
seq-tools rc input.csv -nt DNA

to-dna

Convert RNA sequences to DNA (replace U with T).

seq-tools to-dna "AUCG"
seq-tools to-dna input.csv -o output.csv

to-dna-template

Convert RNA sequences to DNA template with T7 promoter.

seq-tools to-dna-template "AUCG"
seq-tools to-dna-template input.csv

to-rna

Convert DNA sequences to RNA (replace T with U).

seq-tools to-rna "ATCG"
seq-tools to-rna input.csv

transcribe

Transcribe DNA template sequences to RNA (removes T7 promoter).

seq-tools transcribe input.csv

trim

Trim 5'/3' ends of sequences.

seq-tools trim input.csv --start 5 --end 3

to-fasta

Generate FASTA file from CSV.

seq-tools to-fasta input.csv output.fasta

to-opool

Generate oligo pool file (Excel) from CSV.

seq-tools to-opool input.csv "pool_name" output.xlsx

DataFrame Functions

The package provides comprehensive DataFrame operations:

  • Conversion: to_dna_df(), to_rna_df(), to_dna_template_df()
  • Analysis: get_molecular_weight_df(), get_extinction_coeff(), get_length()
  • Structure: fold() - predict RNA secondary structures
  • Manipulation: add(), trim(), get_reverse_complement_df()
  • Generation: generate_random_sequences(), generate_mutated_sequences()
  • Validation: has_t7_promoter(), has_5p_sequence(), has_3p_sequence()
  • File I/O: to_fasta(), to_opool()

See the notebooks directory for detailed examples.

Requirements

  • Python 3.9+
  • pandas
  • numpy
  • ViennaRNA (for structure prediction)
  • editdistance
  • click
  • tabulate

Tutorial Notebooks

Interactive Jupyter notebooks are available in the notebooks/ directory:

  • 01_introduction.ipynb: Package overview and quick start
  • 02_sequence_operations.ipynb: Working with individual sequences
  • 03_structure_analysis.ipynb: RNA folding and structure analysis
  • 04_dataframe_operations.ipynb: Batch processing with DataFrames
  • 05_advanced_features.ipynb: Advanced features and workflows

See the notebooks README for more details.

Development

# Clone the repository
git clone https://github.com/jyesselm/seq_tools.git
cd seq_tools

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in editable mode
pip install -e .

# Run tests
pytest test/ -v

License

This project is licensed under a Non-Commercial License. Commercial use is prohibited. See LICENSE file for details.

For commercial licensing inquiries, please contact jyesselm@unl.edu.

Author

Joe Yesselman - jyesselm@unl.edu

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Release files for rna-seq-tools 0.10.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 rna-seq-tools 0.10.0
File Size Uploaded
rna_seq_tools-0.10.0.tar.gz 569.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rna-seq-tools 0.10.0
File Interpreter ABI Platform
rna_seq_tools-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 594.7 kB

Release files / rna_seq_tools-0.10.0.tar.gz

Download URL rna_seq_tools-0.10.0.tar.gz
Size 569.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2717af156759eed32c78d837b967a0583895613096dfe4b53d2449096cfde26c
BLAKE2b-256 checksum
How to use checksums
21efde59f387ea5dfe5caa14c7e036ed9ca0f26e7b27ce1821d92a57f51314f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / rna_seq_tools-0.10.0-py3-none-any.whl

Download URL rna_seq_tools-0.10.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b192a58b1755f2a4c55bcaac5bd81cf01ecfa3e4411f7b60d69cd54c1a51f94e
BLAKE2b-256 checksum
How to use checksums
736b629158ad2d7d096080ea44405ce191cad1b01fc0215677045c6e853ed61c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.0

3 release files

0.1.0

2 release files

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