Skip to main content

Python module for running Defense Predictor, a machine learning model to predict antiphage defense systems

Project description

DefensePredictor: A Machine Learning Model to Discover Novel Prokaryotic Immune Systems

Python package to run DefensePredictor, a machine-learning model that leverages embeddings from a protein language model, ESM2, to classify proteins as anti-phage defensive.

Installation

In a fresh conda or other virutal environment, run:

pip install defense_predictor
defense_predictor_download

The first command downloads the python package from PyPI and the second downloads the model weights. Once model weights are downloaded you do not need to run this command again.

Requirements

Requires python >= 3.10

Usage

defense_predictor can be run as python code

import defense_predictor as dfp

ncbi_feature_table = 'GCF_003333385.1_ASM333338v1_feature_table.txt'
ncbi_cds_from_genomic = 'GCF_003333385.1_ASM333338v1_cds_from_genomic.fna'
ncbi_protein_fasta = 'GCF_003333385.1_ASM333338v1_protein.faa'
output_df, feature_matrix = dfp.defense_predictor(ft_file=ncbi_feature_table, fna_file=ncbi_cds_from_genomic, faa_file=ncbi_protein_fasta)
output_df.head()                                    

Or from the command line

defense_predictor \
     --ncbi_feature_table GCF_003333385.1_ASM333338v1_feature_table.txt \
     --ncbi_cds_from_genomic GCF_003333385.1_ASM333338v1_cds_from_genomic.fna \ 
     --ncbi_protein_fasta GCF_003333385.1_ASM333338v1_protein.faa \
     --output GCF_003333385_defense_predictor_output.csv

defense_predictor outputs the predicted log-odds of defense for each input protein in the columns mean_log_odds. We reccomend using a stringent log-odds cutoff of 4 to call a protein predicted defensive.

To see an example you can run the defense_predictor_example.ipynb in colab: Open In Colab

We reccomend running defense_predictor on a computer with a cuda-enabled GPU, to maximize computational efficiency.

Inputs

Input files can be downloaded from the ftp webpage for any gemone of interest, which is linked on its assembly page. Input files can be generated from an unannotated nuceotide assembly using NCBI's Prokaryotic Genome Annotation Pipeline.

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

defense_predictor-1.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

defense_predictor-1.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file defense_predictor-1.0.1.tar.gz.

File metadata

  • Download URL: defense_predictor-1.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/21.6.0

File hashes

Hashes for defense_predictor-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e42363d6462df67cd417b06cb7a1f984c0bef79ea1f93620e3f5a6397935c4af
MD5 7bb98de6a5988113a05a7d455594c5d9
BLAKE2b-256 686f0d4f4ea3ad843d7ca034c3109a787565a4e3490ada007f4e2e6a61209206

See more details on using hashes here.

File details

Details for the file defense_predictor-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: defense_predictor-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.1 Darwin/21.6.0

File hashes

Hashes for defense_predictor-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57db17f4ae8d1735ed0e4cf9c510c4174695d34c831d62f615d72958b113fefa
MD5 53ee2b220a1231e1601f6ce64ce8bfa8
BLAKE2b-256 481a6ee8407a84eeb05e985d1cce2e59812a2d75d8c241eb609583b8aeb0ed17

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