aboutsummaryrefslogtreecommitdiff
path: root/doc/development.org
blob: 4f3693ee99dd8fccdc937c7600f9d40e252657f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
* Development

** Using GN2_PROFILE

After cloning the git source tree you can run the contained GN2 using
an existing GN2_PROFILE, i.e., use a profile that was create to run a
binary installation of GN2. This profile may be found by typing

: which genenetwork2
:   /home/wrk/opt/gn-latest-guix/bin/genenetwork2

An example of running the development version would be

: env GN2_PROFILE=/home/wrk/opt/gn-latest-guix ./bin/genenetwork2

Profiles are stored in /gnu/store, so you may pick one up there

: readlink -f $(dirname $(dirname `which genenetwork2`))
:   /gnu/store/dvckpaw770b00l6rv4ijql8wrk11iypv-profile

and use that instead.

Note that the genenetwork2 script sets up the environment for running
the webserver. This includes path to R modules and python modules. These
are output on startup. To make sure there is no environment pollution you can

** Javascript modules

As of release 2.10-pre4 we Javascript modules are installed in three places:

1. JS_GUIX_PATH: the Guix store - these are Guix pre-packaged modules
2. The git source tree (./wqflask/wqflask/static/packages/)
3. JS_GN_PATH: a local directory containing (temporary) development modules

Packages currently in git (2) will move to JS_GUIX_PATH (1) over
time. This is to keep better track of origin updates. Putting packages
in git (2) is actively discouraged(!), unless there are GN2 specific
adaptations to the original Javascript modules.

JS_GN_PATH (3) is for development purposes. By default is is set to
$HOME/genenetwork/javascript. Say you are working on an updated
version of a JS module not yet in (1) you can simply check out that
module in that path and it should show up.

* Python modules

Python modules are automatically found in the Guix profile.

For development purposes it may be useful to try some Python package.
Obviously this is only a temporary measure and when you decide to
include the package it should be packaged in [[http://git.genenetwork.org/guix-bioinformatics/guix-bioinformatics][our GNU Guix software
stack]]!

To add packages you need to make sure the correct Python is used (currently
Python 2.7) to install a package. E.g..

#+BEGIN_SRC sh
python --version
  Python 2.7.16
pip --version
  pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
#+END_SRC

You can install a Python package locally with pip, e.g.

#+BEGIN_SRC sh
pip install hjson
#+END_SRC

This installed in ~$HOME/.local/lib/python3.8/site-packages~. To add
the search path for GeneNetwork use the environment variable

#+BEGIN_SRC sh
export PYTHON_GN_PATH=$HOME/.local/lib/python3.8/site-packages
#+END_SRC

Now you should be able to do

#+BEGIN_SRC python
import hjson
#+END_SRC

In fact you can kick off a Python shell with something like

#+BEGIN_SRC python
env SERVER_PORT=5013 WEBSERVER_MODE=DEBUG LOG_LEVEL=DEBUG \
  SQL_URI=mysql://gn2:webqtl@localhost/db_webqtl_s \
  GN2_PROFILE=~/opt/genenetwork2 \
  ./bin/genenetwork2 ./gn2/default_settings.py -c
Python 2.7.17 (default, Jan  1 1970, 00:00:01)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hjson
#+END_SRC

It should now also work in GN2.

* TODO External tools