Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 567717a

Browse files
authored
Merge pull request #131 from VariantEffect/develop
Merge v2.0
2 parents 135946e + 346cce5 commit 567717a

File tree

259 files changed

+21886
-11171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+21886
-11171
lines changed

.dockerignore

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
venv/
2+
sphinx-venv/
3+
.envrc
4+
.env
5+
*.pyc
6+
debug.log
7+
.pytest_cache/*
8+
docs/build
9+
*.env
10+
*.envrc
11+
geckodriver.log
12+
*.pyc
13+
.sql
14+
nginx.conf
15+
.cert
16+
.key
17+
.python-version
18+
.pre-commit-config.yaml
19+
nginx.conf
20+
pyproject.toml
21+
template.envrc
22+
publish
23+
24+
# GitHub
25+
.gitignore
26+
.git/
27+
28+
# Docker
29+
.dockeringore
30+
docker-compose-dev.yml
31+
docker-compose-prod.yml
32+
Dockerfile
33+
docker/
34+
35+
# vscode
36+
.vscode/
37+
.idea/
38+
39+
# Byte-compiled / optimized / DLL files
40+
__pycache__/
41+
*.py[cod]
42+
43+
# C extensions
44+
*.so
45+
46+
# Distribution / packaging
47+
bin/
48+
docs/docs/build/
49+
develop-eggs/
50+
dist/
51+
eggs/
52+
lib/
53+
lib64/
54+
parts/
55+
sdist/
56+
var/
57+
*.egg-info/
58+
.installed.cfg
59+
*.egg
60+
61+
# mypy
62+
.mypy_cache/*
63+
64+
# postgres
65+
*.dump
66+
67+
# Installer logs
68+
pip-log.txt
69+
pip-delete-this-directory.txt
70+
71+
# Unit test / coverage reports
72+
.tox/
73+
.coverage
74+
.cache
75+
nosetests.xml
76+
coverage.xml
77+
78+
# Django stuff:
79+
*.log
80+
*.pot
81+
staticfiles/
82+
static/
83+
media/
84+
85+
# Sphinx documentation
86+
docs/_build/
87+
88+
# Ignore secrets
89+
secrets.json
90+
.settings-*.env
91+
92+
/.ipynb_checkpoints/regex-test-checkpoint.ipynb
93+
*-checkpoint.ipynb
94+
.ipynb_checkpoints/
95+
/uml.pdf
96+
/uml.dot
97+
/cprofile/
98+
cprofile/*
99+
logs/
100+
default/

.gitignore

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
venv/
2+
.envrc
23
sphinx-venv/
34
*.pyc
45
staticfiles/
5-
/static/
6+
static/*
7+
!static/.gitkeep
8+
logs/*
9+
!logs/.gitkeep
10+
media/*
611
.env
712
debug.log
813
.pytest_cache/*
14+
docs/build
15+
docs/mavehgvs
16+
docker/nginx/nginx.conf
17+
*.cert
18+
*.key
919

1020
geckodriver.log
1121
*.pyc
@@ -24,7 +34,7 @@ __pycache__/
2434

2535
# Distribution / packaging
2636
bin/
27-
build/
37+
docs/docs/build/
2838
develop-eggs/
2939
dist/
3040
eggs/
@@ -74,12 +84,13 @@ docs/_build/
7484

7585
# Ignore secrets
7686
secrets.json
87+
.settings-*.env
88+
7789
/.ipynb_checkpoints/regex-test-checkpoint.ipynb
7890
*-checkpoint.ipynb
7991
.ipynb_checkpoints/
8092
/uml.pdf
8193
/uml.dot
8294
/cprofile/
8395
cprofile/*
84-
logs/
85-
.settings-*.env
96+
default/

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-yaml
6+
- id: check-json
7+
- id: debug-statements
8+
- id: detect-private-key
9+
- id: end-of-file-fixer
10+
files: \.py$
11+
- id: pretty-format-json
12+
- id: trailing-whitespace
13+
files: \.py$
14+
- repo: https://github.com/psf/black
15+
rev: 21.5b1
16+
hooks:
17+
- id: black
18+
language_version: python3
19+
args: [--line-length=79]

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.6.12

ADMINISTRATORS.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Introduction
2+
This guide details how to use the custom `manage.py` shell commands. All
3+
commands can be invoked using the shell command format:
4+
5+
```shell script
6+
python manage.py <command name> --settings=settings.<your settings module>
7+
```
8+
9+
You can omit the settings argument to use the default settings module (the
10+
module imported in `mavedb/settings.py`).
11+
12+
## Django-reversion
13+
[Django-reversion](https://django-reversion.readthedocs.io/en/stable/) has been
14+
integrated with the site. This is a well maintained model versioning application
15+
that keeps a history of each instance in the database for models that have been
16+
registered. There are two key commands to run when deploying:
17+
18+
```python manage.py migrate
19+
python manage.py createinitialrevisions
20+
```
21+
22+
To delete the recorded history for a particular model:
23+
24+
```bash
25+
python manage.py deleterevisions <appname.modelname> --keep=[int] --days=[int]
26+
```
27+
28+
This will keep anything from last *n* `days` or `keep` at least *n* history
29+
items.
30+
31+
# Custom Commands
32+
33+
## createlicences
34+
This command expects the file `data/main/licenes.json` and folder
35+
`data/main/licence_legal_code` containing the licence text for your licences.
36+
The `licences.json` file should follow the format below:
37+
38+
```json
39+
{
40+
"licences": [
41+
{
42+
"short_name": "CC0",
43+
"long_name": "CC0 (Public domain)",
44+
"legal_code": {
45+
"file": true,
46+
"value": "CC0.txt"
47+
},
48+
"logo": "cc-zero.svg",
49+
"link": "https://creativecommons.org/publicdomain/zero/1.0/",
50+
"version": "1.0"
51+
},
52+
{
53+
"short_name": "Other - See Data Usage Guidelines",
54+
"long_name": "Other - See Data Usage Guidelines",
55+
"legal_code": {
56+
"file": false,
57+
"value": "See Data Usage Guidelines"
58+
},
59+
"logo": "",
60+
"link": "",
61+
"version": "1.0"
62+
}
63+
]
64+
}
65+
```
66+
67+
This file specifies a list of licences to create/update. This command has no
68+
arguments. Existing licences matching `short_name` in the json file will be
69+
updated.
70+
71+
72+
## createreferences
73+
This command expects the file `data/genome/reference_genomes.json` The
74+
`reference_genomes.json` file should follow the format below:
75+
76+
```json
77+
[
78+
{
79+
"assembly_identifier": {
80+
"dbname": "GenomeAssembly",
81+
"dbversion": null,
82+
"identifier": "GCF_000001405.10",
83+
"url": "http://www.ncbi.nlm.nih.gov/assembly/GCF_000001405.10"
84+
},
85+
"short_name": "hg16",
86+
"organism_name": "Homo sapiens"
87+
},
88+
{
89+
"assembly_identifier": null,
90+
"short_name": "Synthetic",
91+
"organism_name": "Synthetic sequence"
92+
}
93+
]
94+
```
95+
96+
This file specifies a list of reference genomes to create/update. This command
97+
has no arguments. Only entries with a `short_name` that does not exist will be
98+
created. Existing instances will not be updated since other models rely on the
99+
`ReferenceGenome` table.
100+
101+
## savereferences
102+
This command will serialize the `ReferenceGenome` models into
103+
`data/genome/reference_genomes.json`. It will overwrite any existing file. This
104+
command accepts no arguments.
105+
106+
## updatesiteinfo
107+
Invoke this command to updat the `SiteInformation` singleton row. It expects
108+
the file `data/main/site_info.json` to exist with the following format:
109+
110+
```json
111+
{
112+
"branch": "",
113+
"md_about": "about.md",
114+
"md_citation": "",
115+
"md_documentation": "userdocs.md",
116+
"md_privacy": "",
117+
"md_terms": "",
118+
"md_usage_guide": "",
119+
"version": "1.6.3-beta"
120+
}
121+
```
122+
123+
You can specify markdown files on fields with the `md_` prefix (must be saved
124+
in the same directory as the JSON file) to set as the field text. This command
125+
accepts no arguments.
126+
127+
## savesiteinfo
128+
This command will serialize the `SiteInformation` singleton into
129+
`data/main/site_info.json`. It will overwrite any existing file. This command
130+
accepts no arguments.
131+
132+
## geterror
133+
This command displays a detailed celery error for a given `task_id` and `username`.
134+
The `username` specifies the submitting user's ORCID. This command must be
135+
invoked as:
136+
137+
```shell script
138+
python manage.py geterror --task_id=<task-uuid> --username=<ORCID>
139+
```
140+
141+
## renamegroups
142+
This command renames the contributor groups for all `ScoreSets`, `ExperimentSets`
143+
and `Experiments`. It was used to correct a naming bug in production so it should
144+
not be necessary to run this again. This command accepts no arguments.
145+
146+
## renumber
147+
This command renumbers the `Variants` in a `ScoreSet` starting from 1. It was
148+
used to correct a numbering bug in production so it should not be necessary to
149+
run this again. This command must be invoked as:
150+
151+
```shell script
152+
python manage.py renumber --urns=<space separated urns> --all
153+
```
154+
155+
Specify a list of space-separated urns to correct, or alternatively set the
156+
boolean flag `--all` to correct all `ScoreSets`.
157+
158+
## savesitestats
159+
Export a gzipped tarball containing site page view statistics. Specify an
160+
absolute save path with the `--path` argument.
161+
162+
## setprivate
163+
Set a `ScoreSet`, `Experiment` or `ExperimentSet` as private. It is recommended
164+
that it is used only on `ScoreSet` models. Settings parent models as private
165+
will not alter child models. This could create strange behaviour such as not
166+
being able to view the parent of a public child. Invoke the command as:
167+
168+
```shell script
169+
python manage.py setprivate --urn=<model-urn>
170+
```
171+
172+
## setstate
173+
Set a the celery state of a `ScoreSet`. Invoke the command as:
174+
175+
```shell script
176+
python manage.py setprivate --urn=<model-urn> --state=<state text>
177+
```
178+
179+
The `state` argument will accept the values `processing`, `failed` or `success`.
180+
181+
## createnews
182+
Create a news item for the landing page. Invoke the command as:
183+
184+
```shell script
185+
python manage.py createnews --message=<string message> --level=<string level>
186+
```
187+
188+
The `message` argument can specify a string message or a markdown file. The
189+
`level` argument can take the values `Critical`, `Important`, `Information`,
190+
`Happy holidays` or `April fools`.
191+
192+
## createtestentries
193+
For development purposes to seed the database with test entries. Also creates
194+
test users with the password `1234qwer` and username `user-<number>` where
195+
number ranges from 1 to 40.
196+
197+
## createdefaultsecrets
198+
Creates a default secrets json file. Used by settings module to create a secrets
199+
file if one does not exist. This should not be called directly.
200+
201+
## cleanusers
202+
Deletes accounts with malicious looking usernames. Pass `--commit` to commit changes, otherwise
203+
it is run in dry mode and will only list accounts that will be deleted. Pass a list of comma separated
204+
usernames via `--exclude` to ignore these associated accounts.

0 commit comments

Comments
 (0)