Skip to main content

Generic toolkit for processing DNA polymorphism data

Project description

adagenes

AdaGenes

pipeline commits license coverage python_version release

AdaGenes is a generic toolkit for processing, annotating, filtering and transforming DNA polymorphism data.

Main features:

  • A powerful data object to store and edit DNA mutation data
  • Functionality to read and write files in common genomics file formats, including VCF, MAF, CSV/TSV, XLSX and plain text files
  • Effective variant filtering according to specific threshold or feature values
  • Liftover genome positions between hg38/GRCh38, hg19/GRCh37 and T2T-CHM13 reference genomes
  • Effective variant normalization in VCF and HGVS notation
  • VCF conversions: Generate VCF files from your own custom formatted CSV or Excel files

The AdaGenes server

AdaGenes is both usable as a web application or as a Python package.

To install the AdaGenes server, clone the repository. Then change into the directory, install the dependencies and start the Flask server:

git clone https://gitlab.gwdg.de/MedBioinf/mtb/adagenes.git
cd adagenes
pip install -r requirements.txt
python3 flask_app.py

Return to your main directory, then clone the AdaGenes web frontend (https://gitlab.gwdg.de/MedBioinf/mtb/adagenes-front-end):

cd ..
git clone https://gitlab.gwdg.de/MedBioinf/mtb/adagenes-front-end.git

To start the AdaGenes front end manually, change into the directory of the repository and start the Vue.js application:

cd adagenes-front-end
npm run dev

To start the server and the web front end using Docker, build and run the Docker containers:

cd adagenes
docker build -t adagenes-server -f Dockerfile 
docker run --name adagenes-server adagenes-server

cd ../adagenes-frontend
docker build -t adagenes-front-end -f Dockerfile .
docker run --name adagenes-front-end adagenes-front-end

For detailed installation instructions of the AdaGenes front end, please see the README (https://gitlab.gwdg.de/MedBioinf/mtb/adagenes-front-end/-/blob/main/README.md?ref_type=heads).

Configuration

By default, AdaGenes accesses the public modules of Onkopus and SeqCAT to annotate variants. To use AdaGenes entirely locally, install Onkopus and SeqCAT locally (https://gitlab.gwdg.de/MedBioinf/mtb/onkopus/onkopus, https://gitlab.gwdg.de/MedBioinf/mtb/seqcat).

Configure the AdaGenes server to use locally installed Onkopus annotation modules, define the Onkopus environment variables ONKOPUS_MODULE_PROTOCOL, ONKOPUS_MODULE_SERVER and ONKOPUS_PORTS_ACTIVE:

# Run AdaGenes using Docker
docker run --env ONKOPUS_MODULE_PROTOCOL=http --env ONKOPUS_MODULE_SERVER=localhost --env ONKOPUS_PORTS_ACTIVE=1 --name adagenes-server adagenes-server

# Run AdaGenes locally
export ONKOPUS_MODULE_PROTOCOL=http
export ONKOPUS_MODULE_SERVER=localhost
export ONKOPUS_PORTS_ACTIVE=1

Use AdaGenes with Python

If using AdaGenes as a python package, you can install AdaGenes in Python directly via PyPI:

pip install adagenes

Reading files

Start by reading in a data file in one of the supported file formats in a biomarker frame with the read_file() function. adagenes automatically identifies the file type and inititates the corresponding file reader. You may also manually inititate a file reader and call its read_file() function:

import adagenes as ag

bframe = ag.read_file("data/somaticMutations.vcf")

# Print biomarker identifiers
print(bframe.get_ids())

# Print loaded variant data completely
print(bframe.data)

Instead of loading a variant file, you may also create a biomarker frame manually at genomic or protein level:

import adagenes as ag

# create biomarker frame based on variants at genomic level
bframe = ag.BiomarkerFrame(data=["chr7:g.140753336A>T"])

If the variant data has been parsed correctly, the data of the biomarker frame should be a nested JSON dictionary:

{
'chr7:140753336A>T': {'variant_data': {'CHROM': '7', 'POS': '140753336', 'ID': '.', 'REF': 'A', 'ALT': 'T', 'QUAL': '100', ... },
'chr1:2556664C>.': {'variant_data': {'CHROM': '1', 'POS': '2556664', 'ID': '.', ... } }
}

Liftover

Convert the genomic positions of variants between genome assemblies with the liftover function (GRCh37 / GRCh38 / T2T-CHM13):

For large variant files, you can use the AdaGenes process_file() function for stream-based processing:

import adagenes as ag

infile = "somaticMutations.vcf"
outfile = "somaticMutations.t2t.vcf"

client = ag.LiftoverClient(genome_version="hg19", target_genome="t2t")
ag.process_file(infile, outfile, client)

For small to medium sized variant files, you can load and edit the variant data as a biomarker frame:

import adagenes as ag

# Load a biomarker frame by defining the genome version (hg19/hg38/t2t)
infile = "somaticMutations.vcf"
bframe = ag.read_file(infile, genome_version="hg38")

# Liftover to another genome assemly
bframe_t2t = ag.liftover(bframe, target_genome="t2t")

# Write the new biomarker frame in T2T to a file
ag.write_file("somaticMutations.t2t.vcf", bframe_t2t)

Filter mutations

Annotate variants

Use Onkopus to annotate variants from the command line, e.g.

import adagenes as ag
import onkopus as op

bframe = ag.read_file("somaticMutations.vcf", genome_version="hg38")

bframe.data = op.PathogenicityClient(genome_version="hg38").process_data(bframe.data)

ag.write_file(bframe, "somaticMutations.annotated.vcf")

For further details on how to annotate variants, check out the Onkopus documentation.

Annotate variants

You can easily annotate variant data by combining an AdaGenes biomarker frame with the Onkopus annotation framework:

pip install onkopus

Annotate the variant data of a biomarker frame by calling an Onkopus client directly on the bframe.data:

import adagenes as ag
import onkopus as op

genome_version="hg38"
bframe = ag.read_file("somaticMutations.vcf", genome_version="hg38")

# Annotate with all Onkopus modules
bframe.data = op.annotate(bframe.data)

# Annotate with specific modules
bframe.data = op.AlphaMissenseClient(genome_version=genome_version).process_data(bframe.data)
bframe.data = op.GENCODEClient(genome_version=genome_version).process_data(bframe.data)

ag.write_file("somaticMutations.annotated.avf",bframe)

Saving data

Write a biomarker frame to a file with write_file() in one of the supported file formats (.vcf,.maf,.csv):

import adagenes as ag

ag.write_file("/data/somaticMutations.annotated.maf", bframe, file_type="csv")

Dependencies

  • scikit-learn
  • pandas
  • matplotlib
  • plotly
  • pyliftover
  • blosum
  • openpyxl
  • requests

License

GPLv3

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

adagenes-0.4.0.tar.gz (12.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adagenes-0.4.0-py3-none-any.whl (473.5 kB view details)

Uploaded Python 3

File details

Details for the file adagenes-0.4.0.tar.gz.

File metadata

  • Download URL: adagenes-0.4.0.tar.gz
  • Upload date:
  • Size: 12.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for adagenes-0.4.0.tar.gz
Algorithm Hash digest
SHA256 18e2d7797836db19c21556071b29505749868ea11ba4e71c0ecbdb81438fcc72
MD5 67747be04f857a6d63626b73884b5e9f
BLAKE2b-256 f87675b2f00d037a523f17906c76de2261df0ae3dba3714121c3e155c4eca5c5

See more details on using hashes here.

File details

Details for the file adagenes-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: adagenes-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 473.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for adagenes-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c0a567fc56bfa618e45b485fce347dd1dfd659531cd6291333139942654dce0
MD5 6c30a279f13eed160f10cf70c03d3071
BLAKE2b-256 5bcdccacec15bbfbe7c364d4862cce82ca053107f6e05996abb541c2a9ffd78f

See more details on using hashes here.

Supported by

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