Setup instructions - UCLA-BD2K/metaprot GitHub Wiki

Setting up MetProt locally

Step-by-step instructions

Assumptions

  1. You are using IntelliJ or another similar IDE.
  2. You have forked a copy of the project locally.
  3. You have access to a command line terminal (Windows PowerShell is OK, but instructions will assume bash)
  4. You do not have Node.js, npm, R, or Rserve. If you do, skip the appropriate steps.
  5. You have a /ssd2/metaprot folder on your filesystem with appropriate permissions for read and write.
  6. You have Maven installed and executable in your PATH.

Steps:

  1. Create/modify an application.properties file at src/main/resources/application.properties. Fields must include at least:
server.port=...

aws.access.key=...
aws.secret.access.key=...
aws.s3.bucketName=...
aws.dynamo.endpoint=...

task.scheduler.rserve.ports=...
app.r.script.location=@r-script-location@

Alternatively, you can ask for this file from a local developer or retrieve it from one of the previously deployed packages on AWS Elastic Beanstalk.

  1. If there is no secret.p12 file at src/main/resources/secret.p12, ask for this file from a local developer or retrieve it from one of the previously deployed packages on AWS Elastic Beanstalk. This file provides the credentials for Google Analytics services in this application.

  2. Install Node.js and npm (a package manager). Download and run the installer from the official website (https://nodejs.org/en/download/).

  3. Node.js and npm should now be installed. Now, open the terminal and run the following command:

node -v
npm -v

The output should display the version of Node.js and npm that is installed on your computer (e.g. "v7.9.0"). If there is an error, go back to step 7 to download and install Node.js and npm again.

  1. In the terminal, navigate to the project directory. Run the following command to download the necessary Node module dependencies required for the React.js and Redux front-end of the application.
npm install
  1. Run the following command in the terminal and keep the tab/window open while you are developing and making changes to the front-end of the application. This command will automatically create a new bundle at src/main/resources/static/built/ as changes are made. Without this command running, front-end changes will not take effect.
npm run-script watch
  1. At this point you should be able to run the MetProt application from your IDE; as a test, head over to localhost:<port>/metabolite-analysis to check that the Web application itself is working. <port> refers to the value you had chosen in application.properties for server.port.

  2. Install R. OSX users can use Homebrew, else consult the official R docs. Building from source is OK. If not already, add the path to R to your system PATH.

  3. Install Rserve. If on Windows, you can simply run an R shell by typing R in the PowerShell, and using R's built in package manager to do so. Simply type install.packages("Rserve"). This method may work on OSX and Linux systems as well, but a guaranteed method is to build and install Rserve from source; see instructions.

  4. Run an Rserve server process. Rserve bypasses the single-threaded limitation of R by exposing R as a TCP service. This way, multiple "servers" can exist and you can use any of them to run arbitrary R commands. Open a R shell if you have not already (type R in terminal), and run:

library(Rserve)
Rserve(args="--no-save --RS-port <port>")

where <port> refers to the port(s) you specified in task.scheduler.rserve.ports in application.properties (step 1).

  1. Now your Rserve process(es) are ready. Head over to your IDE and edit your run configurations. For IntelliJ, this is at Run->Edit Configurations.... We need to tell your local version of Metaprot about where to find R, so add as an Environment Variable: R_HOME=</path/to/R>. Usually the value of </path/to/R> can be found by executing R.home() in the R shell. However, this can be manually found by looking at where the R executable file is (e.g. in Windows this is usually in .../bin. Save your changes.

  2. Now you should be able to run MetProt in your IDE, via embedded Tomcat.

⚠️ **GitHub.com Fallback** ⚠️