Mercurial > repos > siwaa > gama
comparison README.md @ 0:f895e266b37a draft
planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/use/-/tree/gama/GAMA/galaxy-tools commit 67d85c013c62c16392b4796af86836b1334f2eef
author | siwaa |
---|---|
date | Tue, 04 Jun 2024 15:18:01 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f895e266b37a |
---|---|
1 # Galaxy tools for GAMA platform | |
2 | |
3 Desc | |
4 ==== | |
5 | |
6 The **gama_tool.xml** tool runs a **GAMA Python client** | |
7 interacting with **gama-server (Headless server)** | |
8 concerning a **"Predator Prey" agent-based simulation**. | |
9 It relies on the **gama.simg** container. | |
10 | |
11 See also : | |
12 [containers](../containers) from where container gama.simg comes ; | |
13 [use-containers](../use-containers) ; | |
14 [../../README.md](../../README.md) | |
15 | |
16 The **gama_tool.xml** tool case has been written **from an existing example** | |
17 (*same example as in [use-containers](../use-containers)*) : | |
18 | |
19 - example code of https://github.com/gitrdm/gama-client-python | |
20 project | |
21 - URL : https://github.com/gitrdm/gama-client-python?tab=readme-ov-file#example-code | |
22 - more : see [../../README.md](../../README.md) | |
23 | |
24 The **gama_tool.xml** tool case is based on : | |
25 | |
26 - A **"Predator Prey" agent-based model** of the **GAMA platform**. | |
27 - A **Python program** (*MY_sequential_example.py*) interacting with | |
28 the GAMA platform in headless mode, as a GAMA Python client to : | |
29 - **drive the experiment** : initialization, parameters settings, | |
30 running, pausing, running some more steps, stop. | |
31 - **observe the experiment** : getting information values such as : | |
32 cycle, nb_preys/nb_preys_init... | |
33 | |
34 Sources | |
35 ======= | |
36 | |
37 The reused existing files have been copied | |
38 at **[src/originals](./src/originals)** folder so : | |
39 | |
40 - **sequential_example.py** | |
41 from gama-client-python/examples/sequential_example.py : | |
42 | |
43 ``` | |
44 # examples | |
45 cd src/originals | |
46 mkdir TMP; cd TMP | |
47 git clone https://github.com/gitrdm/gama-client-python.git | |
48 cd .. | |
49 cp -fr TMP/gama-client-python/examples . | |
50 rm -fr TMP | |
51 ``` | |
52 | |
53 - **predatorPrey.gaml** and **gama-headless.sh** from gama-platform/headless | |
54 (gama-platform/headless/samples/predatorPrey/predatorPrey.gaml, | |
55 gama-platform/headless/gama-headless.sh) | |
56 by gama.simg : | |
57 | |
58 ``` | |
59 # headless | |
60 gama_SIMGPATH=../../../containers/gama.simg | |
61 cd src/originals | |
62 mkdir OPT | |
63 singularity exec --bind ./OPT:/OPT $gama_SIMGPATH bash -c "cp -fr /opt/gama-platform /OPT/." | |
64 cp -fr OPT/gama-platform/headless headless | |
65 rm -fr OPT | |
66 ``` | |
67 | |
68 Galaxy tool Inputs / Outputs | |
69 ============================ | |
70 | |
71 **[gama_tool.xml](./gama_tool.xml) Inputs** : | |
72 | |
73 - **nb_preys_init** (integer) | |
74 - **nb_predators_init** (integer) | |
75 - **nb_more_steps** (integer) | |
76 | |
77 **[gama_tool.xml](./gama_tool.xml) Outputs** : | |
78 | |
79 - **results .txt file** produced while running the simulator | |
80 (cf 'reflex save_result' into MY_predatorPrey.gaml). | |
81 - **run_server .txt file** : gama-server screen display capture | |
82 - **run_client .txt file** : gama-client screen display capture | |
83 | |
84 Galaxy tool Code | |
85 ================ | |
86 | |
87 The Galaxy tool **[src](./src) folder** contains : | |
88 | |
89 - **[MY_sequential_example.py](./src/MY_sequential_example.py)** : | |
90 **Python code** | |
91 | |
92 - created from [src/originals/examples/sequential_example.py](./src/originals/examples/sequential_example.py) | |
93 - modification : variables values for gama-server | |
94 (*MY_SERVER_URL, MY_SERVER_PORT, GAML_FILE_PATH_ON_SERVER*), | |
95 for experiment (*EXPERIMENT_NAME, MY_EXP_INIT_PARAMETERS*). | |
96 - modification : added some "print" | |
97 | |
98 - **[MY_predatorPrey.gaml](./src/MY_predatorPrey.gaml)** : | |
99 **"Predator Prey" agent-based simulator** file | |
100 | |
101 - created from [src/originals/headless/samples/predatorPrey/predatorPrey.gaml](./src/originals/headless/samples/predatorPrey/predatorPrey.gaml) | |
102 - modification : added **'reflex save_result'** to save some results data | |
103 into results.txt file. | |
104 | |
105 - **[cmd_gama_headless.sh](./src/cmd_gama_headless.sh)** : | |
106 **commands file** (Shell script) | |
107 launching GAMA Headless gama-server *(by calling MY_gama-headless.sh)* | |
108 | |
109 - **[cmd_python_client.sh](./src/cmd_python_client.sh)** : | |
110 **commands file** (Shell script) | |
111 launching Python program MY_sequential_example.py | |
112 | |
113 - **[MY_gama-headless.sh](./src/MY_gama-headless.sh)** : | |
114 | |
115 - created from [src/originals/headless/gama-headless.sh](./src/originals/headless/gama-headless.sh) | |
116 - modify : setting **java.io.tmpdir** property | |
117 (```-Djava.io.tmpdir=$MY_TEMP_DIR```), | |
118 because of gama_tool.xml running error : | |
119 ``` | |
120 javax.imageio.IIOException: Can't create cache file! | |
121 at java.desktop/javax.imageio.ImageIO.createImageInputStream(ImageIO.java:361) | |
122 .... | |
123 Caused by: java.nio.file.FileSystemException: /tmp/imageio10268746820164254686.tmp: Read-only file system | |
124 .... | |
125 SLF4J: No SLF4J providers were found. | |
126 SLF4J: Defaulting to no-operation (NOP) logger implementation | |
127 SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details. | |
128 ``` | |
129 | |
130 *Default temporary directory for Linux is /tmp. The JVM automatically | |
131 sets the temporary directory path as a system property. It can be | |
132 changed by setting the java.io.tmpdir property to the desired | |
133 path when starting the JVM.* | |
134 | |
135 Local run by 'planemo serve' | |
136 ============================ | |
137 | |
138 **Installs** : | |
139 | |
140 - Install Singularity : singularity version 3.8.5 | |
141 | |
142 - Install Galaxy code : | |
143 ``` | |
144 cd ~/DEVS | |
145 git clone https://github.com/galaxyproject/galaxy.git | |
146 ``` | |
147 | |
148 Note : Galaxy requiring at least singularity 3.7 | |
149 (cf singularity exec : --no-mount option) | |
150 | |
151 - Install Planemo into a Python virtualenv : | |
152 ``` | |
153 pip3 install --upgrade pip wheel setuptools virtualenv | |
154 python3 -m venv _venv_planemo | |
155 source _venv_planemo/bin/activate | |
156 | |
157 python3 -m pip install planemo | |
158 ``` | |
159 | |
160 **Use** : | |
161 | |
162 ``` | |
163 source _fab/_venv_planemo/bin/activate | |
164 ``` | |
165 | |
166 - Survey : | |
167 ``` | |
168 htop | |
169 ``` | |
170 | |
171 - Check tool syntax : | |
172 ``` | |
173 planemo lint --report_level all --fail_level error gama_tool.xml | |
174 ``` | |
175 | |
176 - Run tool : | |
177 ``` | |
178 make serveGAMA | |
179 ``` | |
180 | |
181 => http://127.0.0.1:9090 | |
182 | |
183 Use those Galaxy tools | |
184 ====================== | |
185 | |
186 See [use-tools](../use-tools). | |
187 | |
188 |