Skip to main content



floria-strainer: strains out genomes from floria.

Introduction

Given the output of the strain haplotyping software floria1 , floria-strainer computes the allele frequency at each variable position of each haploset identified by floria to cluster them into the different strains composing the mixture, using a Gaussian Mixture Model.

Install

pip install floria-strainer

Quick start

Running floria-strainer on the provided test data

$ floria-strainer -b tests/data/test_short.bam tests/data/floria_out_dir
INFO - Writing the straining informations to floria_strained.strained.csv.
INFO - 2 strains were found: 0, 1
INFO - Writing the BAM file in tag mode to floria_strained.bam.

Visualizing the strain clustering method

  • In this example, short-reads are aligned to a reference genome (fig 1). At each variable position, we can observe a 2 different alleles, which in the case of this haploid organism, corresponds to a mixture of 2 different strains.

  • floria-strainer takes the output of floria, with reads having been assigned to a haploset (fig 2) based on the MEC criteria.

    Expand to see a high level overview of floria

    The haplotyping process floria is conceptually similar to the one of de novo assembly of reads into contigs, where instead of contigs, read haplosets are the results of the flow (ie. least costly path) optimization through the different reads represented as a graph. More details in the floria article 1.

  • Based on the average allele frequency of each haploset, reads are clustered in the different strains. In this example (fig 3), there are two strains of minor and major allele frequency, which floria-strainer clustered in strain 0 and strain 1.

Reads that weren't assigned to any haploset by floria, or whose haploset do not cluster well enough are not assigned to any strain. They are considered to be shared by the different strains present in the alignment.

Fig 1: Reads aligned to the reference genome, visualized in IGV. The top track represents the reference genome, with variants indicated in the different colors.

Fig 2: Reads are grouped and colored by the HP HaPloset tag as annotated by Floria.

Fig 3: Reads are grouped and colored by the ST STrain tag as annotated by floria-strainer.

Help

$floria-strainer --help
                                                                                                                                                                            
 Usage: floria-strainer [OPTIONS] FLORIA_OUTDIR                                                                                                                             
                                                                                                                                                                            
 Strain the haplotypes in the floria output directory.                                                                                                                      
 Author: Maxime Borry                                                                                                                                                       
                                                                                                                                                                            
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│    --version                      Show the version and exit.                                                                                                             │
│    --nb-strains  -n  INTEGER      Number of strains to keep. If 0, the number of strains will be determined by the mean floria average strain count with HAPQ > 15.      │
│                                   [default: 0]                                                                                                                           │
│    --hapq-cut    -h  INTEGER      Minimum HAPQ threshold [default: 15]                                                                                                   │
│    --sp-cut      -s  FLOAT        Minimum strain clustering probability threshold [default: 0.5]                                                                         │
│ *  --bam         -b  PATH         Input BAM file [required]                                                                                                              │
│    --mode        -m  [tag|split]  BAM output mode. Tag: add ST (strain) tags to the reads. Split: split the reads in different BAM files per strain. [default: tag]      │
│ *  --basename    -o  TEXT         Output file basaneme [default: floria_strained] [required]                                                                             │
│    --help                         Show this message and exit.                                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Tests

After cloning/pulling repo

$ pip install poetry pytest
$ poetry run pytest -vv
  1. Floria: fast and accurate strain haplotyping in metagenomes ↩ ↩2

Metadata

Release files for floria-strainer 0.2.1

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

Source distribution (sdist)

Source distribution for floria-strainer 0.2.1
File Size Uploaded Provenance
floria_strainer-0.2.1.tar.gz 19.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for floria-strainer 0.2.1
File Interpreter ABI Platform
floria_strainer-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.3 kB

Release files / floria_strainer-0.2.1.tar.gz

Download URL floria_strainer-0.2.1.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9680ee87186974c4cf2dc05f3bb0c3d5a2783e36673723bd9579da4658bacc91
BLAKE2b-256 checksum
How to use checksums
d88e19d71a7075d8e6ef63bf460de16b08772dcad1f2da68702511eb4d77cf88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1022-azure

Release files / floria_strainer-0.2.1-py3-none-any.whl

Download URL floria_strainer-0.2.1-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8239754c533b4bc70e1f6a21ab0f0384f67e859b9d9c9cbc035ed54dc30b0ea3
BLAKE2b-256 checksum
How to use checksums
019aaca56ae1320275a8efbf90645eb91f52592c9db526c7d2fb4a6343bc0347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1022-azure

Security for floria-strainer 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

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