LIMS*Nucleus characterizes two types of users, regular users and
administrators. LIMS*Nucleus users are unique to LIMS*Nucleus and not
shared with the operating system nor database. Administrative
functionality is listed in the table below.
Item
Description
Add User
Add a user and password
View all users
Add Project
Add a new project; users cannot create projects, only use them
This page discusses the guidelines for writing an Artanis application
such as LIMS*Nucleus that is suitable for Guix packaging. If you are
looking for modifications needed in the Artanis source code, look here.
Write a Guix
packageable Artanis application
First read the discussion on
modifications required to the Artanis source code so you are aware that
all temporary files created by your application must be moved to a
directory outside the application directory. In addition, Artanis’ cache
must be move outside the application directory, as well as artanis.conf
so it remains editable. These activities can be handled with a post
installation initialization file.
One time initialization
Because your artanis app needs some directories outside of the
application directory to work with temporary files, configuration files
etc., a one time initialization script can be run to set up your server.
The overall process would look like:
guix package -i limsn
init-limsn.sh
install-pg-aws.sh
start-limsn.sh
The initialization file would create required directories and copy
over the artanis.conf file. Note that the placeholder PATH_INTO_STORE is
replaced on installation by the path into the store.
Because a configuration file outside the project directory is being
used, you can use a startup script to launch your application:
start-limsn.sh
1 2 3 4 5 6
#!/bin/bash !# export LC_ALL="C" mkdir -p /var/tmp/limsn/tmp/cache cd PATH_INTO_STORE/share/guile/site/3.0/limsn art work -h0.0.0.0 --config=$HOME/.config/limsn/artanis.conf
In this example -h0.0.0.0 is needed for running on Amazon Web
Services
GNUPLOT
With regular Artanis Gnuplot can be run on the server and generate
*.png files in the ../pub directory that are accessible to the .html.tpl
file via:
page1.html.tpl
1
<imagesrc= <%= myplot %>>
Where in the above snippet the variable myplot ==
“../pub/myplot.png”. With guix modified Artanis, the .png file would
have to go into /tmp/limsn and would become inaccessible due to security
restrictions. To get around this, load the myplot variable with svg
commands. This is accomplished by first creating the gnuplot script with
the following commands:
my-gnuplot-script.txt
1 2 3 4 5 6
reset session set terminal svg size 800,500 save '-' set key box ins vert right top set grid ...etc.
The ‘save’-’’ statement will save to standard output so that you can
pipe into your variable. Here is a helper function that will collect the
svg commands:
Now in the above snippet myplot-svg == ’<svg width=“600”
height=“350” viewBox=“0 0 600 350” xmlns=“http://www.w3.org/2000/svg”
xmlns:xlink=“http://www…etc….”
Application specific
variables
Application specific variables are defined in ENTRY such as:
ENTRY
1 2 3
... (conf-set! 'maxnumplates 100) ...
Since ENTRY is in the store, this will only work for variables that
are not available to the end user for (re)setting. To provide editable
application specific variables, put them in artanis.conf. Variables are
grouped in artanis.conf. LIMS*Nucleus specific variable ‘maxnumplates’
is placed in the ‘cookie’ group for convenience, even though it is not a
cookie.
(substitute*"artanis/config.scm" (("debug.monitor = <PATHs>\")") "debug.monitor = <PATHs>\")\n ((cookie expire)\n 3600\n \"Cookie expiration time in seconds.\n 1 hour is 3600\n 6 hours 21600\n 1 month 2592000\n cookie.expire = <integer>\")\n\n ((cookie maxplates)\n 10\n \"Maximum number of plates per plate-set.\n cookie.maxplates = <integer>\")"))
Modify controller syntax
Controllers as they are written will generate a warning:
guix package: warning: failed to load ‘(limsn app controllers
plates)’: no code for module (lims app controllers plates)
/home/mbc/.guix-profile/share/guile/site/3.0/myapp/app/controllers/pages.scm:4:0:
warning: module name (app controllers plates) does not match file name
‘limsn/app/controllers/plates.scm’ hint: File
`/home/mbc/.guix-profile/share/guile/site/3.0/limsn/app/controllers/plates.scm’
should probably start with: (define-module (limsn app controllers
plates))
Guix expects the first statement in a module to
begin with (define-module ()….) Artanis wants modules
to (use-modules (artanis mvc controller)) Satisfy both requirements
with:
;;error: define-artanis-controller: unbound variable ;;hint: Did you forget `(use-modules (artanis mvc controller))'?
(define-artanis-controller pages) ; DO NOT REMOVE THIS LINE!!! ;;libraries must be imported after define-artanis-controller (use-modules (myapp lib mylib) )
(pages-define plates (lambda (rc)......etc.
Be sure to import libraries after (define-artanis-controller
)
Make Libraries accessible
Artanis provides the …./lib directory to hold
libraries. This directory is placed on the GUILE_LOAD_PATH for you. To
avoid warnings, you may wish to write your library as a module
e.g. (define-module (limsn lib mylib)…) in which case you need to place
your project directory on GUILE_LOAD_PATH with a statment in ENTRY such
as:
(Static
IP address) A transient IP is adequate and will be used in the video tutorial. Consider a static IP for production. A
static IP address is free upon request, but must be used on a running
instance. You will be charged for a static IP that is requested but not
used.
Credit card number - a valid credit card is required to register.
Note that these are Amazon requirements.
Installation
Note: the video tutorial
of AWS EC2 installation of LIMS*Nucleus describes installation of an
older version of LIMS*Nucleus. Though still useful to watch as the
overall process and many details are the same, details discussed below
supercede what is in the video. The main changes are different names for
scripts are being used, LIMS*Nucleus is now packaged as a guix module
and so is installed in the store, and because a guix pull must be
performed the free tier t2.micro may not provide enough memory. Use
t2.medium.
Local: download the archive of install
scripts and transfer to AWS with scp:
install-limsn-ec2.sh and guix-install-mod.sh must be in the same
directory. Multiple files described below are loaded into the store at
PATH_INTO_STORE/limsn/scripts
Supplied Scripts
Scripts available on this website or in /gnu/store are described on
the scripts page.
A project contains plate sets, each of which contains plates etc.
Projects can only be created by an administrator. Plate Sets can be
created by users. Other entities are created automatically as needed.
Plates, wells, samples are created at the time of plate set
creation.
Plates and wells are created automatically during rearraying
operations.
LIMS*Nucleus example database contains plate sets, plates, hit list,
assay runs and data. The various projects are at different stages of
completion to demonstrate the functionality of the application.
Project ID
Description
Utility
PRJ-1
3 plate sets with 2 96 well plates each; includes data and hit
lists
visualize data; visualize hit lists; group plate sets;
PRJ-2
1 plate set with 2 384 well plates each; includes data
create hit lists
PRJ-3
1 plate set with 1 1536 well plate
visualize data
PRJ-10
2 plate sets with 10 96 well plates each
add data;create hit lists; subselect plate sets
### Files for import
Provide your own import files or use the supplied data below:
Description
File
Accession IDSs for PS-1 ( 2 96 well plates, 4 controls)
Hit identification can be accomplished using one of three different
methods:
1. Select an algorithm
during data import
Select an algorithm from the drop down during data import. Hits will
be identified and the Hit List name and description text fields will be
enabled so you can register the hit list.
2.
In the scatterplot/replot view, view and generate a hit list
When plotting or replotting, the tool
icon provides the option to view a hit list. The hit list view provides
the option to register and save the hit list.
3.
Export data and use external data analysis to identify hits. Import the
hit list.
Post data import, annotated data can be exported for visualization
using other software. A hit list can be compiled external to
LIMS*Nucleus and then imported.
Scroll down to the hit list and import under the tools icon:
A Guix pack installation is a simple installation suitable for users
not interested in the Guix package manager. The detailed instructions
below follow the same process automated by the install script found on
the evaluate page, but provides additional
diagnostic information.
The first step in the install script is setting up the database.
Manually install the database using instructions on the postgres page.
If you are using the install script and it
is not executable, change permissions:
1
chmod 777 install-limsn-pack.sh
Download and unzip the
archive
1 2
wget https://github.com/limsn/labsolns/releases/download/v0.1.0p/limsn-0.1.0-pack.tar.gz tar xf ./limsn-0.1.0-pack.tar.gz
Note that in the above example I am using the admin account on AWS so
$HOME == /home/admin
Initialize LIMS*Nucleus
Initialize by executing ./bin/init-limsn-pack.sh. The function of the
various scripts is described on the scripts
page. Check that the $HOME/.config/limsn directory has been created and
artanis.conf has been copied into the directory:
1 2
$ ls$HOME/.config/limsn artanis.conf
Check that $HOME/.bashrc has been modified to include exports for
LC_ALL, PATH, GUILE_LOAD_PATH, and GUILE_DBD_PATH.
$HOME/.bashrc
1 2 3 4 5 6 7 8 9 10 11 12 13 14
... $cat$HOME/.bashrc /# sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi export LC_ALL="C" export PATH=/home/admin/bin:/gnu/store/2rl49lcanmqn26s660dd85lv7pfn0ykb-limsn-0.1.0/bin:/home/admin/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games export GUILE_LOAD_PATH=/home/admin/gnu/store/rj0pzbki1m5hpcshs614mhkrgs2b3i9d-artanis-0.5.2/share/guile/site/3.0:/home/admin/gnu/store/780bll8lp0xvj7rnazb2qdnrnb329lbw-guile-json-3.5.0/share/guile/site/3.0:/home/admin/gnu/store/jmn100gjcpqbfpxrhrna6gzab8hxkc86-guile-redis-2.1.1/share/guile/site/3.0:/home/admin/gnu/store/3f0lv3m4vlzqc86750025arbskfrq05p-guile-dbi-2.1.8/share/guile/site/2.2 export GUILE_DBD_PATH=/home/admin/gnu/store/z5kilafxayw2kdvn3anw1shkqij17dqb-guile-dbd-postgresql-2.1.8/lib
source .bashrc to make certain that all environment variables have
been properly set:
1
$source$HOME/.bashrc
Modify the
artanis.conf configuration file
Critical parameters are described on the configuration page. You must have in
hand IP addresses for the database and client.
1
sudo nano $HOME/.config/limsn/artanis.conf
Make sure the
database is available and loaded
The psql command below will work on a local database - modify
accordingly. You should find 10 preloaded projects. Projects 4-9 are
empty and can be used for experimentation:
id | project_sys_name | descr | project_name | sessions_id | updated ----+------------------+------------------------------------------+----------------------+-------------+------------------------------- 1 | PRJ-1 | 3 plate sets with 2 96 well plates each | With AR, HL | 9999999999 | 2022-04-06 11:07:05.854606+00 2 | PRJ-2 | 1 plate set with 2 384 well plates each | With AR | 9999999999 | 2022-04-06 11:07:06.825439+00 3 | PRJ-3 | 1 plate set with 1 1536 well plate | With AR | 9999999999 | 2022-04-06 11:07:08.32809+00 4 | PRJ-4 | description 4 | MyTestProj4 | 9999999999 | 2022-04-06 11:07:13.364018+00 5 | PRJ-5 | description 5 | MyTestProj5 | 9999999999 | 2022-04-06 11:07:13.365426+00 6 | PRJ-6 | description 6 | MyTestProj6 | 9999999999 | 2022-04-06 11:07:13.367082+00 7 | PRJ-7 | description 7 | MyTestProj7 | 9999999999 | 2022-04-06 11:07:13.368542+00 8 | PRJ-8 | description 8 | MyTestProj8 | 9999999999 | 2022-04-06 11:07:13.370008+00 9 | PRJ-9 | description 9 | MyTestProj9 | 9999999999 | 2022-04-06 11:07:13.371613+00 10 | PRJ-10 | 2 plate sets with 10 96 well plates each | Plates only, no data | 9999999999 | 2022-04-06 11:07:13.372956+00 (10 rows)
lndb=>
Start LIMS*Nucleus
Start in detached mode so you can close the terminal. To kill the
process you will need to look up the PID and kill. Start in regular mode
to monitor any error messages.
1
$nohup start-limsn.sh &
to kill Ctrl-C in interactive mode or in detached mode:
View a schematic of the LIMS*Nucleus architecture here. If you have experience with
PostgreSQL, you may wish to install the LIMS*Nucleus database
independent of the client utilizing resources you already control
e.g. an AWS instance of Postgres or Postgres running in your internal
datacenter. This archive provides the
necessary scripts for database installation/configuration. LIMS*Nucleus
is agnostic with respect to the location of the database - all that is
needed is a valid connection string. Once the database has been
configured, the artanis configuration
file must be modified.
Scripts included are:
Name
Description
initdba.sql
create users
initdbb.sql
create database
initdbc.sql
create schema and grant privileges to users
create-db-sql
create tables, load functions, load required data e.g. layouts,
plate types, assay types, etc.
example-data.sql
load example data projects 1-10. Note this is not optional as
LIMS*Nucleus will not boot without Project 1 in the database
drop-func-tables.sql
used to refresh the database i.e. delete all user created data and
reload required and example data
install-pg.sh
install script that calls above scripts; see below for options
Once the database is up and running, install the client.
Postgres Install script
The postgres install script can be used to install a data directory
under the current user, \(HOME/lndata, or to
modify the database installed by <code>sudo apt-get install
postgres</code> in the default data directory at
/etc/postgresql/\)PGMAJOR/main
Take ownership with sudo chown -R admin:admin
/var/run/postgresql where admin:admin is the user id
Default postgres directory
install-pg.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
PGMAJOR=$(eval"ls /etc/postgresql") PGHBACONF="/etc/postgresql/$PGMAJOR/main/pg_hba.conf" sudo sed -i 's/host[ ]*all[ ]*all[ ]*127.0.0.1\/32[ ]*md5/host all all 127.0.0.1\/32 trust/'$PGHBACONF
PGCONF="/etc/postgresql/$PGMAJOR/main/postgresql.conf" sudo sed -i 's/\#listen_addresses =/listen_addresses =/'$PGCONF eval"sudo pg_ctlcluster $PGMAJOR main restart"
psql -U postgres -h 127.0.0.1 postgres -a -f initdba.sql psql -U ln_admin -h 127.0.0.1 postgres -a -f initdbb.sql psql -U ln_admin -h 127.0.0.1 -d lndb -a -f initdbc.sql psql -U ln_admin -h 127.0.0.1 -d lndb -a -f create-db.sql psql -U ln_admin -h 127.0.0.1 -d lndb -a -f example-data.sql