Convert OWL Ontology to OBO - perl

I need to convert a OWL ontology to OBO.
I've tried this tool https://github.com/ontodev/robot/ but the output format isn't correct at all, just some parts.
Also OBO-EDIT2 and Protegé but the weren't able to do a conversion.
Lastly I've tried this Perl module http://search.cpan.org/~easr/ however it gives this error
Undefined subroutine &XML::Parser called at /usr/local/share/perl/5.14.2/OBO/Parser/OWLParser.pm line 146.
And trying to install XML::Parser always ends with an error.
Could anyone help me to convert the Ontology?

Have you tried https://github.com/owlcollab/owltools/?
And trying to install XML::Parser always ends with an error.
What commands are you running to install XML::Parser? What is that error? Can you install other perl modules ok with the same commands? What about ones which require make?

If you're using OWL API, OBO is one of the supported output formats. It is sufficient to pass an OBODocumentFormat to the saveOntology() method.

Related

Perl pdl graphics, fails to show image as specified in documentation

For those interested in solution please skip to continuation and solution.
So, I am using Strawberry Perl 5.32.1.1-64, from zip, no msi, under Windows 11. Want to use pdl. The information on the internet over that issue is very poor and the support as well. I've seen others having similar problem, but didn't find a solution.
Problem: According to first steps like specified here https://pdl.perl.org/?page=FirstSteps
Then I did this as specified on the site:
cpan PDL::Graphics::Simple
So, when starting that commands again I get these one for PDL::Graphics::Simple:
pdl> use PDL::Graphics::Simple
PDL::Graphics::Simple::register: PDL::Graphics::Simple::Prima is out of date - winging it at
perlhome/perl/site/lib/PDL/Graphics/Simple.pm line
1397, <DATA> line 209.
How exactly a fresh install from cpan is out of date?... I did not notice any difference with invoking or without invoking use PDL::AutoLoader
Then for img command, failed:
pdl> imag (sin(rvals(200,200)+1))
Trying gnuplot (PDL::Graphics::Gnuplot)...nope
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Sorry, all known plotting engines failed. Install one and try again.
Tried to install install the plots, and every single install failed, even after installing gnuplot itself. I am having NO problems using gnuplot in Julia, all works there exactly as specified in documentation. I literally want to make Perl to work. But could not make Strawberry Perl nor ActiveState Perl working with pdl. Similar topics on stackoverflow did not help much.
The continuation and solution is here

How do I convert a perl program into an installable module?

I have a perl program that I want to convert into a bioperl module. How do I do that? Is there an up-to date tutorial? That's really all I need.
Thank you.
For module naming conventions and other information (whether you're writing it for CPAN or not), start with perlnewmod. To make an actual module, first install Module::Starter and use module-starter command line utility to create your skeleton.

Perl cannot install Catalyst dependency

I'm getting the following error from Perl. Am I doing something wrong or should I report it?
Can't locate object method "_process_isa_option" via package
"Class::MOP::Attribute" at
/home/martin3/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Meta/Attribute.pm
line 207.
This is in trying to (re)install Catalyst::Runtime using cpanm.
My code used to be working, but Perl was upgraded and I am trying to get it working again.
This bug report shows what the problem is. Looks like you've updated some of your dependencies from the Moose::* namespace, but not all of them.
If you run moose-outdated on your command line, then it will tell you which modules you need to update.

postgresql autodoc

I want to generate a ER Diagram sort of, of my spatial database i created inside of Postgresql. As i am also new to Postgresql, i am not too sure if the diagramming functionality can be done using whats offered by the PgAdmin (not referring to the Graphical Query Builder). However, it seems to me there is none. I read around that there is a perl based tool called postgresql_autodoc that can run through PostgreSQL system tables and return HTML, Dot, Dia and DocBook XML which describes the database. Now this is not exactly what i wanted but its the closest option i have. So i have successfully installed, ActivePerl 5.8 and DBD-Pg 2.10.0 for Perl 5.8 (DBD PG is a Perl DBI driver for the PostgreSQL database) and i have also downloaded the postgresql_autodoc.pl file. I have also added the path for Perl. But when i try to run the postgresql_autodoc.pl via the command prompt, i was getting this error: Possible Unintended Interpolation of #TEMPLATE in string at C:/Perl/bin/postgresql_autodoc.pl line 1831. Global symbol "#TEMPLATE" requires explicit package name at C:/Perl/bin/postgresql_autodoc.pl line 1831. Execution of C:/Perl/bin/postgresql_autodoc.pl aborted due to compilation errors.
I tried to view the postgresql_autodoc.pl using notepad++ however i have no experience with the perl language and so i cant figure out what is really wrong. All i could do is locate line 1831 but i dont know what i should do to fix this problem.
The postgresql_autodoc.pl file was downloaded from: http://www.rbt.ca/autodoc/
I would appreciate if anyone can help me here!
Thanks in advance
Barbara
That thingy, ##TEMPLATE-DIR##, is a string that is replaced when you build and install the module -- meaning you're not supposed to run it directly from the unpacked archive.
Most Perl modules are installed with a more or less simple three-step installation process, something like perl Makefile.PL ; make ; make install. However, this package is slightly different, you seem only to need make install.
Note that I have no experience with installing Perl modules on Windows with ActiveState. So the above may not work (e.g. if there's no make utility which is usually not part of Perl -- though it might be part of the ActiveState Perl distribution).
But there's a workaround. You can simply do what the install script does and replace the ##TEMPLATE-DIR## string yourself. It can be done easily with any text editor by replacing the two occurrences of ##TEMPLATE-DIR## with the path to where the postgresql_autodoc.pl script has been unpacked to -- meaning it's the path the script will look for the *.tmpl files in.
Note that Windows path names can be written with forward slashes in Perl, meaning C:/Temp/postgresql_autodoc should be OK.

How to make sphinx look for modules in virtualenv while building html?

I want to build html docs using a virtualenv instead of the native environment on my machine.
I've entered the virtualenv but when I run make html I get errors saying the module can't be imported - I know the errors are due to the module being unavailable in my native environment.
How can I specify which environment should be used when searching for docs (eg the virtualenv)?
The problem is correctly spotted by Mathijs.
$ which sphinx-build
/usr/local/bin/sphinx-build
I solved this issue installing sphinx itself in the virtual environment.
With the environment activated:
$ source /home/migonzalvar/envs/myenvironment/bin/activate
$ pip install sphinx
$ which sphinx-build
/home/migonzalvar/envs/myenvironment/bin/sphinx-build
It seems neat enough.
The problem here is that make html uses the sphinx-build command as a normal shell command, which explicitly specifies which Python interpreter to use in the first line of the file (ie. #!/usr/bin/python). If Python gets invoked in this way, it will not use your virtual environment.
A quick and dirty way around this is by explicitly calling the sphinx-build Python script from an interpreter. In the Makefile, this can be achieved by changing SPHINXBUILD to the following:
SPHINXBUILD = python <absolute_path_to_sphinx-build-file>/sphinx-build
If you do not want to modify your Makefile you can also pass this parameter from the command line, as follows:
make html SPHINXBUILD='python <path_to_sphinx>/sphinx-build'
Now if you execute make build from within your VirtualEnv environment, it should use the Python interpreter from within your environment and you should see Sphinx finding all the goodies it requires.
I am well aware that this is not a neat solution, as a Makefile like this should not assume any specific location for the sphinx-build file, so any suggestions for a more suitable solution are warmly welcomed.
I had the same problem, but I couldn't use the accepted solution because I didn't use the Makefile. I was calling sphinx-build from within a custom python build file. What I really wanted to do was to call sphinx-build with the exact same environment that I was calling my python build script with. Fiddling with paths was too complicated and error prone, so I ended up with what seems to me like an elegant solution, which is to "manually" load the console script entry point and call it:
from pkg_resources import load_entry_point
cmd = load_entry_point('Sphinx', 'console_scripts', 'sphinx-build')
cmd(['sphinx-build', basepath, destpath])