Skip to main content

Phasing individual long reads using known haplotype information.

Project description

LRphase

A tool for phasing long-read sequencing results.

LRphase phases long reads based on haplotype data in a VCF file.

Dependencies

All modes:

Simulation mode

Installation

We strongly recommend installing with conda, into a new environment:

conda create -n LRphase_env -c conda-forge -c bioconda numpy pysam powerlaw pyliftover pbsim2 minimap2 requests samtools LRphase python==3.7

Install with pip:

pip install LRphase

Installation from the github repository is not recommended. However, if you must, follow the steps below:

  1. git clone https://github.com/Boyle-Lab/LRphase.git
  2. cd LRphase/
  3. python3.7 -m pip install -e .

Usage

LRphase [-h] [--version] [-q] {phasing,phasability,error_analysis} ...

LRphase currently only runs in Phasing mode, but may also support more modes in future releases.

  1. Phasing mode: Assigns phase to individual long reads based on variants in a VCF file.

Phasing Mode

Tool for phasing individual long reads using haplotype information.

usage: LRphase phasing [-h] -v <VCF_FILE> -i <SAM/BAM/FASTQ>
                       [-o </path/to/output>] [-r <REF_FASTA>]
                       [-A <ASSEMBLY_NAME>] [-t <THREADS>] [-q] [-S]
                       [-O {combined,phase_tagged,full}] [-F FDR_THRESHOLD]
                       [--log_likelihood_threshold <MIN_LIKELIHOOD_RATIO>]

Required Arguments

Argument Description
-v <VCF_FILE>, --vcf <VCF_FILE> Path to vcf file with haplotype information that will be used for phasing. (Must be in .vcf.gz format with tabix index in same folder. If .vcf file is provided, bgzip and tabix must be installed and available on PATH because LRphase will attempt to convert it. EX: -v GM12878_haplotype.vcf.gz)
-i <SAM/BAM/FASTQ> Path to sequencing file (.fasta) or alignment file (.bam or .sam) of long reads that will be used for phasing. If either a .sam file is provided or an index is not found, .sam and .bam file will be sorted and indexed with SAMtools. Sorted.bam files should be in same directory as their index (.sorted.bam.bai). EX: -a data/minion_GM12878_run3.sorted.bam, -i minion_GM12878_run3.sam) Path to long read file in .fastq format that will be used for alignment and phasing (ex: -i minion_GM12878_run3.fastq). **** NOTE: the -r/--reference argument is REQUIRED if using input in fastq format! ****

Optional Arguments

Argument Description
-h, --help Show help message and exit
-o </path/to/output>, --output_directory_name </path/to/output_directory> Output directory name. Name given to directory where results will be output.
-r <REF_FASTA>, --reference <REF_FASTA> Path to reference genome sequence file. REQUIRED if argument to -i a fastq file.
-A <ASSEMBLY_NAME>, --reference_assembly <ASSEMBLY_NAME> Assembly for the reference genome. EX: -A hg38.
-t , --threads Number of threads to use for mapping, sorting, and indexing steps.
-q, --quiet Output to stderr from subprocesses will be muted.
-S, --silent Output to stderr and stdout from subprocesses will be muted.

Output Options

Argument Description
-O {combined,phase_tagged,full}, --output_mode {combined,phase_tagged,full} Specify whether/how phased, unphased, and nonphasable reads are printed to output. Modes available: combined: All reads will be written to a common output file. The phasing tag (HP:i:N) can be used to extract maternal/paternal phased reads, unphased reads, and nonphasable reads. phase_tagged: Phased reads for both maternal and paternal phases will be written to a single output file, while unphased and nonphasable reads will be written to their own respective output files. full: Maternal, paternal, unphased, and nonphasable reads will be printed to separate output files.

Statistical Options for Phasing Mode

Argument Description
-F FDR_THRESHOLD, --FDR_threshold FDR_THRESHOLD Control the false discovery rate at the given value using a negative-binomial estimate of the number of phasing errors (N) given the average per-base sequencing error rate observed among all phaseable reads. Phased reads are sorted by their observed log-likelihood ratios and the bottom N*(1-FDR) reads will be reassigned to the "Unphased" set. Set this to zero to skip this step and return all phasing predictions.
--log_likelihood_threshold <LOG_LIKELIHOOD_THRESHOLD> Use a hard threshold on log-likelihood ratios when phasing reads. Results will only be printed for predicted phasings with log-likelihood ratios equal to or greater than this threshold. Setting this to zero will cause all reads to be assigned to the phase to which they share the greatest number matches. Log-likelihood ratios will still be reported in the output in this case, but are not used for phasing decisions.

Example Dataset

We provide a sample dataset and example usage here

Citing LRphase

The LRphase algorithm and software release 1.0.3 are described in pub link here. Please use the following citation if you use this software in your work:

LRphase: an efficient algorithm for assigning haplotypic identity to long reads. Monica J. Holmes, Babak Mahjour, Christopher Castro, Gregory A. Farnum, Adam G. Diehl, Alan P. Boyle. 2022. BioArxiv. URL

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

LRphase-1.1.2.tar.gz (59.8 kB view details)

Uploaded Source

Built Distribution

LRphase-1.1.2-py3-none-any.whl (59.0 kB view details)

Uploaded Python 3

File details

Details for the file LRphase-1.1.2.tar.gz.

File metadata

  • Download URL: LRphase-1.1.2.tar.gz
  • Upload date:
  • Size: 59.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for LRphase-1.1.2.tar.gz
Algorithm Hash digest
SHA256 b8b1a7d88aa847424fa0644ea60238776098332f194f3128cf912441845275a2
MD5 5f12b273e503c8cc53abdcbf6b75ecea
BLAKE2b-256 45f4f15e00a50b764c931637d562c56d680e38aad2a753c348a67947f9dabc9d

See more details on using hashes here.

File details

Details for the file LRphase-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: LRphase-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 59.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for LRphase-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77fa12fba6aa50a194b03e95332b5613a0290f313751c0a0f82f06315e558af2
MD5 594279c37479df5227e1edfe17ab8727
BLAKE2b-256 b53ced3c4045d224bbb42ad1b83c188998e29fdb71272ce1b6c7f0f41cbba76a

See more details on using hashes here.

Supported by

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