Giter Club home page Giter Club logo

viennarna.jl's Issues

DNA parameters

Love the interface of ViennaRNA for Julia. I've just installed it and I am still testing all the functions.
For now I seem unable to run FoldCompound using either of the DNA parameters. All RNA parameters work.
I've gone through the code to see if I could pick any obvious glitches but I cannot find any faults there. I looked through the ViennaRNA package and both are there so I don't fully understand why I am being pushed onto "unknown energy parameters" error.

Windowed predictions

Following discussion in #7 (comment)

For sliding window predictions on a sequence that produce an array of results instead of just one (one result for each window).

To use windowed predictions we have to do the following:

  • call vrna_fold_compound() with option VRNA_OPTION_WINDOW
  • set the window size set with vrna_md_t.window_size
  • use the functions vrna_mfe_window_cb, vrna_mfe_window_zscore_cb, vrna_probs_window

A Julia interface could look like this:

  • mfe_window(cb::Function, fc::FoldCompound, ...)
  • mfe_window(fc::FoldCompound, ...)
  • probs_window(cb::Function, fc::FoldCompound, ...)
  • probs_window(fc::FoldCompound, ...)

With the callback function in the first position so we can use do-notation to pass custom callback functions.
The second version of each function without the callback just stores all the results in an array and returns that (by calling the first version with a callback that pushes each result to an array).

This style of callback function would also be something useful for subopt, pbacktrack, and maybe other functions where ViennaRNA accepts callback functions.

plot_structure_makie is very slow on the first run

See discussion here: #4

What i tried:

Adding the following to plot_structure.jl:
(adapted from https://github.com/JuliaPlots/Makie.jl/blob/master/src/precompiles.jl )

function _precompile_()
    ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
    plot_structure_makie("(((...)))")
    plot_structure_makie("(((...)))"; sequence="GGGAAACCC")
    return
end
_precompile_()

Unfortunately the first plot seems to take even longer with this precompile approach (53s vs 45s without).

As mentioned in #4 using the GLMakie & WGLMakie backends also didn't yield an improvment.

Graphic dependencies are quite heavy

I don't know how essential the visualization functions are for users of this package, but loading the whole Makie stack regardless if you need that or not is quite expensive. For comparison (timings in a temporary environment after precompilation):
[email protected]:

julia> @time using ViennaRNA
  0.185636 seconds (747.30 k allocations: 48.920 MiB, 5.63% gc time, 6.60% compilation time)

[email protected] (includes Luxor):

julia> @time using ViennaRNA
  0.700532 seconds (2.55 M allocations: 171.304 MiB, 5.47% gc time, 6.65% compilation time)

[email protected] (includes CairoMakie):

julia> @time using ViennaRNA
  4.242130 seconds (14.88 M allocations: 1010.827 MiB, 9.37% gc time, 21.10% compilation time)

I'm happy to spend an Plots.jl recipe, if thats of interest until Makie has lightweight recipes itself, otherwise I'd prefer the visualization stuff to live in a separate package, such that you can use the other functionality without pulling a large amount of dependencies in.
Another alternative would be to use Requires.jl.

Missing functionality from ViennaRNA

Some of these items might already work, but should still get their own testset in the tests/ dir.

ViennaRNA-2.5.0 and before

  • default temperature for DNA params is 37 ยฐC (like for RNA), change to better default

Callback functions

  • subopt
  • pbacktrack
  • neighbours
  • more?

Windowed predictions

See also: #9

  • pf_window
  • pf_window_channel
  • bpp_window (using vrna_probs_window)
  • bpp_window_channel
  • zscore

Soft and hard constraints

  • soft constraints
  • hard constraints

G-quadruplexes

Duplex predictions

  • strand concentrations?

Multistrand predictions

  • strand concentrations

RNA-DNA hybrids

  • only duplexes?

Grammar callbacks

  • callbacks at various stages of recursions

ViennaRNA-2.6.0

https://github.com/ViennaRNA/ViennaRNA/releases/tag/v2.6.0

  • energies for modified bases (uses soft constraints callback), energy parameter modifications stored as json
  • adjust energies to different salt concentrations (Na+)
  • new soft constraints multi-callback dispatcher

Basepair probability vector and plotting RNA structures

Would be nice to have a function which returns the basepair probabilities as a vector so it can be used later to label visualizations with the right colors.
It seems like the RNAFold webserver does this with a perl script which isnt particularly easy to read.
This is the function I came up with:

function bpp_vec(bppm::Matrix{Float64}, dotbracket::String)
    double_bppm = transpose(bppm) + bppm
    prob_vec = Vector{Float64}(undef, first(size(double_bppm)))
    for (i, row) in enumerate(eachrow(double_bppm))
        if dotbracket[i] in ('(', ')')
            prob_vec[i] = maximum(row)
        else
            prob_vec[i] = 1 - maximum(row)
        end
    end
    return prob_vec
end

I'm not 100% sure this is the correct way of extracting this information though.
I've also seen that you still have this in your TODO list so I'm not sure if or how this function would work after this change.

Thanks alot for porting the ViennaRNA package to julia btw. ๐Ÿ™. Very nicely done!

ViennaRNA C API: docstrings have rendering errors in markdown

Example:

?ViennaRNA.LibRNA.vrna_plot_coords

The docstring is rendered with Markdown, which breaks the formatting, as the ViennaRNA C library doesn't use markdown, e.g. VRNA_PLOT_TYPE_SIMPLE is rendered as VRNAPLOTTYPE_SIMPLE.

Solution:

When generating the bindings with Clang.jl (in gen/generator.jl), either the docstrings should be surrounded by triple backticks (but backticks would still need to be escaped with a backslash inside the string) or somehow else be made 'markdown-safe'.

Segfault for `plot_coords("()")`

Segfault:

using ViennaRNA
plot_coords("()")  # sometimes doesn't segfault but keeps on going...
plot_coords(Pairtable("()")) # also segfaults
plot_coords("((()))") # also crashes, but in a different way

These work:

using ViennaRNA
plot_coords("")
plot_coords("(.)")
plot_coords("(..)")
plot_coords("(((.)))")
plot_coords("(((..)))")

It crashes on the line

n = _vrna_plot_coords(structure, ptr_cx, ptr_cy, type)

Which in turn calls

LibRNA.vrna_plot_coords(structure, cx, cy, type)

Tests for different plot_type

Works

plot_coords("()"; plot_type=:simple)    # type = 0
plot_coords("()"; plot_type=:naview)    # type = 1
plot_coords("()"; plot_type=:circular)    # type = 2

Crashes (sometimes also seems to just hang)

plot_coords("()"; plot_type=:turtle)    # type = 3
plot_coords("()"; plot_type=:puzzler)    # type = 4

Fails to precompile on CI

I got a project depending on ViennaRNA.jl which fails to precompile (but only in CI jobs) with the following error

โ”Œ Error: /root/.julia/artifacts/725e603448ac6c44bfbbf2df16f3225673d1ff38/include/ViennaRNA/utils/structures.h:140:10: fatal error: 'stdio.h' file not found
โ”” @ CBinding ~/.julia/packages/CBinding/kBUap/src/context.jl:377
ERROR: LoadError: Errors parsing C code
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] parse!(ctx::CBinding.Context{:c})
    @ CBinding ~/.julia/packages/CBinding/kBUap/src/context.jl:388
  [3] clang_str(mod::Module, loc::LineNumberNode, lang::Symbol, str::String, opts::String)
    @ CBinding ~/.julia/packages/CBinding/kBUap/src/context.jl:481
  [4] var"@c_str"(__source__::LineNumberNode, __module__::Module, exprs::Vararg{Any})
    @ CBinding ~/.julia/packages/CBinding/kBUap/src/context_c.jl:5
  [5] include
    @ ./Base.jl:418 [inlined]
  [6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:373 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [10] top-level scope
    @ none:1
in expression starting at /root/.julia/packages/ViennaRNA/7mJxT/src/ViennaRNA.jl:21
in expression starting at /root/.julia/packages/ViennaRNA/7mJxT/src/ViennaRNA.jl:1

So it seems this is not really selfcontained and the container is missing some C dependencies, if I understand correctly

Feature request: Alifold

Hi again,

Are there any plans to implement a wrapper for alifold?
As I'm not familiar with C, I dont really know where to start but I would be thankful if you could lead me to the right direction.
My current try looks like this

function alifold(sequences::Vector{AbstractString}, structure::AbstractString)
    alifold_output = LibRNA.vrna_alifold(sequences, structure)
    return alifold_output
end

Is the following needed somehow to

cstr_structure = Ptr{Cchar}(LibRNA.vrna_alloc(length(structure) + 1))
cstr_sequences = Ptr{Ptr{Cchar}}(LibRNA.vrna_alloc(sizeof(Ptr{Cchar})))

I'm almost certain this is not correct though.
Do I also need to write the wrap_alifold function present in alifold.c?
Do I need a specific struct to return the alifold information?
Would be nice to have this implemented and I would like to help if I can.

Greetings,
Timo

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.