Analyze deep sequencing of complex libraries
Project description
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.yaml
andsamples.csv
based on the example. - Add
reference_dna.csv
with anticipated DNA sequences (including adapters). - Run
ngs-analysis setup
. Add--clean
to start the analysis from scratch. - Check that
designs.csv
is 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.pq
looks 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).
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
File details
Details for the file ngs-analysis-0.0.6.tar.gz
.
File metadata
- Download URL: ngs-analysis-0.0.6.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cce2845975c7ddf4225623216cef45837a3b43897e620963657a94b12dc541b9 |
|
MD5 | 2baf0eb0496d1eca2708ce23bfece50e |
|
BLAKE2b-256 | f655d36ec35e3c068a77f581ca110abdbe47b8a235e9b51fd3f1f25c955026b9 |