Intelligent NGS Quality Control with automated fix suggestions
Project description
PHREDATOR
Phred-based Quality Assessment Tool for Sequencing Data
A professional, rule-based QC toolkit for NGS (Next-Generation Sequencing) data analysis. Phredator provides intelligent quality control analysis with context-aware recommendations for FastQC reports.
๐ Features
- ๐ Intelligent QC Analysis: Context-aware quality assessment using organism and experiment-specific profiles
- โก Batch Processing: Process hundreds of samples with parallel execution
- ๐งฌ 25+ Organism Profiles: Pre-configured thresholds for human, mouse, E. coli, yeast, and more
- ๐งช Experiment-Specific Rules: Different expectations for WGS, WES, RNA-seq, ChIP-seq, and metagenomics
- ๐ Aggregate Statistics: Mean ยฑ SD for GC%, quality, duplication with outlier detection
- ๐ฏ Smart Recommendations: Context-aware advice (e.g., "DON'T remove duplicates for RNA-seq")
- ๐ค Fuzzy Matching: Natural input like "Human", "RNA seq", "chip-seq" automatically matched
- ๐จ Professional Output: Subread-style terminal display with color-coded status indicators
- ๐ฆ MultiQC Support: Parse and analyze MultiQC aggregate reports
- ๐งช Automated Fixes: Generate trimming/filtering commands with smart parameter detection
๐ Table of Contents
- Installation
- Quick Start
- Usage
- Command Reference
- Parameters
- Output Format
- Organism Profiles
- Experiment Types
- Examples
- Development
- Citation
- License
๐ Installation
From PyPI (Recommended)
pip install phredator
From Source
git clone https://github.com/yourusername/phredator.git
cd phredator
pip install -e .
Requirements
- Python 3.8+
- NumPy
- PyYAML
โก Quick Start
# Single file analysis
phredator parse sample_fastqc.zip --output parsed.json
phredator analyze parsed.json --organism human --experiment-type rnaseq --output analysis.json
# Batch processing (multiple samples)
phredator batch *_fastqc.zip --organism human --experiment-type rnaseq --parallel 4
# List available organisms
phredator list-organisms
# Show usage examples
phredator examples
๐ Usage
Single File Analysis
Step 1: Parse FastQC output
phredator parse sample1_fastqc.zip --output sample1.json
Step 2: Analyze with organism/experiment profiles
phredator analyze sample1.json \
--organism human \
--experiment-type rnaseq \
--output analysis1.json
Step 3: Generate fix suggestions (optional)
phredator fix analysis1.json \
--input-reads sample1.fastq.gz \
--output fixes1.json
Example Output:
โโโโโโโ โโโ โโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโ โโโโโโโโโ โโโโโโโ โโโโโโโ
โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
โโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
โโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโโ โโโ
โโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโโ โโโ โโโ โโโ โโโโโโโ โโโ โโโ
//================================\\
|| QC Analysis Report ||
\\================================//
Sample : SRR29487748
Status : WARN
Profile : Organism: Human (Homo sapiens) | Experiment: RNA Sequencing
//================================\\
|| Quality Assessments ||
\\================================//
[PASS] Per Base Quality : Excellent quality: mean Q=39.4, median Q=40.3
[PASS] Gc Content : Normal GC content: 49.7% (expected ~52.0%)
[WARN] Duplication Levels : High duplication: 86.1% (acceptable for RNA-seq)
[PASS] Adapter Content : Minimal adapter content: 0.55%
[PASS] Overrepresented Sequences : No overrepresented sequences detected
//================================\\
|| Recommendations ||
\\================================//
1. High duplication is normal for RNA-seq (abundant transcripts)
2. DO NOT remove duplicates for RNA-seq - they are real biological signal
Batch Processing
Process multiple samples in one command with aggregate statistics:
Method 1: Direct file list
phredator batch sample1.zip sample2.zip sample3.zip \
--organism human \
--experiment-type rnaseq \
--output-dir batch_results/ \
--parallel 4
Method 2: Using wildcards
phredator batch results/qc/*_fastqc.zip \
--organism human \
--experiment-type chipseq \
--output-dir chipseq_qc/ \
--parallel 8
Method 3: From a list file
# Create sample list
ls /path/to/*_fastqc.zip > samples.txt
# Process all
phredator batch samples.txt \
--organism mouse \
--experiment-type wgs \
--parallel 4
Batch Output:
//================================\\
|| Batch Processing Summary ||
\\================================//
Processed 8/8 samples:
[PASS] 5 (62%)
[WARN] 3 (38%)
[FAIL] 0 (0%)
//================================\\
|| Sample Details ||
\\================================//
[PASS] Sample1_fastqc
[PASS] Per Base Quality : Excellent quality: mean Q=39.4
[PASS] Gc Content : Normal GC content: 49.7%
[PASS] Duplication Levels : Duplication: 81.8% (normal for RNA-seq)
...
//================================\\
|| Average Metrics ||
\\================================//
GC content : 49.6% ยฑ 2.6%
Quality : Q39.3 ยฑ 0.1
Duplication : 81.3% ยฑ 11.1% (normal for RNA-seq)
//================================\\
|| Recommendations ||
\\================================//
1. DO NOT remove duplicates for RNA-seq
2. High duplication is normal for RNA-seq (abundant transcripts)
3. Monitor for potential contamination
MultiQC Integration
Parse MultiQC aggregate reports:
phredator parse multiqc_data/multiqc_data.json --output multiqc_parsed.json
๐ Command Reference
phredator parse
Parse FastQC output or MultiQC JSON.
phredator parse <input> [OPTIONS]
Arguments:
input: Path to FastQC zip/folder or MultiQC JSON file
Options:
--output FILE: Output JSON file (default:parsed.json)--verbose: Enable verbose logging
phredator analyze
Analyze parsed QC data with organism/experiment profiles.
phredator analyze <input_json> [OPTIONS]
Arguments:
input_json: Path to parsed JSON fromparsecommand
Options:
--organism NAME: Organism profile (seelist-organisms)--experiment-type TYPE: Experiment type (wgs,wes,rnaseq,chipseq,metagenomics)--expected-gc FLOAT: Override expected GC% (default: from profile)--output FILE: Output JSON file (default:analysis.json)--verbose: Enable verbose logging
phredator batch
Process multiple samples with parallel execution.
phredator batch <samples...> [OPTIONS]
Arguments:
samples: FastQC files/zips OR path to sample list file
Options:
--organism NAME: Organism profile for all samples--experiment-type TYPE: Experiment type for all samples--output-dir DIR: Output directory (default:batch_output)--parallel N: Number of parallel processes (default: 1)--verbose: Enable verbose logging
phredator list-organisms
List available organism profiles.
phredator list-organisms [OPTIONS]
Options:
--detailed: Show full profile details (GC%, assembly, etc.)
phredator examples
Show comprehensive usage examples.
phredator examples
๐ง Parameters
Organism Profiles
25+ pre-configured organism profiles with expected GC content and quality thresholds:
| Organism | Code | GC% | Notes |
|---|---|---|---|
| Human | human |
41% | Homo sapiens |
| Mouse | mouse |
42% | Mus musculus |
| Rat | rat |
42% | Rattus norvegicus |
| Zebrafish | zebrafish |
36% | Danio rerio |
| Drosophila | drosophila |
42% | D. melanogaster |
| C. elegans | celegans |
36% | Worm model |
| Yeast | yeast |
38% | S. cerevisiae |
| E. coli | ecoli |
51% | Bacteria |
| Arabidopsis | arabidopsis |
36% | Plant model |
| COVID-19 | covid19 |
38% | SARS-CoV-2 |
View all organisms:
phredator list-organisms --detailed
Experiment Types
Different QC expectations for each experiment type:
| Type | Code | Key Characteristics |
|---|---|---|
| Whole Genome Sequencing | wgs |
Low duplication, uniform coverage |
| Whole Exome Sequencing | wes |
Moderate duplication, targeted regions |
| RNA Sequencing | rnaseq |
High duplication OK (abundant transcripts) |
| ChIP Sequencing | chipseq |
Variable duplication, enriched regions |
| Metagenomics | metagenomics |
Variable GC, mixed organisms |
Fuzzy matching supported:
- "RNA seq" โ
rnaseq - "chip-seq" โ
chipseq - "WGS" โ
wgs - "Human" โ
human
๐ Output Format
JSON Output
All commands produce structured JSON output:
{
"sample_name": "SRR29487748",
"overall_status": "WARN",
"profile_info": "Organism: Human | Experiment: RNA-seq",
"metrics": {
"per_base_quality": {
"status": "PASS",
"summary": "Excellent quality: mean Q=39.4, median Q=40.3",
"details": {...}
},
"gc_content": {
"status": "PASS",
"summary": "Normal GC content: 49.7% (expected ~52.0%)",
"details": {...}
}
},
"all_recommendations": [
"High duplication is normal for RNA-seq",
"DO NOT remove duplicates for RNA-seq"
]
}
Log Files
Automatic .log files created alongside JSON outputs with timestamp and full analysis details.
๐ก Examples
Example 1: RNA-seq Quality Control
# Parse 8 RNA-seq samples
phredator batch ~/rnaseq/results/*_fastqc.zip \
--organism human \
--experiment-type rnaseq \
--output-dir rnaseq_qc \
--parallel 4
# Output shows:
# - 5 PASS, 3 WARN, 0 FAIL
# - Average GC: 49.6% ยฑ 2.6%
# - Average Quality: Q39.3 ยฑ 0.1
# - Duplication: 81.3% ยฑ 11.1% (normal for RNA-seq)
# - Recommendations: DON'T remove duplicates
Example 2: ChIP-seq with Adapter Detection
phredator batch ~/chipseq/qc/*_fastqc.zip \
--organism human \
--experiment-type chipseq \
--output-dir chipseq_qc \
--parallel 8
# Output includes:
# - Adapter content warnings
# - Recommendations: "Trim adapters using Cutadapt"
# - Fix commands generated automatically
Example 3: COVID-19 Variant Surveillance
phredator batch sarscov2_samples/*_fastqc.zip \
--organism covid19 \
--experiment-type metagenomics \
--parallel 16
# High quality thresholds (Q30+) enforced
# GC% ~38% expected for SARS-CoV-2
Example 4: MultiQC Integration
# Parse MultiQC aggregate report
phredator parse multiqc_data/multiqc_data.json --output multiqc_summary.json
# Extract metrics for all 100+ samples at once
๐งช Development
Running Tests
# Run comprehensive integration test
pytest tests/test_integration.py -v
# Run with sample data
pytest tests/ -v
Project Structure
phredator/
โโโ phredator/
โ โโโ __init__.py
โ โโโ __main__.py
โ โโโ cli/
โ โ โโโ cli.py # Command-line interface
โ โ โโโ commands.py
โ โโโ parser/
โ โ โโโ fastqc_parser.py # Parse FastQC output
โ โ โโโ multiqc_parser.py # Parse MultiQC JSON
โ โ โโโ batch_processor.py # Batch processing engine
โ โโโ analyzer/
โ โ โโโ qc_analyzer.py # QC analysis engine
โ โโโ rules/
โ โ โโโ qc_rules.py # Rule-based evaluation
โ โโโ fixer/
โ โ โโโ qc_fixer.py # Fix suggestion generator
โ โโโ config/
โ โ โโโ organisms/ # 25+ organism profiles
โ โ โโโ experiment_types/ # Experiment-specific rules
โ โโโ utils/
โ โโโ helpers.py
โโโ tests/
โ โโโ test_integration.py # Comprehensive integration test
โ โโโ test_data/ # Sample FastQC data
โโโ README.md
โโโ setup.py
โโโ requirements.txt
โโโ LICENSE
๐ Citation
If you use Phredator in your research, please cite:
@software{phredator2024,
title={Phredator: Intelligent Quality Control for NGS Data},
author={Your Name},
year={2024},
url={https://github.com/yourusername/phredator}
}
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Contributions welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ Issues
Found a bug? Have a feature request? Please open an issue on GitHub.
๐ง Contact
- Author: Your Name
- Email: your.email@example.com
- GitHub: @yourusername
๐ Acknowledgments
- FastQC team for the excellent QC tool
- MultiQC for aggregate reporting
- Subread for terminal output inspiration
Project details
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 phredator-1.0.0.tar.gz.
File metadata
- Download URL: phredator-1.0.0.tar.gz
- Upload date:
- Size: 53.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19c65c69142bad8c683ea2322f5443fa74ca78cc88047495cefdd7da883a9d48
|
|
| MD5 |
0ce19e5b5bd465ce5ceb3e428fb5c31e
|
|
| BLAKE2b-256 |
b0167745511cf90e43746a61b1e9f9350a9ec9000fedd00f0dfcae1a844534e7
|
File details
Details for the file phredator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: phredator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66556fbfc2701ecf121fb24b1e20ff1dcfca88be4aa2e94d8926a233e2b5c76c
|
|
| MD5 |
a5afdc9bd9189773397e54403efc71ab
|
|
| BLAKE2b-256 |
a5d448499c7577049a7e9f3f48af5288fdae9e6b06825a7fba0a8cc718d949a6
|