Skip to main content

Add your description here

Project description

sort-contigs

sort-contigs - Order genome assembly contigs by alignment to reference .fasta

Author: Paul Grablowitz

Source: Github

Description

This python program, sort-contigs, sorts contigs from a query FASTA file based on their alignment to a target reference genome using a PAF (Pairwise Alignments Format) file.

It determines the best matching target contig and optimal orientation (forward or reverse complement) for each query contig, then orders the query contigs along each target contig according to their alignment positions. Unaligned contigs are appended at the end.

Query contigs are assigned to target contigs by identifying the target contigs with the largest sum of aligned bases. Assigned query contigs are ordered along a target contig by identifying the location with the longest alignment. The same alignment is used to define optimal orientation of query contigs respective to assigned target contigs.

The sorted contigs are written to an output FASTA file, with an option to rename them sequentially.

The script uses BioPython for FASTA handling and pandas for PAF file processing.

Usage

The program can be used as in following example:

Alignment

The first step consists of aligning the query genome to the target reference. The code below is a minimal example and may be required to be adjusted for certain conditions.

# Align query assembly to target genome
minimap2 \
	-x asm5 \
	target.fasta \
	query.fasta \
	> alignment.paf

Reordering

The following code shows an example, how to perform reordering of query contigs respective to alignment to target reference.

# Perform reordering steps based on supplied alignment
sort-contigs \
	-p alignment.paf \
	-q query.fasta \
	-t target.fasta \
	-o query-reordered.fasta

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

sort_contigs-0.2.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

sort_contigs-0.2.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file sort_contigs-0.2.2.tar.gz.

File metadata

  • Download URL: sort_contigs-0.2.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sort_contigs-0.2.2.tar.gz
Algorithm Hash digest
SHA256 93e4c6633ccc7460a8b4e3e7b535816fb79c40153cc234526d2be8394bb916eb
MD5 8cf6df384ba8d3fec451ecabee6edc04
BLAKE2b-256 2758d387bd8ca772f4417465b3293d57ab2ade36943bc883dec15eec2fd78b6b

See more details on using hashes here.

File details

Details for the file sort_contigs-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sort_contigs-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sort_contigs-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c464f6038a749f8e134dc5fcdf6531e56db11ae8f166be82c7df68b926825218
MD5 9097388df14a73cadb51f1914a979f3e
BLAKE2b-256 3b98e920b98a1c6df0f5a701bab70ad6339b69c602e91e984ef399b54d61babf

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