GithubHelp home page GithubHelp logo

cchrysostomou / mixed-base-codons Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 11 KB

Implementation of genetic algorithm that determines the ratio of A/C/T/G at each codon position required to achieve a desired amino acid distribution

Python 100.00%
genetic-algorithm codon-distribution amino-acid-distribution

mixed-base-codons's Introduction

mixed-base-codons

Implementation of genetic algorithm that determines the ratio of A/C/T/G at each codon position required to achieve a desired amino acid distribution

Implements a genetic algorithm desribed by Craig, R. et al. The purpose of the algorithm is to help users design oligos such that each position contains a mixed ratio at a given position. The allowed resolution of each base (i.e. 1% each base or 5% or 10%) in a position can be defined by the user. The algorithm attempts to optimize a set of mixed codon distributions that best matches the desired amino acid distribution.

Usage

Standard usage of the class

from mixed_base_codon_design.codon_design_genetic_algo import CodonDesigner, packbit_custom
import numpy array as np

# define a desired amino acid distribution
aa_dist = np.array([[0.0125, 0.05  , 0.0125, 0.0125, 0.0125, 0.0125, 0.1   , 0.0125,
        0.0125, 0.0125, 0.0125, 0.0125, 0.0125, 0.0125, 0.09  , 0.25  ,
        0.31  , 0.0125, 0.0125, 0.0125, 0.0125]])

# define the parameters for running the algorithm
v1 = CodonDesigner(
    pop_size=100, # create population of 300 variants
    forced_bitsize=8, # set encoding to be 8bits
    elite_fraction=0.1, # keep top 10% of solutions in each iteration
    elite_mut_density=0.5, elite_mut_rate=0.1, mut_density=0.5, mut_rate=0.5, cross_rate=0.8, double_cross_rate=0.1, numeric_percent_resolution=1, thresh=1e-8, # desired threshold cutoff
    max_time=300 # stop after 300 seconds
)
# run the algorithm using desired distribution
v1.run_genetic_algorithm(aa_dst, weights=None, round_aa_freq_precision=5)

# re update with a new objective function
v1._reset_hyperparameter('obj_fxn', 'cosine')
v1.run_genetic_algorithm(aa_dst, weights=None, round_aa_freq_precision=5)

# only allow for degenerate base distributions (i.e. N/S/W)
v1._reset_encoding('degen')
v1.run_genetic_algorithm(aa_dst, weights=None, round_aa_freq_precision=5)

mixed-base-codons's People

Contributors

cchrysostomou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.