Skip to content

GenoArmory: A Unified Evaluation Framework for Adversarial Attacks on Genomic Foundation Models

License

Notifications You must be signed in to change notification settings

MAGICS-LAB/GenoArmory

Repository files navigation

Image

A comprehensive toolkit for DNA sequence Adversarial Attack and Defense Benchmark.

arXiv Github Hugging Face Pretrained Hugging Face Dataset

Installation

You can install GenoArmory using pip:

pip install genoarmory

Quick Start

# Initialize model
from genoarmory import DNAModel

model = DNAModel(model_name="dnabert-v1", api_key="your-api-key")

# Perform attack
sequences = ["ATCGGTCA", "GCTATAGC"]
responses = model.query(
    sequences=sequences,
    attack_method="bertattack"
)

# Apply defense
defense = model.get_defense(defense_method="adfar", epsilon=0.1)
response = defense.query(sequence="ATCGGTCA")

Command Line Usage

GenoArmory can also be used from the command line:

# Attack
genoarmory attack --sequence "ATCGGTCA" --method bertattack

# Defense
genoarmory defend --sequence "ATCGGTCA" --method adfar

# Visualization
genoarmory visualize --sequences "ATCGGTCA" "GCTATAGC" --save-path "attention.png"

Features

  • Multiple attack methods:

    • BERT-Attack
    • TextFooler
    • PGD
    • FIMBA
  • Defense methods:

    • ADFAR
    • FreeLB
    • Traditional Adversarial Training
  • Visualization tools

  • Artifact management

  • Batch processing

  • Command-line interface

Documentation

For detailed documentation, visit [docs](We will release soon).

License

This project is licensed under the MIT License.

Citation

If you have any question regarding our paper or codes, please feel free to start an issue.

If you use GenoArmory in your work, please kindly cite our paper: