marcom / ViennaRNA.jl

Julia interface to ViennaRNA for RNA structure prediction and analysis
Other
21 stars 1 forks source link

Modified bases energy parameters. #23

Closed ian-barr closed 5 months ago

ian-barr commented 5 months ago

Is it currently possible to use the modified base energy parameters built in to Vienna 2.6?

marcom commented 5 months ago

At the moment this isn't available, but it shouldn't be too hard to add. I will try and add some basic functionality for this in the next few days.

marcom commented 5 months ago

I have an initial implementation, you can try it out like this:

Add the branch sc_mod-functions of this repo in the Julia package manager:

]
add https://github.com/marcom/ViennaRNA.jl#sc_mod-functions

and try some modified bases

using ViennaRNA
fc = FoldCompound("AAACCCUUU")
partfn(fc)  # -0.0025467473022687203 kcal mol^-1
ViennaRNA.sc_mod_pseudouridine!(fc, [7,8,9])  # modify positions 7, 8, 9
partfn(fc)  # -0.004713416050703315 kcal mol^-1

Let me know how it goes. Note that this is all just very lightly tested at this moment.

ian-barr commented 5 months ago

I tried it, and got the same output you did, thanks!

ian-barr commented 5 months ago

It does seem to work, though I've noticed it works in the REPL but not in Jupyter or Pluto.jl. Is that expected?

marcom commented 5 months ago

With Pluto you have to have something like this at the top of your notebook to disable Pluto's package manager and be able to use a branch of a package:

begin
    import Pkg
    Pkg.activate("./")
    Pkg.add(url="https://github.com/marcom/ViennaRNA.jl", rev="sc_mod-functions")
end

Note the directory "./" which specifies that the Project.toml and Manifest.toml will be stored in the same directory as the notebook file. Pluto's own package manager stores all this inside the notebook file but doesn't allow to use a specific branch of a package AFAIK.

The Pluto wiki has some more information: https://github.com/fonsp/Pluto.jl/wiki/%F0%9F%8E%81-Package-management

marcom commented 5 months ago

Package management under Jupyter should work more like normal Julia.

You can check which Julia environment is active with:

import Pkg
Pkg.status()

and use Pkg.activate to activate a specific environment and Pkg.add as in the above example for Pluto.

ian-barr commented 5 months ago

Thanks, I'll look around a little more. I'm still getting theUndefVarError: sc_mod_pseudouridine! not defined error with Pluto and Jupyter when I try to use ViennaRNA.sc_mod_pseudouridine!(fc, [7,8,9]) . After Pkg.status() in Pluto I get:

Status  ~/Desktop/test/Project.toml
  [336ed68f] CSV v0.10.14
  [a93c6f00] DataFrames v1.6.1
  [eab79ae3] PlotRNA v0.3.2
  [7f904dfe] PlutoUI v0.7.58
  [1986cc42] Unitful v1.19.0
  [05a721ad] ViennaRNA v0.11.2-DEV https://github.com/marcom/ViennaRNA.jl#sc_mod-functions

So I think the right version is installed, just something else is going wrong. Thanks for your help, so far, though!

Edit: got it working, needed to get rid of my old Manifest.toml and Project.toml and restart Julia.

marcom commented 5 months ago

I have just released v0.11.2 of ViennaRNA.jl with the support for modified bases included, so feel free to switch over to the normal version of the package again.