Skip to main content

Deduplicate haplotigs from complex diploid genomes

Project description

Deduplicator

Overview

Dedup is a Python-based tool designed to deduplicate contigs based on k-mer frequency. It processes genomic assembly files and reads, identifies duplicated regions, and outputs a deduplicated assembly.

Methodology

  • Analyzes k-mers in assembly and reads.
  • Identifies candidate pairs of contigs for deduplication.
  • Performs self-alignment of the assembly.
  • Deduplicates contigs based on alignment and k-mer analysis.
  • Outputs deduplicated contigs and statistics.

Installation

To use the Deduplicator, you need to have the following dependencies installed:

  • Python 3.x
  • pandas
  • numpy
  • seaborn
  • scipy
  • matplotlib
  • plotly
  • BioPython
  • datasketch
  • cProfile
  • pstats

You can install the required Python packages using pip:

pip install pandas numpy seaborn scipy matplotlib plotly biopython datasketch

Usage

To run Dedup, use the following command:

python deduplicator.py --reads <reads_file> --assembly <assembly_file> [options]

Command Line Arguments

  • --reads: Path to the reads file (required).
  • --assembly: Path to the assembly file (required).
  • --prefix: Prefix for output files (default: dedup).
  • --kmer_size: Size of the k-mer (default: 17).
  • --threads: Number of threads to use (default: 1).
  • --homozygous_lower_bound: Lower bound for k-mer frequency of homozygous peak.
  • --homozygous_upper_bound: Upper bound for k-mer frequency of homozygous peak.
  • --save_tmp: Save temporary files (default: false).
  • --tmp_dir: Directory for temporary files (default: .tmp).
  • --log_level: Set the logging level (default: DEBUG).

Advanced Options

  • --full_duplication_threshold: Deduplicate whole contig if contig is this duplicated (fraction 0-1) (default: 0.9).
  • --containment_threshold: Fraction of duplicated k-mers that are required to be shared between contigs to consider them as candidate duplicates (default: 0.2).
  • --end_buffer: If contig is marked duplicated within end_buffer base pairs of edge of contig, extend duplication to edge (default: 25000).
  • --duplicate_kmer_lower_count: Lower bound for k-mer count in assembly to be considered duplicated (default: 2).
  • --duplicate_kmer_upper_count: Upper bound for k-mer count in assembly to be considered duplicated (default: 4).
  • --alignment_max_gap: Maximum bp length of gap to extend alignment over (default: 25000).
  • --alignment_match_weight: Alignment match scoring weight (default: 0.2).
  • --alignment_min_coverage: Minimum duplication coverage for alignment (default: 0.2).
  • --min_kmer_depth: Lowest frequency k-mer to consider for k-mer histogram fitting (default: 10).
  • --max_kmer_depth: Highest frequency k-mer to consider for k-mer histogram fitting (default: 200).

Example

python deduplicator.py --reads reads.fasta --assembly assembly.fasta --prefix output --threads 4 --log_level INFO

Output

The Deduplicator will generate the following output files:

  • deduplicated_contigs.fasta: The deduplicated contigs.
  • deduplicated_stats.csv: Statistics of the deduplicated contigs.
  • candidate_alignments.paf: Candidate alignments for deduplication.
  • best_alignments.paf: Best alignments used for deduplication.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

Contact

For any questions or issues, please contact the project maintainer.


This README provides a basic overview of the Deduplicator tool, its features, installation instructions, usage, and output. For more detailed information, please refer to the source code and comments within the code.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dedup_assembly-1.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dedup_assembly-1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file dedup_assembly-1.0.tar.gz.

File metadata

  • Download URL: dedup_assembly-1.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.16

File hashes

Hashes for dedup_assembly-1.0.tar.gz
Algorithm Hash digest
SHA256 f9ebcd135a85f72948773f34e10943ecdc4cdd769f0b0cfeba9d9ceb2ad04028
MD5 819b359c7bbb041cf250b3794e53c09d
BLAKE2b-256 f88e0ce2ad954d6ea445277e6f08cb7fec75146f5e3a9367b8ed7ade6bacc047

See more details on using hashes here.

File details

Details for the file dedup_assembly-1.0-py3-none-any.whl.

File metadata

  • Download URL: dedup_assembly-1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.16

File hashes

Hashes for dedup_assembly-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d7403b62d720aab2cbd5ef539b4a53c9de12ed397aae8878abce45ff4f7cf37
MD5 2a011b60ff03447ade559416b1dbb14e
BLAKE2b-256 6dc2b4e5e5989419ea0f5bd7fcc17269a61ef94879a126b18c573ee2b0167725

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page