Coder Social home page Coder Social logo

marcom / linearfold.jl Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 37 KB

Julia interface to LinearFold RNA structure prediction programs: LinearFold, LinearPartition, LinearSampling, and LinearTurboFold

License: Other

Julia 100.00%
rna rna-folding rna-structure-prediction julia

linearfold.jl's Introduction

Julia interface to LinearFold

Build Status Aqua QA

Unofficial Julia interface to the LinearFold suite of programs for RNA secondary structure prediction. Please cite the applicable original LinearFold, LinearPartition, LinearSampling, or LinearTurboFold publications if you use this library.

The LinearFold, LinearPartition, LinearSampling, and LinearTurboFold programs are supported at the moment. This library calls the binary executables of these programs directly and parses their output.

The name LinearFold derives from the O(n) running time (where n is the sequence length) of calculating an approximate solution, compared to the typical cubic O(n^3) running time for the exact solution. This speedup is achieved by recasting the normal dynamic programming algorithms to work on the sequence left-to-right and by using a beam search approximation. Most algorithms also have a linear or quadratic time dependence on the beam size used. Please refer to the LinearFold publications for further details.

Installation

] add LinearFold

Usage

using LinearFold, Unitful

Keyword argument description

  • model=:vienna: energy model to be used. Valid options are :vienna and :contrafold. Default is :vienna.

  • beamsize=100: size used for beam search approximation. Larger numbers trade longer computation time for more precise answers. Default is 100.

  • constraints: structural constraints of the predicted structure. A string consisting of the characters '?', '.', '(', ')', corresponding to positions that have unspecified base pairing, unpaired, or base-pairing specified by matching parentheses.

  • is_sharpturn=false: enable sharp turns in predictions. Default is false.

  • verbose=false: output extra information from the program runs to stdout. Default is false.

Minimum free energy (MFE) structure of an RNA strand

Uses the LinearFold program to predict the MFE and MFE structure.

# mfe(seq; model, beamsize, constraints, is_sharpturn, verbose)
mfe("GGGAAACCC")  # => (-1.2 kcal mol^-1, "(((...)))")
mfe("GGGAAACCC"; constraints="?(.????)?") # => (0.9 kcal mol^-1, "((.....))")
mfe("GGGAAACCC"; model=:contrafold)  # => (-0.09 kcal mol^-1, ".........")

Base pair probabilities

Uses the LinearPartition program to calculate base pair probabilities.

# bpp(seq; model, beamsize, bpp_cutoff, is_sharpturn, verbose)
bpp("GGGAAACCC") # => (-1.62 kcal mol^-1, sparse(...))
bpp("GGGAAACCC"; bpp_cutoff=0.1)

Pseudoknot structure prediction

Uses the LinearPartition program to predict possibly pseudoknotted secondary structures with a beam search approximation to the ThreshKnot algorithm.

Because the predicted structures can contain pseudoknots, the structure is returned as a list of integers which indicate the base-pairing partner of the current index.

# threshknot(seq; model, beamsize, threshold, is_sharpturn, verbose)
threshknot("GGGAAACCC")  # => (-1.62 kcal mol^-1, [9, 8, 7, 0, 0, 0, 3, 2, 1])
threshknot("GGGAAACCC"; threshold=0.2)

Sample structures from Boltzmann ensemble

Uses the LinearSampling program to return num_samples secondary structures sampled according to their Boltzmann probability for an RNA sequence.

# sample_structures(seq; beamsize, num_samples, is_nonsaving, is_sharpturn, verbose)
sample_structures("GGGAAACCC")  # => [ "((....)).", ... ]
sample_structures("GGGAAACCC"; num_samples=100)

Simultaneous alignment and folding

Uses the LinearTurboFold program to simultaneously align and fold multiple RNA sequences.

# turbofold(sequences; beamsize_hmm, beamsize_cky, iterations,
#                      threshknot_min_helix_len,
#                      threshknot_iterations, threshknot_threshold,
#                      verbose)
turbofold(["GGGAAACCC", "GGCCAAAUGGCCA"])

Maximum expected accuracy (MEA) structure

Uses the LinearPartition program.

# mea(seq; model, beamsize, gamma, is_sharpturn, verbose)
mea("GGGAAACCC")  # => (-1.62 kcal mol^-1, "(((...)))")
mea("GGGAAACCC"; gamma=0.5)  # => (-1.62 kcal mol^-1, ".(.....).")

Zuker suboptimal structures

Uses the LinearFold program.

# zuker_subopt(seq; model, beamsize, delta, is_sharpturn, verbose)
zuker_subopt("GCGCGAAAAAACCCCCCC")  # => [ (2.9 kcal mol^-1, "....(........)...."), ... ]
zuker_subopt("GCGCGAAAAAACCCCCCC"; delta=4.0u"kcal/mol")

Energy of a (sequence, structure) pair

Uses the eval mode of the LinearFold program.

# energy(seq, structure; model, is_sharpturn, verbose)
energy("GGGAAACCC", "(((...)))")  # => -1.2 kcal mol^-1

Partition function only, no base pair probabilities

Uses the LinearPartition program.

# partfn(seq; model, beamsize, is_sharpturn, verbose)
partfn("GGGAAACCC")  # => -1.62 kcal mol^-1

Related Julia packages

linearfold.jl's People

Contributors

marcom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

linearfold.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

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.