A fast and natural interface to R from Perl

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A fast and natural interface to R from Perl

Zakariyya Mughal
Hi everyone,

I have uploaded modules for working with the R interpreter from Perl.
The CPAN links are below, but to get a taste of what the API
looks like, check out my blog post <http://enetdown.org/dot-plan/posts/2014/12/24/a_fast_and_natural_interface_to_R_from_Perl/>.

- Statistics::NiceR <http://p3rl.org/Statistics::NiceR>
- Data::Frame <http://p3rl.org/Data::Frame>

I'd love to have feedback on how to improve them.

Regards and happy hacking,
- Zaki Mughal
_______________________________________________
Bioperl-l mailing list
[hidden email]
http://mailman.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A fast and natural interface to R from Perl

Zakariyya Mughal
On 2014-12-24 at 18:57:02 +0100, Pablo marin-garcia wrote:

> Dear Zakariyya,
>
> Thanks for the distribution, I was just looking this week for pdl/perl
> distributions to work with dataframes I use both in R and perl. I was
> looking for something in pdl or perl for doing dataframe subselections and
> calculations. I can use pdl for numbers (in the matrix part of dataframes)
> or for strings all of the same size with PDL::Char but was complicated to
> subselect by alphanumeric factors without prior 'numerification' .
>
> I hope your modules would be a good option for this functionality but
> unfortunately I was unable to install ithem at the first go.

Sorry for the late reply. I was out of town for a few days. Apologies
for the crossposting.

Hmm, the issue with the "missing" stats package could stem from multiple
build problems. I see that some say it could have to do with having
multiple architectures or multiple versions of shared libraries, but
I'll need to try to reproduce it. I'm going to try to build my own R in
a VM and see if it can be fixed. I've been working on making the build
more robust: so far I have made Statistics::NiceR build on Windows under
Strawberry Perl with the default R + Rtools installers. Hopefully what I
learned from that can help me figure this out.

You can get data frames and factors using just the code in Data::Frame,
but I'm still working on the documentation and the API. I'm trying to
get the best ideas out of different tools and providing comfortable
interfaces. Let me know how you would like to use the data structures
and what functions are missing and I'll implement them (e.g., I just
wrote some head()/tail() functions for data frames that'll I'll release
tonight.).

Cheers,
- Zaki Mughal

>
>
>
> Installation error report:
> ------------------------------
>
> Note1: I am reporting this here just in case if of any help to you.
>
> Note2: R does not come from a package but instead is compiled by myself.
>
> There is a recurrent error in each of the module test but test is reported
> OK ??!!
>
>      unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>      libRlapack.so: cannot open shared object file: No such file or
> directory
>      Package ‘stats’ in options("defaultPackages") was not found
>      t/conversion.t .............. ok
>
>
> But stats.so exists:
>
> $ locate stats.so
> /storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so
> --------
> # intallation command
> $ cpanm Statistics::NiceR
>
> Building and testing Statistics-NiceR-0.03 ... *** stack smashing detected
> ***: /home/pmg/perl5/perlbrew/perls/perl-5.16.0/bin/perl terminated
>
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x2b222e805807]
> /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x0)[0x2b222e8057d0]
> /soft_bio/R/R-3.0.2/lib/libR.so(+0xef05e)[0x2b22306e805e]
> [0x40f3648]
> ======= Memory map: ========
> 00400000-00555000 r-xp 00000000 fc:00 793010
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/bin/perl
> 00755000-00756000 r--p 00155000 fc:00 793010
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/bin/perl
> 00756000-0075b000 rw-p 00156000 fc:00 793010
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/bin/perl
> 0075b000-0075c000 rw-p 00000000 00:00 0
> 01d17000-04c45000 rw-p 00000000 00:00 0
>  [heap]
> 2b222dd9c000-2b222ddbe000 r-xp 00000000 fc:00 1186920
>  /lib/x86_64-linux-gnu/ld-2.15.so
> 2b222ddbe000-2b222ddc0000 rw-p 00000000 00:00 0
> 2b222dfbe000-2b222dfbf000 r--p 00022000 fc:00 1186920
>  /lib/x86_64-linux-gnu/ld-2.15.so
> 2b222dfbf000-2b222dfc1000 rw-p 00023000 fc:00 1186920
>  /lib/x86_64-linux-gnu/ld-2.15.so
> 2b222dfc1000-2b222dfc3000 r-xp 00000000 fc:00 1186905
>  /lib/x86_64-linux-gnu/libdl-2.15.so
> 2b222dfc3000-2b222e1c3000 ---p 00002000 fc:00 1186905
>  /lib/x86_64-linux-gnu/libdl-2.15.so
> 2b222e1c3000-2b222e1c4000 r--p 00002000 fc:00 1186905
>  /lib/x86_64-linux-gnu/libdl-2.15.so
> 2b222e1c4000-2b222e1c5000 rw-p 00003000 fc:00 1186905
>  /lib/x86_64-linux-gnu/libdl-2.15.so
> 2b222e1c5000-2b222e2c0000 r-xp 00000000 fc:00 1186914
>  /lib/x86_64-linux-gnu/libm-2.15.so
> 2b222e2c0000-2b222e4bf000 ---p 000fb000 fc:00 1186914
>  /lib/x86_64-linux-gnu/libm-2.15.so
> 2b222e4bf000-2b222e4c0000 r--p 000fa000 fc:00 1186914
>  /lib/x86_64-linux-gnu/libm-2.15.so
> 2b222e4c0000-2b222e4c1000 rw-p 000fb000 fc:00 1186914
>  /lib/x86_64-linux-gnu/libm-2.15.so
> 2b222e4c1000-2b222e4c2000 rw-p 00000000 00:00 0
> 2b222e4c2000-2b222e4cb000 r-xp 00000000 fc:00 1186915
>  /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 2b222e4cb000-2b222e6cb000 ---p 00009000 fc:00 1186915
>  /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 2b222e6cb000-2b222e6cc000 r--p 00009000 fc:00 1186915
>  /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 2b222e6cc000-2b222e6cd000 rw-p 0000a000 fc:00 1186915
>  /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 2b222e6cd000-2b222e6fb000 rw-p 00000000 00:00 0
> 2b222e6fb000-2b222e8b0000 r-xp 00000000 fc:00 1186906
>  /lib/x86_64-linux-gnu/libc-2.15.so
> 2b222e8b0000-2b222eaaf000 ---p 001b5000 fc:00 1186906
>  /lib/x86_64-linux-gnu/libc-2.15.so
> 2b222eaaf000-2b222eab3000 r--p 001b4000 fc:00 1186906
>  /lib/x86_64-linux-gnu/libc-2.15.so
> 2b222eab3000-2b222eab5000 rw-p 001b8000 fc:00 1186906
>  /lib/x86_64-linux-gnu/libc-2.15.so
> 2b222eab5000-2b222eabc000 rw-p 00000000 00:00 0
> 2b222eabc000-2b222ed85000 r--p 00000000 fc:00 1311449
>  /usr/lib/locale/locale-archive
> 2b222ed85000-2b222ed90000 r-xp 00000000 fc:00 822259
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux/auto/List/Util/Util.so
> 2b222ed90000-2b222ef8f000 ---p 0000b000 fc:00 822259
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux/auto/List/Util/Util.so
> 2b222ef8f000-2b222ef90000 r--p 0000a000 fc:00 822259
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux/auto/List/Util/Util.so
> 2b222ef90000-2b222ef91000 rw-p 0000b000 fc:00 822259
> /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux/auto/List/Util/Util.so
> 2b222ef91000-2b222ef92000 r--p 00000000 fc:00 267913
> /usr/share/locale-langpack/en_GB/LC_MESSAGES/libc.mo
> 2b222ef92000-2b222ef97000 r-xp 00000000 fc:00 1183229
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/Time/HiRes/HiRes.so
> 2b222ef97000-2b222f196000 ---p 00005000 fc:00 1183229
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/Time/HiRes/HiRes.so
> 2b222f196000-2b222f197000 r--p 00004000 fc:00 1183229
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/Time/HiRes/HiRes.so
> 2b222f197000-2b222f198000 rw-p 00005000 fc:00 1183229
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/Time/HiRes/HiRes.so
> 2b222f198000-2b222f19f000 r-xp 00000000 fc:00 1186910
>  /lib/x86_64-linux-gnu/librt-2.15.so
> 2b222f19f000-2b222f39e000 ---p 00007000 fc:00 1186910
>  /lib/x86_64-linux-gnu/librt-2.15.so
> 2b222f39e000-2b222f39f000 r--p 00006000 fc:00 1186910
>  /lib/x86_64-linux-gnu/librt-2.15.so
> 2b222f39f000-2b222f3a0000 rw-p 00007000 fc:00 1186910
>  /lib/x86_64-linux-gnu/librt-2.15.so
> 2b222f3a0000-2b222f3b8000 r-xp 00000000 fc:00 1186908
>  /lib/x86_64-linux-gnu/libpthread-2.15.so
> 2b222f3b8000-2b222f5b7000 ---p 00018000 fc:00 1186908
>  /lib/x86_64-linux-gnu/libpthread-2.15.so
> 2b222f5b7000-2b222f5b8000 r--p 00017000 fc:00 1186908
>  /lib/x86_64-linux-gnu/libpthread-2.15.so
> 2b222f5b8000-2b222f5b9000 rw-p 00018000 fc:00 1186908
>  /lib/x86_64-linux-gnu/libpthread-2.15.so
> 2b222f5b9000-2b222f5bd000 rw-p 00000000 00:00 0
> 2b222f5bd000-2b222f5c1000 r-xp 00000000 fc:00 1183155
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/mro/mro.so
> 2b222f5c1000-2b222f7c0000 ---p 00004000 fc:00 1183155
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/mro/mro.so
> 2b222f7c0000-2b222f7c1000 r--p 00003000 fc:00 1183155
>  /home/pmg/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux/auto/mro/mro.so
>
>
> == The output of cpanm build.log
>
> [...]
>
> Building and testing Statistics-NiceR-0.03
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> Manifying 13 pod documents
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> PERL_DL_NONLAZY=1 "/home/pmg/perl5/perlbrew/perls/perl-5.16.0/bin/perl"
> "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef
> *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> t/conversion.t .............. ok
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> t/equality.t ................ ok
>
> [...]
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> Error: could not find function "DESTROY"
>
> In addition: Warning message:
>
> In mean.default(X[[5L]], ...) :
>
>   argument is not numeric or logical: returning NA
>
> t/lapply.t .................. ok
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/storage/ethernus_miscellanea/scratch_local/ugdg_software/R/R-3.0.2/library/stats/libs/stats.so':
>
>   libRlapack.so: cannot open shared object file: No such file or directory
>
> During startup - Warning message:
>
> package ‘stats’ in options("defaultPackages") was not found
>
> Error: negative length vectors are not allowed
>
>
>  *** caught segfault ***
>
> address (nil), cause 'memory not mapped'
>
>
> Possible actions:
>
> 1: abort (with core dump, if enabled)
>
> 2: normal R exit
>
> 3: exit R without saving workspace
>
> 4: exit R saving workspace
>
> make: *** [test_dynamic] Interrupt
>
> make: *** [test_dynamic] Interrupt
>
>
> On Wed, Dec 24, 2014 at 6:01 AM, Zakariyya Mughal <[hidden email]>
> wrote:
>
> > Hi everyone,
> >
> > I have uploaded modules for working with the R interpreter from Perl.
> > The CPAN links are below, but to get a taste of what the API
> > looks like, check out my blog post <
> > http://enetdown.org/dot-plan/posts/2014/12/24/a_fast_and_natural_interface_to_R_from_Perl/
> > >.
> >
> > - Statistics::NiceR <http://p3rl.org/Statistics::NiceR>
> > - Data::Frame <http://p3rl.org/Data::Frame>
> >
> > I'd love to have feedback on how to improve them.
> >
> > Regards and happy hacking,
> > - Zaki Mughal
> > _______________________________________________
> > Bioperl-l mailing list
> > [hidden email]
> > http://mailman.open-bio.org/mailman/listinfo/bioperl-l
> >
_______________________________________________
Bioperl-l mailing list
[hidden email]
http://mailman.open-bio.org/mailman/listinfo/bioperl-l
Loading...