ngs-analysis
Convenient analysis of sequencing reads that span multiple DNA or protein parts. For instance, given a library of protein variants linked to DNA barcodes, this tool can answer questions like:
- How accurate are the variant sequences, at the DNA or protein level?
- How frequently is the same barcode linked to two different variants?
- Which reads contain parts required for function (e.g., a kozak start sequence, or a fused protein tag)?
This kind of analysis often involves parsing raw sequencing reads for DNA and/or protein sub-sequences (parts), then mapping the parts to a reference of anticipated part combinations. Here the workflow is:
- Define how to parse reads into parts using plain text expressions (no code)
- Parse your anticipated DNA sequences to generate a reference
- Parse a batch of sequencing samples
- Map the parts found in each read to the reference
It’s been tested with Illumina paired-end reads and Oxford Nanopore long reads. Under the hood it uses NGmerge to merge paired reads and MMseqs2 for sequencing mapping. It is moderately performant: 1 million paired-end reads can be mapped to a reference of 100,000 variant-barcode pairs in ~1 minute.
Workflow
A cartoon example with two reference sequences, each consisting of a variant linked to a barcode:
Here's the analysis workflow and outputs:
Note that in the last two columns, the parsed variant is mapped to a reference variant defined by the barcode present in the same read, rather than all possible reference variants. Check out the example notebook for paired end reads for details.
TL;DR
Run ngs-analysis --help to see available commands.
- Make an empty directory, add
config.yamlandsamples.csvbased on the example. - Add
reference_dna.csvwith anticipated DNA sequences (including adapters). - Run
ngs-analysis setup. Add--cleanto start the analysis from scratch. - Check that
designs.csvis accurate; if not, fixconfig.yaml. -
- If you have paired-end data, put it in
0_paired_reads/and runngs-analysis merge_read_pairs <sample>. - If you have single-end data (e.g., nanopore), put it in
1_reads/.
- If you have paired-end data, put it in
- Run
ngs-analysis parse_reads <sample>. Check that2_parsed/<sample>.parsed.pqlooks alright (with pandas, usepd.read_parquet) - Run
ngs-analysis map_parsed_reads <sample>. Results are in3_mapped/<sample>.mapped.csv
Simulation mode
Debugging complex read structures and experimental layouts can be tricky. For example, your config.yaml might parse reference sequences incorrectly, or samples might map to the reference in an unexpected way (e.g., if the same barcode is attached to different variants).
Before running an analysis (or designing an experiment), you can simulate the results by defining sample_plan.csv and running simulate_single_reads or simulate_paired_reads, which have options to add simple random mutations and variable coverage per subpool.
Here's sample_plan.csv from the paired read example. Note that "source" refers to the optional "source" column in reference_DNA.csv.
| sample | source | coverage |
|---|---|---|
| sample_A | pool1 | 50 |
| sample_B | pool2 | 50 |
| sample_C | pool1 | 50 |
| sample_C | pool2 | 20 |
| sample_D | pool3 | 50 |
To analyze the simulated data, just add the --simulate flag to merge_read_pairs, parse_reads, map_parsed_reads, and plot. Results will be saved to {step}/simulate/{sample} rather than {step}/{sample}.
Install
pip install ngs-analysis
Make sure that the mmseqs and NGmerge executables are available (NGmerge is only needed for paired reads).
On Linux and Intel-based MacOS, you can use conda install -c bioconda -c conda-forge mmseqs2 ngmerge. On Apple Silicon mmseqs can be installed via Homebrew with brew install mmseqs2, and NGmerge can be installed from source, or via brew install brewsci/bio/ngmerge.
Tested on Linux and MacOS (Apple Silicon).
Metadata
Release files for ngs-analysis 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ngs-analysis-0.0.6.tar.gz | 24.2 kB | Without provenance | Details for ngs-analysis-0.0.6.tar.gz |
Release files / ngs-analysis-0.0.6.tar.gz
| Download URL | ngs-analysis-0.0.6.tar.gz |
|---|---|
| Size | 24.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cce2845975c7ddf4225623216cef45837a3b43897e620963657a94b12dc541b9
|
|
BLAKE2b-256 checksum How to use checksums |
f655d36ec35e3c068a77f581ca110abdbe47b8a235e9b51fd3f1f25c955026b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for ngs-analysis 0.0.6
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.