Display FASTA/FASTQ/SAM/VCF files with colored DNA/RNA bases and quality scores in the terminal
Project description
Color DNA/RNA bases and quality scores in terminal output
About
This is a python script to color DNA or RNA sequences in the terminal. It will read lines from STDIN or from a file and color all strings of DNA/RNA it can find. In addition, it can also color phred-encoded quality scores in FASTQ/SAM files.
Format-specific coloring
By default, dnacol will color all strings of [ACGTUN]+. However, it will also recognize a few standard file formats and apply more targeting coloring. When reading a file, these formats will automatically be recognized based on their file extensions. When reading from STDIN, dnacol will try to identify the format based on the data itself (for FASTQ/SAM/VCF files). The format can also be specified using the --format option.
SAM format (--format=sam, automatically enabled when filename ends in .sam or a line matching the SAM format is found)
Ignore headers, color the SEQ column as DNA and the QUAL column as quality scores
FASTQ format (--format=fastq, automatically enabled when filename ends in .fastq or .fq or the first four lines match the FASTQ format)
Color the second line of every read as DNA
Color the fourth line of every read as quality scores
VCF format (--format=vcf, automatically enabled when filename ends in .vcf or a VCF header line is found)
Ignore comments, only color the REF and ALT column
FASTA format (--format=fasta, automatically enabled when filename ends in .fasta or .fa)
Ignore sequence identifiers
Options
-w, --wide wide output (add spaces around each base) -f FORMAT, --format FORMAT file format (auto|text|sam|vcf|fastq|fasta)
Download/Install
To install, use pip:
pip install dnacol
If the system-wide directory is not writable, you can install to your home directory with:
pip install dnacol --user
Alternatively, you can clone this git repository and use the provided setup.py script.
git clone https://github.com/koelling/dnacol.git cd dnacol && python setup.py install
dnacol has been tested with Python 2.7 and Python 3.6.
Examples
#read gzipped file dnacol examples/phix.fa.gz | head #pipe from stdin head examples/reads.txt | dnacol --wide #use `less -R` to display colors in less dnacol examples/phix.fa.gz | less -R
Screenshots
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
File details
Details for the file dnacol-0.3.2.tar.gz
.
File metadata
- Download URL: dnacol-0.3.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d094d80d13c44c7ff6b5a8ca268ba5d18a6a042c709ef7ad8532742381b52d51 |
|
MD5 | f39c5c328f4d8df3cc96dac27a326688 |
|
BLAKE2b-256 | 807791c570ef68486250ecf273608b8838b8c118b9dfa2c87d4d03edf798a1ed |