Code Monkey home page Code Monkey logo

mssm's Introduction

mssm

This package provides tools for the identification of submatrix of maximal sum. A submatrix is a rectangular, non-necessarily contiguous, subset of rows and of columns of a (larger) matrix. The submatrices that are searched for are of maximal sum. A submatrix is of maximal sum if the sum of its entries (selected from the original matrix) is of maximal sum. This package is a R wrapper for the Scala implementation originally provided.

Installation

Recommended installation of the latest development version is done via

> library(devtools)
> install_github("vbranders/mssm")

in R. If everything went fine, you can now load the package without any error:

> library(mssm)

If errors are raised, keep reading.

Issues with rJava

The mssm package has the dependency rJava. Although the installation should be fine in most cases, there are many posts dedicated to fixing rJava installation. We have three suggestions regarding possible issues while installing rJava:

  1. As first step, consider the next sections that propose a generic solution to most common issues.
  2. Read the rJava github for installation instructions and documentation.
  3. Search for solutions to your (possibly already solved) specific error.

Common issue

As the package interfaces R and Java, a JDK (or Java Development Kit) should be available to R. This means that you should have a JDK installed and the environment variable JAVA_HOME should point to the JDK location. In most cases, this requirement is not met, which leeds to an error during the installation.

If you hadn't installed a JDK yet, you should download and install the latest version (we consider here the JDK version 1.8.0_181). If you have a JDK installed but you don't know the version, or you don't know if you have a JDK, just type in your favorite command line interface:

$ java -version

To detect the current Java setup and update the corresponding configuration in R, type:

$ R CMD javareconf -e

This might have fixed the rJava installation issue, but you most probably should continue before re-trying to install mssm. Note: if you are using RStudio, consider restarting R session before any re-installation of mssm or rJava.

Fixing on Mac OS X

You know need to set up the JAVA_HOME environment variable so that it contains the path to your JDK. To get the actual path to the JDK (assuming it is version 1.8.0_181) and then the value of the JAVA_HOME variable, type:

$ /usr/libexec/java_home -v 1.8.0
$ echo $JAVA_HOME

Both should match. If not, the JAVA_HOME must be updated as follows:

$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0`

Then, continue with the Updating configuration section.

Fixing on Linux (or associated)

Dynamic libraries locations are referenced in the LD_LIBRARY_PATH environment variable. To provide R and rJava an access to the java dynamic library, the environment variable must be updated as follows:

$ export LD_LIBRARY_PATH=$JAVA_LD_LIBRARY_PATH

Once done, continue with the Updating configuration section.

Updating configuration

Now that environment variables are updated, the new Java setup must be detected and the associated R configuration must be updated:

$ R CMD javareconf -e

The problem should be fixed now and you can finally install and use the mssm package as explained in the Installation section. Note: the distinction between Max OS X and Linux is motivated by there different most frequent issues. Both fixes can be considered on both Mac OS X and Linux (but some commands might requires adaptations).

To ensure that rJava (after installation) uses the right JDK version, you can type the following lines in R and check that the output match your expectations:

> library(rJava)
> .jinit(".")
> .jcall("java/lang/System", "S", "getProperty", "java.version")

Bug reports

Please use mssm GitHub issues page to report bugs.

mssm's People

Contributors

vbranders avatar

Stargazers

Lluís Revilla avatar

Watchers

James Cloos avatar  avatar

mssm's Issues

Give an example?

Hi

Thanks for your shared work. I am a beginner of R.
Could you give an example of your mssm functions?

E.g., The input and output of your algorithm and some hyper-parameters setting?

thanks very much.

Running Error

Hi Branders,

I meet such error during running, Could you help work it out?

Error in new(mssm.jInst("CPGC"), javaMatrix, budget, as.integer(convergence), :
no slot of name "virtual" for this object of class "jclassName"

Here is the config info of run "R CMD javareconf -e"

Java interpreter : /usr/bin/java
Java version : 11.0.8
Java home path : /usr/lib/jvm/java-11-openjdk-amd64
Java compiler : /usr/bin/javac
Java headers gen.:
Java archive tool: /usr/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags : -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux
detected JNI linker flags : -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

The following Java variables have been exported:
JAVA_HOME JAVA JAVAC JAVAH JAR JAVA_LIBS JAVA_CPPFLAGS JAVA_LD_LIBRARY_PATH

Thanks.
Yongjie

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.