2009-09-14
Setting Perforce API
Check the P4C/C++ API notes.
Check the P4C/C++ API documentation.
&] sudo cp ~/Downloads/p4api.tgz /opt ; cd /opt
&] sudo tar -zxf p4api.tgz
&] sudo ln -s p4api-2009.1.205670 p4api
&] sudo chmod -R +x *4*
Installing P4Perl API
Check the P4Perl API notes.
Check the P4Perl API documentation.
&] sudo cp ~/Downloads/p4perl.tgz /opt ; cd /opt
&] sudo tar -zxf p4perl.tgz
&] sudo ln -s p4perl-2009.1.GA p4perl
&] sudo chmod -R +x *4* ; cd p4perl
&] perl -MP4 -e "print P4::Identify()"
&] sudo perl Makefile.PL --apidir /opt/p4api
&] sudo make # in xp nmake
&] sudo make test # in xp namke test
&] sudo make install # in xp nmake install
&] perl -MP4 -e "print P4::Identify()"
Installing P4Ruby API
Check the P4Ruby API notes.
Check the P4Ruby API documentation.
&] sudo cp ~/Downloads/p4ruby.tgz /opt ; cd /opt
&] sudo tar -zxf p4ruby.tgz
&] sudo ln -s p4ruby-2009.1 p4ruby
&] sudo chmod -R +x *4*
&] cd p4ruby
&] ruby -rP4 -e "puts P4.identify"
&] sudo ruby p4conf.rb --apidir /opt/p4api
&] sudo make # in xp nmake
&] sudo ruby test.rb
&] sudo make install # in xp nmake install
&] ruby -rP4 -e "puts P4.identify"
Installing P4Python API
Check the P4Python API notes.
Check the P4Python API documentation.
&] sudo cp ~/Downloads/p4python.tgz /opt ; cd /opt
&] sudo tar -zxf p4python.tgz
&] sudo ln -s P4Python-2009.1 p4python
&] sudo chmod -R +x *4*
&] cd p4python
# update P4API in setup.cfg as: p4_api=/opt/p4api
&] python
>>> import P4
>>> print P4.P4.identify()
&] sudo python setup.py build
&] sudo python p4test.py
&] sudo python setup.py install
&] python
>>> import P4
>>> print P4.P4.identify()
Installing P4PHP
Check the P4PHP API notes.
Check the P4PHP API documentation.
&] sudo cp ~/Downloads/p4php.tgz /opt ; cd /opt
&] sudo tar -zxf p4php.tgz
&] sudo ln -s p4php-2009.1 p4php
&] sudo chmod -R +x *4*
Installing P4Java API
Check the P4Java API notes.
Check the P4Java API documentation.
&] sudo cp ~/Downloads/p4java.zip /opt ; cd /opt
&] sudo mkdir p4java/ ; sudo mv p4java.zip p4java/ ; cd p4java
&] sudo unzip p4api.zip
&] sudo ln -s p4java_2009.1.211156.jar p4java.jar
Then add /opt/p4java to your CLASSPATH
Installing P4WSAD
Check the P4WSAD API notes.
Check the P4WSAD API documentation.
&] sudo cp ~/Downloads/p4wsad.zip /opt ; cd /opt
&] sudo mkdir p4wsad/ ; sudo mv p4wsad.zip p4wsad/ ; cd p4wsad
&] sudo unzip p4wsad.zip
Installing P4Objective-C API
Check the P4ObjC API notes.
Check the P4ObjC API documentation.
&] sudo cp ~/Downloads/p4objc.tgz /opt ; cd /opt
&] sudo tar -zxf p4objc.tgz
&] sudo ln -s p4objc-2009.1.205670 p4objc
&] cd p4objc/doc ; sudo doxygen
&] cd /opt/p4objc
Installing P4COM Windows C++ API
Check the P4COM Windows C++ notes.
Check the P4COM Windows C++ documentation.
Setting Perforce
1. Download p* from http://www.perforce.com/perforce/downloads/index.html
2. Copy it to /usr/local/bin/
3. Make the p* files executables (p4 p4d p4ftpd p4p p4sql p4web p4broker perfmerge)
4. Configure the server port setting, client workspace name, and user name. You can specify these settings by configuring the P4PORT, P4CLIENT, and P4USER environment variables. (For details, see Chapter 2, Configuring P4.)
&] sudo cp ~/Downloads/p* /usr/local/bin
&] sudo chmod +x /usr/local/bin/p*
&] sudo chmod -R +x p*
Other P4 environment variables:
- P4DIFF -default-
- P4MERGE -default-
- P4PASSWD
- P4CLIENT
- P4EDITOR
- P4PORT
- P4USER
- P4CONFIG export $HOME/.p4config or export %USERPROFILE%\p4config.txt
- P4TICKETS export $HOME/.p4tickets or export %USERPROFILE%\p4tickets.txt
1. Download p4v.tgz from http://www.perforce.com/perforce/downloads/index.html
2. Copy it to /Applications
3. Decompress with tar -zxf
4. Make the p4v* executable
&] sudo cp p4v.tgz /Applications/ ; cd /Applications
&] sudo tar -zxf p4v.tgz ; sudo chmod -R +x p4v* ; sudo rm -rf p4v.tgz
&] sudo ln -s p4v-2009.1.212209 p4v
Installing P4Thumb on UNIX, Linux and OS X
To install the Perforce P4Thumb:
1. Download p4thumb.tgz from http://www.perforce.com/perforce/downloads/index.html
2. Copy it to /Applications
3. Decompress with tar -zxf
4. Make the p4thumb* executable
&] sudo cp p4thumb.tgz /Applications/ ; cd /Applications
&] sudo tar -zxf p4thumb.tgz ; sudo chmod -R +x p4thumb* ; sudo rm -rf p4thumb.tgz
&] sudo ln -s p4thumb-2009.1.210672 p4thumb
Installing P4DTG on UNIX, Linux and OS X
To install the Perforce P4DTG:
1. Download p4dtg.tgz from http://www.perforce.com/perforce/downloads/index.html
2. Copy it to /Applications
3. Decompress with tar -zxf
4. Make the p4dtg* executable
&] sudo cp p4dtg.tgz /Applications/ ; cd /Applications
&] sudo tar -zxf p4dtg.tgz ; sudo chmod -R +x p4dtg* ; sudo rm -rf p4dtg.tgz
&] sudo ln -s p4dtg-2009.1.209672 p4dtg
&] cd p4dtg
&] ./p4dtg-test
> LL ./plugins/p4jobdt.so
Loading module: [./plugins/p4jobdt.so]
Module loaded: ./plugins/p4jobdt.so
> LT
Module tests passed
> LF
Module freed
> Q
As seen on Chapter 2, Configuring P4
2009-09-09
Using rsruby in RubyOnRails
- Create your Rails application Let’s call it Plotter. Usual procedure:
- Tell the application about R_HOME RSRuby will fail unless the environment variable R_HOME is set.
- Make an instance of RSRuby available to all controllers RSRuby works by providing an instance of an “R object”, on which you call R functions as methods.
- Create a sample controller and view For testing purposes, I created a controller named Home with a single view named index:
- Create the view All that remains is to edit app/views/home/index.html.erb so as it displays the image:
rails Plotter cd Plotter rake db:createWe won’t use the database (default sqlite3) in this example, but you may use it later on.
To tell Plotter that R_HOME is /usr/lib/R, I put this in the file app/helpers/application_helper.rb:
module ApplicationHelper # set R_HOME if not set if ENV['R_HOME'].nil? ENV['R_HOME'] = "/usr/lib/R" end end
I provided the object by editing app/controllers/application_controller.rb to include a method named InitR:
class ApplicationController < r =" RSRuby.instance">
./script/generate controller Home index rm public/index.htmlI edited config/routes.rb so as the root of the application is the index view for the home controller:
ActionController::Routing::Routes.draw do |map| map.root :controller => "home" #default view is app/views/home/index.html.erb map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' endNow we can get to work on the file app/controllers/home_controller.rb. I wrote a sample method, show_image to plot a histogram using R via RSRuby:
def show_image # next 6 lines use R to plot a histogram @r = InitR() @d = @r.rnorm(1000) @l = @r.range(-4,4,@d) @r.png "/tmp/plot.png" @r.par(:bg => "cornsilk") @r.hist(@d, :range => @l, :col => "lavender", :main => "My Plot") @r.eval_R("dev.off()") #required for png output # then read the png file and deliver it to the browser @g = File.open("/tmp/plot.png", "rb") {|@f| @f.read} send_data @g, :type=>"image/png", :disposition=>'inline' endNot the prettiest code, but you get the idea. Obviously the owner of the HTTP daemon (www-data on Ubuntu) must have write permission to the location of the PNG file; /tmp in this case.
Which just says “wrap whatever comes out of the method show_image in an IMG SRC tag”.Home#index
Find me in app/views/home/index.html.erb <%= image_tag(url_for(:controller => "home", :action => "show_image")) %>
Installing BioRails
"BioRails":http:/projects/show/core is a commercially backed, open-source biological information management system designed specifically for pharmaceutical discovery research. BioRails core version is available free to use and the source code is available for download under the GNU Public License. Support services are available from "The Edge Software Consultancy Ltd":http//edgesoftwareconsultancy.com
This is a new BioRails Release Version at BioRails.org .
There is an example chemreg .
All support is now on BioRails.com .
You can start setting your development installation.
&] sudo apt-get install build-essential mysql-server mysql-client subversion ruby libzlib-ruby rdoc eruby irb libsvn-ruby ri libmysql-ruby libdbd-mysql-ruby imagemagick libmagick9-dev librmagick-ruby graphviz ruby1.8-dev libmysqlclient15-dev openssl htmldoc gnuplot rake zip sqlite3 libsqlite3-dev mongrel libruby-extras libxml2 libxml2-dev libxslt1-dev openoffice.org python-uno unoconv openoffice.org-dev
OpenOffice is needed so you can install the following packages:
&] sudo apt-get install openoffice.org openoffice.org-base openoffice.org-base-core openoffice.org-calc openoffice.org-common openoffice.org-core openoffice.org-dev openoffice.org-draw openoffice.org-filter-binfilter openoffice.org-mobiledev unoconv python-uno openoffice.org-headless
Gems is needed:
&] sudo gem install archive-tar-minitar builder chronic crypt fastercsv gnuplot hpricot htmldoc icalendar json mime-types mocha mongrel mongrel_cluster mysql ntp rcov rmagick mini_magick roodi rspec ruby-net-ldap rubyzip ruport sqlite3-ruby tidy transaction-simple tzinfo uuid uuidtools ZenTest
&] gem sources -a http://gems.github.com
&] sudo gem install mislav-will_paginate
&] gem list --local
&] sudo gem update
It is time to install source code.
For development:
&] mkdir trunk; svn co http://biorails.org/svn/biorails/core/trunk trunk/
For snapshot:
&] wget http://redmine.biorails.org/attachments/download/221?filename=biorails-3.0-2772.tar.gz ; tar -zvxf biorails-3.0-2772.tar.gz
Database connection:
&] cp config/database_template.yml config/database.yml ; nano config/database.yml
development:
adapter: mysql
database: biorails_development
username: biorails
password: moose
host: localhost
test:
adapter: mysql
database: biorails_test
username: biorails
password: moose
host: localhost
production:
adapter: oracle
database: localhost
username: biorails_validation
password: moose
/* Will need to login to mysql as root to initial run this script eg.
* mysql -u root -p
*/
create user biorails identified by 'moose';
create user 'biorails'@'localhost' identified by 'moose';
create database biorails_development;
grant all on biorails_development.* to 'root'@'localhost';
grant all on biorails_development.* to 'biorails'@'localhost';
create database biorails_test;
grant all on biorails_test.* to 'root'@'localhost';
grant all on biorails_test.* to 'biorails'@'localhost';
create database biorails_production;
grant all on biorails_production.* to 'root'@'localhost';
grant all on biorails_production.* to 'biorails'@'localhost';
&] mysql -u root -p < db/create_databases.mysql
grant all on biorails_production.* to 'biorails'@'localhost';
Create schema:
&] rake db:schema:load ; rake -T
Quick check:
&] rake biorails:check:all
Test preparation:
&] unoconv -l
Full test:
&] export RAILS_ENV=test
&] rake biorails:ferret_start
&] rake test
Bootstrap:
&] rake biorails:db:bootstrap
&] ruby script/server
Lighthttpd web server:
&] sudo apt-get install lighttpd
&] nano config/lighttpd-template.conf
########################################################################
# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
#
############ Options you really have to take care of ####################
server.modules = ("mod_rewrite", "mod_access", "mod_redirect", "mod_proxy", "mod_compress", "mod_accesslog")
server.document-root = "/home/biorails/enterprise/trunk/public/"
server.errorlog = "/var/log/lighttpd/error_log"
server.dir-listing = "disable"
## files to check for if .../ is requested
server.indexfiles = ("index.html", "index.htm", "index.rb")
&] sudo cp config/lighttpd-template.conf /etc/lighttpd/lighttpd.conf
&] sudo /etc/init.d/lighttpd stop
&] sudo lighttpd -f /etc/lighttpd/lighttpd.conf
Performance upgrade:
&] export RAILS_ENV=production
&] rake asset:packager:build_all
&] rake biorails:start
Installing R from CRAN, Bioconductor and Related Interfaces
R for All
Choose the last universal tar.gz file.
R for Windows
Choose the last installable file.
We can use R in the CommandPrompt if we add Path=Path;%R_PATH%
RDCOMServer: Look for other software and install R(D)COM Interface as DCOMServer usig R\DCOMServer and the variable RDCOM_PATH=D:\GNU\R\DCOMServer\bin. But you need rscproxyand rcom installed on R.
RExcel: Look for this link.
R for MacOS X
Choose the last dmg file.
R for Ubuntu
Choose the last binary file in /bin/linux/ubuntu or
&] sudo apt-get -y install r-*
R for fedora
Choose the last rpm file in /bin/linux/redhat/fedora1*/{i386,x86_64,src) or
&] sudo yum -y install R-*
RStudio (R multiform IDE)
Choose the last version of R to install in your machine (multiple version are allowed) and install IDE from their site.
GGobi for R
iPlots for R
iPlots eXtreme for R
ReShape for R
R-commander from R
Read the documentation.
You can choose your packages to install from repository or to do it directly from R CMD
&] sudo R
&] install.packages("Rcmdr", dependencies=TRUE)
] install.packages(c("car","MASS","nnet","XLConnect"))
Bioconductor from R
Read the documentation.
You can choose your packages to install from repository or to do it directly from R CMD
&] sudo R
> source("http://bioconductor.org/biocLite.R") ; biocLite()
> source("http://bioconductor.org/getBioC.R") ; getBioC()
R Environment Variable
Windows:
R_HOME=D:\GNU\R\R-2.10.1
Ubuntu:
R_HOME=/usr/lib/R
OSX:
R_HOME=/Library/Frameworks/R.framework/Resources
At the end:
RHOME=$R_HOME
R_PATH=$R_HOME/bin
R_PATH=D:\GNU\R\R-2.10.1\bin
R_LIBS=$R_HOME/library
Windows R(D)COM interface for R using CSharp
Read the documentation.
RPy interface for R
Read the documentation.
&] sudo yum install rpy.i686 #in fedora
The steps are:
Check that you have built R with the configure option '--enable-R-shlib' to make R as a shared library
&]cd $R_HOME
&]make distclean
&]./configure --enable-R-shlib
&]make
&] make install
- make a link to RHOME/bin/libR.so in /usr/local/lib or /usr/lib, then run 'ldconfig'
- or put the following line in your .bashrc (or equivalent) &] export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:RHOME/bin
- or edit the file /etc/ld.so.conf and add the following line RHOME/bin, then run 'ldconfig'.
- &] python setup.py install
RPy2 interface for R
Read the documentation.
The steps are:
- &] easy_install rpy2
- &] tar -zxf rpy2_package.tar.gz
- &] cd rpy2_package
- &] python setup.py install
import rpy2.tests import unittest # the verbosity level can be increased if needed tr = unittest.TextTestRunner(verbosity = 1) suite = rpy2.tests.suite() tr.run(suite)
RSPython interface for R
Read the documentation.
The steps:
- &] sudo cp ~/Downloads/RSPython_0.7-1.tar.gz /opt ; cd /opt
- &] sudo chmod -R +x RS*
- &] sudo R CMD INSTALL -c RSPython_0.7-1.tar.gz
RSPerl interface for R
The steps:
- &] sudo cp ~/Downloads/RSPerl_0.92-1.tar.gz /opt ; cd /opt
- &] sudo chmod -R +x RS*
- &] sudo R CMD INSTALL -c -l
--configure-args='--with-in-perl' RSPerl_0.92-1.tar.gz # -l is option for PERL5LIB
You can try another mirror to fetch the file.
Read the documentation.
In R, sudo R
> install.packages(Rserve)
RRuby interface for R
You can try another mirror to fetch the file.
Read the documentation.
&] sudo gen install rinruby
RinRuby interface for R
You can try another mirror to fetch the file.
Read the documentation.
RSRuby interface for R
You can try another mirror to fetch the file.
Read the documentation.
First option:
- &] sudo cp ~/Downloads/rsruby*{gem,tgz} /opt ; cd /opt
- &] sudo chmod -R +x rs*
- &] sudo gem install rsruby-0.5.1.1.gem --with-R-dir=$R_HOME
- &] sudo tar -zxf rsruby-0.5.tgz
- &] sudo chmod -R +x rs*
- &] cd rsruby
- &] ruby setup.rb config -- --with-R-dir=$R_HOME
- &] ruby setup.rb setup
- &] ruby setup.rb test
- &] sudo ruby setup.rb install
Note that you’ll need to set the R_HOME and RHOME environment variable prior to installation.
On MacOX, RHOME=R_HOME=/Library/Frameworks/R.framework/Resources.
On Ubuntu, when installed from source, RHOME=R_HOME=/usr/local/lib/R. It is useful to just drop this into /etc/environment so that this variable is set upon login.
Otherwise update /etc/bash_profile .
&] export R_HOME=/path/to/R/for/your/OS &] export RHOME=/path/to/R/for/your/OS &] sudo gem install rsruby -- --with-R-dir=$R_HOME On Ubuntu &] sudo gem install rsruby -- --with-R-home=/usr/lib/R --with-R-include=/usr/share/R/include You may try to install it from source. Compile and install the Ruby library using setup.rb as shown. You need to supply the location of your R installation for the libR shared library. This will usually be the same as R_HOME. &] cd rsruby &] ruby setup.rb config -- --with-R-dir=/usr/lib/R &] ruby setup.rb setup &] sudo ruby setup.rb install You may test it &] ruby setup.rb test &] irb -rrsruby >> @R = RSRuby.instance >> @R.wilcox_test([1,2,3],[4,5,6]) >> foo = @R.as_data_frame(1)