DirectClean
Strand orientation, artifact removal, and chimeric read rescue for Oxford Nanopore direct-cDNA sequencing.
DirectClean processes raw ONT direct-cDNA FASTQ files and produces clean, oriented reads for transcript quantification, isoform analysis, and gene fusion calling.
DirectClean removes foldback inversion reads, separates reads that cannot be reliably strand-oriented, trims terminal adapter residuals, resolves supported adapter concatemers, and rescues usable sequence from homopolymer-mediated reverse-transcription artifacts.
Quick start
After installation:
directclean \
-i raw_reads.fastq \
-r genome.fa \
-o results/ \
-t 8 \
-j gencode.v41.bed12
The primary output is:
results/directclean.cleaned.fastq
An interactive HTML report is generated by default.
Performance on VCaP direct-cDNA data
Tested on 5.35 million reads from the VCaP prostate cancer cell line:
| Metric | Pychopper | DirectClean |
|---|---|---|
| Output-record yield | 57.6% | 65.3% |
| Residual homopolymer-junction calls detected by DirectClean | 70,140 | 0 |
Interpreting read counts
DirectClean may trim or split reads while preserving usable transcript sequence. The number of output FASTQ records is therefore not equivalent to molecular retention. Use retained bases together with output-record yield when comparing runs or preprocessing tools.
Why DirectClean?
Oxford Nanopore's Pychopper handles strand orientation and terminal-primer-based read rescue, but direct-cDNA library preparation introduces additional artifact types that require separate treatment.
- Foldback inversions: the sequenced strand folds back on itself, producing a self-inverted chimeric read.
- Terminal and internal adapter structures: adapter-associated sequence may represent a terminal residual or a supported concatemer junction. DirectClean trims unsupported terminal residuals and splits supported internal concatemers.
- Homopolymer-mediated RT template switching: during reverse transcription, the RT enzyme detaches at an A/T-rich region on one RNA molecule and re-primes on another, joining unrelated transcripts into a single chimeric read. These events can generate false fusion candidates and affect isoform quantification.
- Unclassified reads: some reads set aside by Restrander can still be recovered when their sub-reads contain enough sequence evidence for orientation.
DirectClean integrates Breakinator and Restrander with adapter- and homopolymer-aware rescue steps in a single workflow.
Feature comparison
| Capability | Pychopper | DirectClean |
|---|---|---|
| Strand orientation | ✅ | ✅ |
| Internal adapter handling | Terminal-primer based | Terminal trimming and supported concatemer splitting |
| Foldback inversion removal | ❌ | ✅ |
| Homopolymer RT template-switching detection | ❌ | ✅ |
| Rescue from unclassified reads | ❌ | ✅ |
Pipeline architecture
| Stage | Name | What it does |
|---|---|---|
| 1 | Breakinator | Remove foldback inversion artifacts |
| 2 | Restrander | Orient reads 5′→3′, remove RTP-RTP / TSO-TSO artifacts, and set aside unorientable reads |
| 3 | Unknowns Rescue | Recover orientable sub-reads from Restrander unknowns through adapter detection and sequence-based orientation |
| 4 | Adapter Rescue | Trim unsupported terminal adapter residuals and split supported internal concatemers in oriented reads |
| 5 | Homopolymer Rescue | Detect homopolymer-mediated RT template-switching junctions and retain eligible flanking sub-reads |
A splice-aware minimap2 alignment is performed between Adapter Rescue and Homopolymer Rescue so that chimeric genomic junctions can be evaluated.
Stages 3–5 are designed to preserve usable transcript sequence rather than discard an entire read whenever an artifact junction is detected. Depending on the available evidence, DirectClean may trim a terminal adapter residual, split a supported concatemer, rescue orientable sub-reads, or discard fragments that are too short or lack sufficient evidence.
How Adapter Rescue works
DirectClean searches oriented reads for adapter-associated structures using internal poly(A), RTP reverse-complement, and TSO signals.
A detected adapter structure is used as a chop point, but not every resulting fragment is automatically treated as an independent molecule.
- A terminal segment without downstream TSO support can be trimmed as an adapter residual.
- A TSO-supported internal junction can be split into independent sub-reads.
- Eligible fragments must also pass the minimum segment-length requirement.
This prevents fixed-length terminal adapter sequence from being reported as a rescued transcript while retaining supported concatemer-derived sequence.
How the homopolymer detector works
After splice-aware alignment, DirectClean identifies chimeric reads with supplementary alignments mapping to different genomic loci. For each chimeric junction, a 10 bp sliding window scans the flanking sequence on both sides.
A junction is flagged as an RT template-switching artifact if any window satisfies both criteria:
- A/T base density ≥ 85%
- Longest consecutive A or T run ≥ 5 bp
Flagged reads are chopped at the artifact junction. Sub-reads ≥100 bp are written to the output; shorter fragments are discarded. Junctions involving non-standard contigs, including alt loci and unplaced scaffolds, are excluded through a standard-chromosome whitelist.
Installation
Prerequisites
DirectClean requires:
- conda or mamba for environment management. Miniforge is recommended.
- Poetry for installing the DirectClean Python package. See the Poetry installation guide.
Install DirectClean
git clone https://github.com/ylab-hi/DirectClean.git
cd DirectClean
mamba env create -f environment.yml
mamba activate directclean
poetry install
directclean --help
The conda environment installs the required external tools, including minimap2, samtools, Breakinator, and Restrander.
Install external tools separately
To install the external tools outside the provided environment:
mamba install -c bioconda minimap2 samtools breakinator
mamba install -c genomedk restrander
Usage
directclean \
-i raw_reads.fastq \
-r genome.fa \
-o results/ \
-t 8 \
-j gencode.v41.bed12
The -j option provides a junction BED file for guided alignment. A GENCODE annotation in BED12 format is recommended.
Run the following command for the full list of options:
directclean --help
Key parameters
| Flag | Default | Description |
|---|---|---|
-i, --input |
required | Raw FASTQ from ONT direct-cDNA sequencing |
-r, --reference |
required | Reference genome FASTA |
-o, --output |
required | Output directory |
-t, --threads |
4 | Threads for minimap2, samtools, and Breakinator |
-j, --junc-bed |
none | Junction BED12 file for guided alignment |
--density-threshold |
0.85 | A/T density threshold for homopolymer detection |
--min-run |
5 | Minimum consecutive A/T run length |
--min-confidence |
2 | Minimum number of adapter signals required for chopping |
--context-window |
50 | Bases flanking each junction for homopolymer scanning |
--html-report, --no-html-report |
on | Generate or disable the interactive HTML report |
Output
With the default prefix, DirectClean produces:
results/
├── directclean.cleaned.fastq
├── directclean.rescued.fastq
├── directclean.homopolymer_report.tsv
├── directclean.report.html
├── intermediates/
│ ├── directclean.no_foldback.fastq
│ ├── directclean.restranded.fastq
│ ├── directclean.unknowns_rescued.fastq
│ ├── directclean.rescued.fastq
│ ├── directclean.merged.fastq
│ └── directclean.aligned.bam
└── reports/
└── directclean.rescue_report.tsv
Main files
-
directclean.cleaned.fastq
Final artifact-resolved FASTQ for downstream analysis. -
directclean.rescued.fastq
Sub-reads generated specifically during Stage 5 Homopolymer Rescue. -
directclean.homopolymer_report.tsv
Per-read classification of homopolymer-associated chimeric junctions. -
directclean.report.html
Interactive summary of pipeline statistics and read flow. Generated by default. -
reports/directclean.rescue_report.tsv
Per-read details from Stage 4 Adapter Rescue.
About the two rescued.fastq files
The two files named directclean.rescued.fastq serve different purposes:
intermediates/directclean.rescued.fastqis the output of Stage 4 Adapter Rescue and contains the complete read set after adapter-structure handling.- The top-level
directclean.rescued.fastqcontains only sub-reads generated during Stage 5 Homopolymer Rescue.
For transcript quantification, isoform analysis, and fusion calling, use:
directclean.cleaned.fastq
HTML report
DirectClean generates an interactive HTML report with per-stage statistics and a read-flow visualization.
Use --no-html-report to disable report generation.
Downstream analysis
The final cleaned FASTQ can be used with long-read transcript analysis and fusion-calling tools, including:
Citation
If you use DirectClean in your research, please cite the DirectClean manuscript together with the foundational tools integrated into the pipeline:
- DirectClean: Guo, Q., Li, Y., & Yang, R. (2026). DirectClean: a comprehensive preprocessing toolkit for Oxford Nanopore direct-cDNA sequencing. Manuscript in preparation.
- Breakinator: Heinz, J. M., Meyerson, M., & Li, H. (2026). Detecting foldback artifacts in long reads. BMC Genomics.
- Restrander: Schuster, J., Ritchie, M. E., & Gouil, Q. (2023). Restrander: rapid orientation and artefact removal for long-read cDNA data. NAR Genomics and Bioinformatics, 5(4), lqad108.
License
MIT
Contact
- Qingxiang Guo — qingxiang.guo@northwestern.edu
- Rendong Yang Lab — https://github.com/ylab-hi
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 directclean-1.1.0.tar.gz.
File metadata
- Download URL: directclean-1.1.0.tar.gz
- Upload date:
- Size: 65.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.2 CPython/3.10.8 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6628bb4b8939f4cebce80277779ae7a444fc2b24f22935b24925930620f5806
|
|
| MD5 |
4430eb86090414c34dc7ae6abc7ef6f2
|
|
| BLAKE2b-256 |
82b47a922a51776f981813b389e7403142f203ed01d68774ae99e0c5444c5313
|
File details
Details for the file directclean-1.1.0-py3-none-any.whl.
File metadata
- Download URL: directclean-1.1.0-py3-none-any.whl
- Upload date:
- Size: 74.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.2 CPython/3.10.8 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62cf1c7a55bb814cf902afef29a5e27c960ac66e0baa23615b2eb4a7a6b5dad4
|
|
| MD5 |
a3b69baf31cf667746f560d51a34ee96
|
|
| BLAKE2b-256 |
9da66a43c170fd1565020725900fe7d2836d2ebabb2c0b43ad2cfc28bde3ac6e
|