Commit 1b1108a2 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Update documentation to run application

parent 8124dea9
Pipeline #12842 passed with stage
in 1 minute and 26 seconds
......@@ -3,6 +3,7 @@ __pycache__/
.env
.env_dev
.idea/
.vscode
# Backend static files
backend/public
......
......@@ -22,6 +22,8 @@ Therefore to run the application you need:
#### Configuration
For `docker-compose`, you need to create a `.env` file: `touch .env`.
The settings of the Django server is based on the `backend/.env` file. You can copy the sample file
(`cp backend/.env.sample backend/.env`) and fill in the variables.
......@@ -29,4 +31,29 @@ You can of course customize more of the Django server settings in the `settings`
### Run the application
#### Populate the database
\ No newline at end of file
For the moment, only the `docker-compose.dev.yaml` is used. To run the application simply run the command:
```bash
docker-compose -f docker-compose.dev.yaml up --build
```
The `--build` option is only necessary during the first usage or when you make changes that need the docker
container to be built again.
Since directories with source codes are mounted in the containers, changes you make locally should be
directly reflected on the application.
#### Populate the database
You have a set of scripts available within the `backend/scripts` directory that you can execute directly
from within the container. First identify the container ID corresponding to the backend with `docker ps` command. Then you can execute a bash terminal within the container and execute the scripts you want:
```bash
docker exec -it YOURCONTAINER_ID bash
root@YOURCONTAINER_ID:/code# python scripts/script.py
```
For the moment you can:
* Import all kegg orthologies with `load_kegg.py`: It directly fetch all KEGGs KO from the KEGG REST API.
* Import genes from IGC catalog from the [annotation file](ftp://ftp.cngb.org/pub/SciRAID/Microbiome/humanGut_9.9M/GeneAnnotation/IGC.annotation_OF.summary.gz). You can a small part of this annotation file in the `dev_data` folder.
certifi==2019.6.16
chardet==3.0.4
Django==2.2.1
django-cors-headers==3.0.2
django-environ==0.4.5
......@@ -5,10 +7,14 @@ django-extensions==2.1.7
django-filter==2.1.0
djangorestframework==3.9.4
djangorestframework-jwt==1.11.0
idna==2.8
numpy==1.16.4
pandas==0.24.2
psycopg2==2.8.2
PyJWT==1.7.1
python-dateutil==2.8.0
pytz==2019.1
requests==2.22.0
six==1.12.0
sqlparse==0.3.0
\ No newline at end of file
sqlparse==0.3.0
urllib3==1.25.3
......@@ -37,7 +37,11 @@ def parse_ko(line):
"""
content = line.split('\t')
function_id = content[0].split(':')[1]
names = content[1].split(';')
if ';' in content[1]:
names = content[1].split(';')
else:
_LOGGER.warning(f"Parsing issue with {function_id}, corresponding line: {line}")
names = [content[1], ''] # Ugly fix to handle one specific case with no name: K23479
if '[EC:' in names[1]:
ec_number = names[1].split('[EC:')[1].rstrip(']')
else:
......
......@@ -33,7 +33,7 @@ services:
build:
context: ./frontend
volumes:
- ./frontend:/app:ro
- ./frontend:/app
- '/app/node_modules'
ports:
- "8080:8080"
......
......@@ -8,32 +8,32 @@
import Chart from 'chart.js';
export default {
props: {
geneLengthData: {
type: Object,
required: true
}
},
updated() {
this.createChart('histogram');
},
methods: {
props: {
geneLengthData: {
type: Object,
required: true,
},
},
updated() {
this.createChart('histogram');
},
methods: {
createChart(chartId) {
const ctx = document.getElementById(chartId);
const histoData = {
labels: this.geneLengthData.labels,
datasets:[
{
label: 'Number of genes',
data: this.geneLengthData.counts
}
]
}
labels: this.geneLengthData.labels,
datasets: [
{
label: 'Number of genes',
data: this.geneLengthData.counts,
},
],
};
const myChart = new Chart(ctx, {
type: 'bar',
data: histoData,
});
}
}
}
</script>
\ No newline at end of file
},
},
};
</script>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment