Skip to main content

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

Release files for LRphase 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for LRphase 1.1.2
File Size Uploaded
LRphase-1.1.2.tar.gz 59.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LRphase 1.1.2
File Interpreter ABI Platform
LRphase-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 118.8 kB

Release files / LRphase-1.1.2.tar.gz

Download URL LRphase-1.1.2.tar.gz
Size 59.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b8b1a7d88aa847424fa0644ea60238776098332f194f3128cf912441845275a2
BLAKE2b-256 checksum
How to use checksums
45f4f15e00a50b764c931637d562c56d680e38aad2a753c348a67947f9dabc9d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / LRphase-1.1.2-py3-none-any.whl

Download URL LRphase-1.1.2-py3-none-any.whl
Size 59.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77fa12fba6aa50a194b03e95332b5613a0290f313751c0a0f82f06315e558af2
BLAKE2b-256 checksum
How to use checksums
b53ced3c4045d224bbb42ad1b83c188998e29fdb71272ce1b6c7f0f41cbba76a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.7.10

2 release files

0.7.9

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.5.9

1 release file

0.3.5.8

1 release file

0.3.5.7

1 release file

0.3.5.6

1 release file

0.3.5.5

1 release file

0.3.5.4

1 release file

0.3.5.3

1 release file

0.3.5.2

1 release file

0.3.5.1

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page