Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version of SweFreq with PostgreSQL #557

Merged
merged 390 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
390 commits
Select commit Hold shift + click to select a range
e6b3cd5
fix slight error
talavis Jan 28, 2019
7d73335
more tests added, complete coverage in lookups; also some fixes due t…
talavis Jan 29, 2019
e4841f3
More tests for utils, including some fixing in utils
talavis Jan 29, 2019
309bcdb
incorrect indentation of a return statement
talavis Jan 30, 2019
2325da3
100% coverage, all passing in utils
talavis Jan 30, 2019
b14ba70
pylint fixes in lookups
talavis Jan 31, 2019
cc2fe67
pylint fixes in utils
talavis Jan 31, 2019
baaf982
type hints added
talavis Jan 31, 2019
3c0f904
migrate the download function
talavis Feb 1, 2019
6dbccd4
some fixes for tests, documentation additions
talavis Feb 1, 2019
400bc17
Api routes updated to support dataset version as well.
talavis Feb 4, 2019
7bc68c2
updated get_gene_by_name for new schema
talavis Feb 8, 2019
c3ae8e4
should fix get_variants_in_gene for new db schema
talavis Feb 8, 2019
40ffcf1
should fix get_variants_in_transcripts for new db schema, also some o…
talavis Feb 8, 2019
2d7c4f5
a couple of small fixes
talavis Feb 11, 2019
c407e9f
remove when db is fixed
talavis Feb 12, 2019
e9faf47
adding genes and transcripts to variants after db schema update
talavis Feb 12, 2019
e48d54c
seems to work with new db schema, but speed is not optimal
talavis Feb 13, 2019
19f1698
decreased logging
talavis Feb 13, 2019
85644cb
rsid fixing; they can't be '.' with new db
talavis Feb 13, 2019
428b12e
converting tests to chromosome 22
talavis Feb 13, 2019
314eb20
fix for finding other names; return the db.Gene part
talavis Feb 13, 2019
dccc240
handling a few cases of missing data observed during testing
talavis Feb 13, 2019
887baed
fix incorrect naming of returned genes/transcripts
talavis Feb 13, 2019
f833739
further migration of test to chromosome 22
talavis Feb 13, 2019
862f0c8
lookups updated for testing only chr22
talavis Feb 19, 2019
667a8a5
pgsql updated for testing only chr22
talavis Feb 19, 2019
133b6d6
utils updated to test chr 22
talavis Feb 19, 2019
816f842
rsid != '.' in postgres
talavis Feb 19, 2019
9a9e518
increased coverage
talavis Feb 19, 2019
aeef795
no longer needs json
talavis Feb 19, 2019
ecec24c
pylint fixes
talavis Feb 19, 2019
0d202c2
pylint fixes for tests
talavis Feb 19, 2019
8d9a45e
start of api testing for the handlers using requests
talavis Feb 21, 2019
3c0f695
skeleton for all tests, initial test for region and transcript
talavis Feb 21, 2019
cf3b5f4
added version to browser requests in frontend
talavis Feb 22, 2019
2fefda8
updated tests with version
talavis Feb 22, 2019
b19a54c
fix for exception due to rsid not in db
talavis Feb 22, 2019
19102cd
functions in alphabetical order; variant call using version as well
talavis Feb 22, 2019
efa91e5
updated coveragerc
talavis Feb 22, 2019
185b127
function parameter type hints added
talavis Feb 22, 2019
36f16dc
updates to test to limit everything to chromosome 21 and 22
talavis Feb 22, 2019
2c66d71
removed double /
talavis Feb 22, 2019
883406f
give search support for versions
talavis Feb 22, 2019
1d532e5
id is implicit
talavis Feb 22, 2019
d659d9a
increase coverage of tests
talavis Feb 22, 2019
89ca276
remove add_rsid_to_variant() for now to avoid giving incorrect rsids
talavis Feb 25, 2019
3a740ff
remove add_rsid_to_variant tests
talavis Feb 26, 2019
5c4e4fe
correct port
talavis Feb 27, 2019
8c9ef5f
no reason to keep the mongo settings
talavis Feb 27, 2019
09dce46
remove number_of_variants_in_transcript
talavis Feb 27, 2019
c3fac57
variant counting added to variant list
talavis Feb 27, 2019
4ab495b
remove number of variants from gene part
talavis Feb 28, 2019
efc1a32
dynamic update of the number of variants; now corresponds to the numb…
talavis Feb 28, 2019
89ec9b6
remove id and database_version from the variant objects sent to frontend
talavis Feb 28, 2019
795820f
variant text under buttons
talavis Feb 28, 2019
0225fdf
renamed pgsql.py to psql.py
talavis Feb 28, 2019
18a925e
also change references to pgsql
talavis Feb 28, 2019
8283309
use the correct db fields
talavis Mar 2, 2019
85fde55
check whether region is within the size limit
talavis Mar 4, 2019
5c06f18
move the check to a better place
talavis Mar 4, 2019
7600608
enforce region size limits
talavis Mar 4, 2019
9f35848
add message along with http code 413
talavis Mar 4, 2019
e464b7e
413 -> 400
talavis Mar 4, 2019
1152a86
must use utils. now
talavis Mar 4, 2019
4869640
definition of EXON_PADDING forgotten
talavis Mar 4, 2019
da45edf
error messages for failed loading of region, coverage, and variants i…
talavis Mar 4, 2019
66dd850
bugfixes; variant list and coverage error message no longer connected…
talavis Mar 4, 2019
5762f44
coverage not working, but rest seems to work fine
talavis Mar 4, 2019
50e6c2d
coverage seems to work; removed forgotten .data. in gene and transcript
talavis Mar 4, 2019
c33ece0
return 404 if no coverage is found
talavis Mar 5, 2019
f8bf278
move psql test to lookups and utils
talavis Mar 5, 2019
64c5ad7
pgsql. -> utils/lookups
talavis Mar 6, 2019
aa38bb2
indentation change
talavis Mar 6, 2019
bb2a205
updated coveragerc; ignore e.g. __init__.py
talavis Mar 6, 2019
501cc55
run_pytest.sh not needed
talavis Mar 6, 2019
487f35b
a bit of formatting fixes for sphinx, also some pylint fixes
talavis Mar 6, 2019
ed6f52a
add db_version fixes from develop as a new commit
talavis Mar 6, 2019
2caecb1
fix autocomplete lookup
talavis Mar 6, 2019
3d301c0
make get_coverage() handle some bad formatting
talavis Mar 6, 2019
407797f
coveragerc tweaking
talavis Mar 6, 2019
423d1ed
100% coverage
talavis Mar 6, 2019
b27bdc3
match identification of genes in region to the way it was done in mongo
talavis Mar 6, 2019
dfcec2e
improved testcases for regions, increased coverage
talavis Mar 6, 2019
51be3f6
send reason instead of set a cookie when returning error code for bad…
talavis Mar 6, 2019
3cdb0a1
increased coverage
talavis Mar 6, 2019
5229fc2
change default sorting to position
talavis Mar 6, 2019
a9db88c
beacon working, but ignoring reference
talavis Mar 6, 2019
77d05ee
remove whitespace
talavis Mar 6, 2019
f0394b6
only set hom_count to 0 if there is no value
talavis Mar 7, 2019
9589c2a
only look at vep specific to gene/transcript if it is known, otherwis…
talavis Mar 7, 2019
ec280af
no need to use utils. inside utils
talavis Mar 7, 2019
74ebd3b
another attempt to sort out the vep annotations
talavis Mar 7, 2019
7e7c689
make sure transcripts also work
talavis Mar 7, 2019
919f9bb
renamed function and variable names to get reference set information
talavis Mar 8, 2019
00fa7e0
lookups updated for the new database schema
talavis Mar 21, 2019
33a6fe4
remove mongodb again; failed during branch rebuild
talavis Mar 21, 2019
10b20c0
make sure ds_version is used
talavis Mar 21, 2019
94c4029
pylint fixes, remove unused functions
talavis Mar 21, 2019
82f405b
add browser tests to travis
talavis Mar 21, 2019
9047cc9
use pytest-cov, skip verbose output
talavis Mar 21, 2019
07ed969
fixed test without assertion
talavis Mar 21, 2019
3cd211b
last coverage insert did not use execute()
talavis Mar 21, 2019
e8c7f66
update browser_handlers to new testset
talavis Mar 22, 2019
52ead8d
lookup tests updated for new dataset
talavis Mar 22, 2019
b209115
utils tests updated for new dataset
talavis Mar 22, 2019
4fefa78
browser test data added
talavis Mar 22, 2019
94954c6
add browser data during testing
talavis Mar 22, 2019
275b477
increase coverage
talavis Mar 22, 2019
dc7f872
pylint fixes
talavis Mar 22, 2019
d370ce5
Merge pull request #523 from NBISweden/feature/postgres-database
Mar 22, 2019
6e5af35
three more indexes to improve query speeds
talavis Mar 25, 2019
58f7bbf
removal of unwanted whitespace
talavis Mar 26, 2019
b757da6
Change callCount to look at chromosome
MalinAhlberg Mar 27, 2019
bba5cfe
do not change region size on start==end
talavis Mar 27, 2019
9bc6afd
remove ability to not define the entire region; avoid exceptions
talavis Mar 27, 2019
94a8dc0
support for beacon-style dataset/refset:dataset:version/
talavis Mar 27, 2019
cf421b1
simple variant error message
talavis Mar 26, 2019
a850f39
Merge pull request #530 from NBISweden/feature_callcount
Mar 27, 2019
5fb12c9
remove scary red signs
talavis Mar 27, 2019
3a5c6cc
use the correct error source
talavis Mar 27, 2019
f6dcd37
rephrasing of error message
talavis Mar 27, 2019
7dd67ca
avoid exception due to bad transcript
talavis Mar 27, 2019
2443ae4
test improvement; increase coverage, handle different order of results
talavis Mar 29, 2019
3ca7d53
update dev setup instructions
talavis Mar 29, 2019
e9e0b07
pymongo is no longer needed
talavis Mar 29, 2019
7f54083
remove mongo from settings_sample.json
talavis Mar 29, 2019
781c22e
pymongo is not used in beacon anymore
talavis Mar 29, 2019
7ad4d35
Remove unneeded .dicts()
talavis Mar 29, 2019
b72c7f6
variant is visible in URL, no reason to show it on bad load
talavis Apr 1, 2019
52b74c1
make sure location{} is rendered as a code block by sphinx
talavis Apr 1, 2019
eb57294
use variants.loaded to tell if the loading is done
talavis Apr 1, 2019
9eb7b2e
make a strict comparison
talavis Apr 1, 2019
c65622b
remove whitespace
talavis Apr 1, 2019
61e8234
updated db docstrings
talavis Apr 1, 2019
61c7be5
move dataset beacon-style parsing to its own function
talavis Apr 1, 2019
421c279
check if dataset is in beacon style for each dataset request
talavis Apr 1, 2019
40b10cf
refactor ifs for rsid
talavis Apr 1, 2019
827109d
population frequencies added to variant view for other datasets with …
talavis Apr 1, 2019
cab3370
move parse_dataset to utils, return a tuple of (dataset, version)
talavis Apr 1, 2019
1e9f52d
tests for parse_dataset
talavis Apr 1, 2019
5167214
avoid getting rsNone as rsid
talavis Apr 2, 2019
bee90bd
avoid implying that a variant is not available in dbSNP because it ha…
talavis Apr 2, 2019
8874f2b
Merge pull request #528 from NBISweden/feature/browser-postgres
viklund Apr 2, 2019
96991f7
change /api/datasets/ to /api/dataset
talavis Mar 29, 2019
9ade8a7
update tests with /api/dataset change
talavis Mar 29, 2019
a0445f1
initial docs setup
talavis Mar 28, 2019
417aa01
structure updates
talavis Mar 29, 2019
9411b7f
adding a bit of markdown
talavis Mar 29, 2019
af965c7
structure updates
talavis Mar 29, 2019
b81ba73
Merge pull request #531 from NBISweden/feature/api-dataset
viklund Apr 4, 2019
22a0bfd
Merge pull request #532 from NBISweden/feature/sphinx
viklund Apr 4, 2019
781dda6
Merge pull request #529 from NBISweden/performance/new-indexes
viklund Apr 9, 2019
cb75ca7
limit downloads to what is shown
talavis Apr 11, 2019
a2ed387
support filtering info in url for download
talavis Apr 11, 2019
81ec01e
add fake variant with LoF
talavis Apr 11, 2019
f39f3c8
look for any LoF in flags
talavis Apr 11, 2019
c5ca6d2
use high confidence LoF
talavis Apr 11, 2019
08c2585
tests and fixes for downloading what is shown
talavis Apr 11, 2019
c18c1da
remove contact person from route.py
talavis Apr 12, 2019
7f44929
Merge pull request #533 from NBISweden/feature/download-specific
viklund Apr 15, 2019
51ea3f5
Merge pull request #534 from NBISweden/feature/contact-to-settings
viklund Apr 15, 2019
6d68598
Boost all third-party packages except peewee to latest version
talavis Apr 15, 2019
699d29f
Add target="_self" to make export as CSV link work as expected
talavis Apr 15, 2019
bbac4c0
Merge pull request #535 from NBISweden/bugfix/fix-dl-as-csv
viklund Apr 15, 2019
662917a
move paranthesis to make the correct comparison
talavis Apr 15, 2019
1c3de8e
Merge pull request #536 from NBISweden/bugfix/lof-filtering
viklund Apr 15, 2019
37de606
draft for updated readme
talavis Apr 15, 2019
908e76e
Change header from population to dataset
talavis Apr 16, 2019
97b3a2c
Merge pull request #537 from NBISweden/feature/population-header
viklund Apr 16, 2019
593b1f6
a bit of rewording
talavis Apr 16, 2019
5fff94f
set travis to test Python 3.6 instead of 3.5
talavis Apr 16, 2019
2d711c2
Merge pull request #540 from NBISweden/feature/boost-versions
viklund Apr 16, 2019
7b1091c
fix numbering, add a bit more about venv
talavis Apr 16, 2019
fb7a50a
fix docstrings as required by pydocstyle
talavis Apr 17, 2019
8df9b29
add portal/downlad/beacon availability columns
talavis Apr 17, 2019
d4171d1
update test data for new schema
talavis Apr 17, 2019
5759189
fix error in index name
talavis Apr 17, 2019
4f54193
Merge pull request #538 from NBISweden/feature/updated-readme
viklund Apr 17, 2019
41894a0
Merge pull request #542 from NBISweden/feature/schema-access
viklund Apr 17, 2019
ea00518
Merge pull request #543 from NBISweden/feature/prettier-docstrings
viklund Apr 17, 2019
9ef17f6
Update db.py with new columns for access.
talavis Apr 17, 2019
ce9294d
add file_access check to has_access()
talavis Apr 18, 2019
6f02a5d
change file_access in load_dummy_data to Controlled to maintain earli…
talavis Apr 18, 2019
4f2c6e2
dataset is a Dataset object, not a string
talavis Apr 18, 2019
f7f4cce
rename version to ds_version
talavis Apr 18, 2019
bf96126
add support for version
talavis Apr 18, 2019
cc2eeed
version is called versions for the base routes; collection needs vers…
talavis Apr 18, 2019
5a0fb9e
collection needs version
talavis Apr 18, 2019
9386779
support version check for authhandler
talavis Apr 18, 2019
efd5c8b
not a variable name
talavis Apr 18, 2019
8c79abc
better to receive string then Database object
talavis Apr 18, 2019
4c84632
change back from string to database
talavis Apr 18, 2019
599f62e
seems to fix dl permissions
talavis Apr 18, 2019
5e9beac
include version in dataset has_access check
talavis Apr 18, 2019
edb38bd
return after send_error
talavis Apr 18, 2019
ff7e108
add version check to file handler
talavis Apr 23, 2019
65aad54
Error handling for missing file.
talavis Apr 23, 2019
fc805d7
send_error should be self.send_error
talavis Apr 23, 2019
a180c46
dataset_version check should be made by has_access, not has_requested…
talavis Apr 23, 2019
4d4fbbf
sort returned versions by name (in reverse)
talavis Apr 23, 2019
362efef
do not trim variants
talavis Apr 16, 2019
e45f6d8
orig_alt_alleles must have the same style as the main ref and alt, ot…
talavis Apr 24, 2019
ca1b80b
list comprehension not needed
talavis Apr 24, 2019
ab6950c
version is needed to function, so no point having it optional
talavis Apr 24, 2019
3d02a9a
Merge pull request #544 from NBISweden/feature/registered-access
viklund Apr 24, 2019
88f56b6
Update urllib3 to 1.24.2
talavis Apr 19, 2019
ee3d866
1.25.0 released
talavis Apr 23, 2019
e3a5a28
Merge pull request #545 from NBISweden/security/update-urllib3
viklund Apr 24, 2019
4bf48e7
Merge pull request #546 from NBISweden/feature/dont-trim-variants
MalinAhlberg Apr 24, 2019
f49bd67
Update beacon schema: make counts_table a table
MalinAhlberg Apr 16, 2019
105fb60
Add counting of calls to import script
MalinAhlberg Apr 16, 2019
2049534
Remove non-usefull groupby from beacon schemas
MalinAhlberg Apr 17, 2019
d0ba958
Beacon indices
MalinAhlberg Apr 17, 2019
59a3dbe
Stop using materialized view for beacon data table
MalinAhlberg Apr 17, 2019
770f7f4
Count calls using less memory
MalinAhlberg Apr 17, 2019
f349b01
Simplify callcounting code
MalinAhlberg Apr 24, 2019
47ac72e
Fix typo
MalinAhlberg Apr 24, 2019
b7e189c
Remove ref index
MalinAhlberg Apr 24, 2019
17f94d1
Warn for bad variant order
MalinAhlberg Apr 24, 2019
fd6b66a
Improve log messages and warnings for callcounting
MalinAhlberg Apr 25, 2019
096c549
Remove duplicate definitions from beacon schema
MalinAhlberg Apr 25, 2019
abf7853
Use "create or replace" for beacon sql
MalinAhlberg Apr 25, 2019
9072394
access_level is now uppercase; None becomes PRIVATE
talavis Apr 25, 2019
3395599
Merge pull request #541 from NBISweden/feature/compute_callcount
talavis Apr 25, 2019
28dea19
Get accesslevel from datasets
MalinAhlberg Apr 3, 2019
c55c7f3
Use beacon_access in beacon_dataset_table
MalinAhlberg Apr 25, 2019
b8ddbd0
Show all available dataset versions in beacon
MalinAhlberg Apr 25, 2019
bec96e2
Use view to filter out beacon datasets
MalinAhlberg Apr 25, 2019
a662559
Merge pull request #548 from NBISweden/feature/access_level
talavis Apr 25, 2019
65d0d26
Merge pull request #547 from NBISweden/feature/sql-enum-upper
talavis Apr 25, 2019
940c0ee
Remove var_call_ref from database.
talavis Apr 25, 2019
f716868
Merge pull request #549 from NBISweden/feature/drop-var-call-ref
viklund Apr 25, 2019
cc485c7
Change beacon to use the elixir beacon instead of the simple internal…
talavis Apr 25, 2019
0d2c571
remove beacon
talavis Apr 26, 2019
2518ccb
do not import beacon
talavis Apr 26, 2019
3b898de
remove debugging message
talavis Apr 29, 2019
83d1240
Add empty category and flags field in case of empty VEP.
talavis Apr 29, 2019
a834839
Merge pull request #551 from NBISweden/bugfix/vep
viklund Apr 29, 2019
7ef2c91
Merge pull request #550 from NBISweden/feature/beacon-requests
viklund Apr 29, 2019
de997c5
Make beacon searches specific to dataset and remove reference selecti…
talavis Apr 30, 2019
7a2d9d1
Add example to beacon page
talavis Apr 30, 2019
898219c
Merge pull request #552 from NBISweden/feature/beacon-requests
norling May 2, 2019
c0a2c6b
prevent position from being < 0
talavis May 2, 2019
e94a615
Merge pull request #553 from NBISweden/bugfix/beacon-fin
talavis May 2, 2019
51dad58
Update the sFTP password generator to use the digest function of Post…
talavis May 7, 2019
a556670
Remove sFTP tab from admin for dataset as it's not working.
talavis May 7, 2019
07cea86
Merge pull request #554 from NBISweden/feature/sftp-fixing
norling May 7, 2019
ddd6572
Better region parsing.
talavis May 8, 2019
ff7db7f
Merge pull request #556 from NBISweden/feature/range-only-start
viklund May 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[run]
omit = /usr/local/*,/home/travis/virtualenv/*
omit = /usr/local/*,/home/travis/virtualenv/*,*venv*

[report]
omit = /usr/local/*,/home/travis/virtualenv/*
omit = */__init__.py, */test.py, */test_*.py
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ tornado/static/js/app.min.js
backend/static
backend/templates
static
# importer and config stuff
mysql-data*
scripts/importer/downloaded_files
# docker stuff
postgres-data
# local personal things
personal
# travis test remnants
master-schema.sql
settings.json.tmp
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
language: python
python:
- "3.5"
- "3.6"
services:
- docker
before_install:
- test/travis_before_install.sh
install:
- pip install -r backend/requirements.txt
- pip install -r test/requirements.txt
- pip install coverage coveralls
script:
- test/travis_script.sh
addons:
postgresql: "10"
apt:
packages:
- postgresql-client-10
9 changes: 5 additions & 4 deletions Dockerfile-backend
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM ubuntu:16.04
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
libmysqlclient-dev
python3-pip

ADD . /code
COPY settings_sample.json /settings.json
RUN sed -i 's/"postgresHost"\s*:.*,/"postgresHost" : "db",/' /settings.json
WORKDIR /code

RUN pip3 install -r backend/requirements.txt

CMD ["python3", "backend/route.py", "--develop"]
CMD ["python3", "backend/route.py", "--develop", "--settings_file", "/settings.json"]
6 changes: 6 additions & 0 deletions Dockerfile-database
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM postgres:10

ENV POSTGRES_DB swefreq
COPY sql/data_schema.sql /docker-entrypoint-initdb.d/01_data_schema.sql
COPY sql/user_schema.sql /docker-entrypoint-initdb.d/02_user_schema.sql
COPY sql/beacon_schema.sql /docker-entrypoint-initdb.d/03_beacon_schema.sql
10 changes: 5 additions & 5 deletions Dockerfile-frontend-rebuilder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:18.04

RUN apt-get update && \
apt-get install -y \
Expand All @@ -7,12 +7,12 @@ RUN apt-get update && \
python3 \
python3-pip \
python3-pyinotify \
inotify-tools \
libmysqlclient-dev && \
inotify-tools && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 5

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
apt-get install -y nodejs
RUN apt-get install -y \
nodejs \
npm

ADD . /code
WORKDIR /code
Expand Down
92 changes: 46 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,76 @@ SweFreq - Swedish Frequency database
Running on a production system
------------------------------

The application has only been tested with python 3.5.2. It will most likely work with at least other 3.5 versions.
The application is targeted at python 3.6. It will most likely work with later versions as well.

`virtualenv` is not a requirement but it will help you to install the application.
`venv` is not a requirement but it will help you to install the application.

1. Download the repository from [github](https://github.com/NBISweden/swefreq)

2. Credentials

2.1 Make sure you have registered an Elixir AAI application with the Elixir.

2.2 (legacy) Create Google OAuth 2.0 credentials with the [Google API
Console](https://console.developers.google.com/) for enabling
authentication.
2. Make sure you have registered an Elixir AAI application with the Elixir.

3. Rename the file `settings_sample.json` into `settings.json` and edit all
the values.

4. Install MySQL. Only tested with 5.6. Note, the schema is incompatible with the
latest version of MariaDB.
4. If you have `venv` and `pip` available you can do the following
to install the required Python packages:

```
python -m venv venv-folder
source /path/to/venv-folder/bin/activate # activate your virtual environment
pip install -r /path/to/requrements.txt # install the required Python packages
```

5. If you have `virtualenv` and `pip` installed then you can do the following
to install the required Python packages. Locate the `requirements.txt` file
in the `swefreq` repository.
* backend: `backend/requirements.txt`
* importer: `scripts/importer/requirements.txt`
* documentation: `docs/requirements.txt`

source /path/to/bin/activate # activate your virtualenv
pip install -r /path/to/requrements.txt # install the required Python packages

6. Create the MySQL database, user and tables with the following command:
5. Create the PostgreSQL database and its tables with the following command:

mysql -u root -p < ./sql/swefreq.sql
```
psql -U postgres -h 127.0.0.1 -f sql/data_schema.sql
psql -U postgres -h 127.0.0.1 -f sql/user_schema.sql
```

To experience the full site you need to manually add a dataset and a user
to the database. Log into the mysql console and enter something like the
following, change the values to whatever fits your site (N.B.
`[email protected]` is your google id):
To experience the full site you need to manually add a dataset and a user to the database.
You can use the test data in `test/data/browser_test_data.sql` as reference.

USE swefreq;
INSERT INTO dataset (dataset_pk, name) VALUES (1, "Dataset");
INSERT INTO user (user_pk,name, email) VALUES (1, "test", "[email protected]");
INSERT INTO dataset_access (dataset_pk, user_pk, is_admin, has_access) VALUES (1,1,1,1);
6. Add reference data and variants using the import scripts found in `scripts/`, e.g.:

```
./manage.sh import --add_reference \
--gencode_version 19 \
--ensembl_version homo_sapiens_core_75_37 \
--assembly_id GRCh37p13 \
--dbnsfp_version 2.9.3 \
--ref_name GRCh37p13

./manage.sh import --add_raw_data \
--dataset variant_data \
--version 20190415 \
--variant_file variants/chr22.vcf.gz \
--coverage_file coverage/chr22.coverage.txt.gz
```

### Start the server

source /path/to/bin/activate # activate your virtualenv
```
source /path/to/bin/activate # activate your virtual environment
python /path/to/route.py

```

Quick development mode
----------------------

1. Install docker (and docker-compose in case it's not included in the installation)
2. Create test database

1. Initiate a mysql data volume by running `./scripts/create_docker_db_volume_tarball.sh` or
`./scripts/download_and_create_docker_db_volume.sh`

2. Load mysql dummy data by running `./scripts/load_mysql_dummy_data.sh`

3. Copy `settings_sample.json` into `settings.json` and
- Update the credentials for elixir and google oauth.
- Elixir/redirectUri: http://localhost:4000/elixir/login
- redirectUri: http://localhost:4000/login
- Set `mysqlHost` to `db`
- Set `mysqlSchema` to `swefreq_test`
- Clear `mysqlPasswd` (set it to empty `""`)
4. Make a symbolic link from `backend/static` to `static`.
5. Run the server:
1. Install docker (and docker-compose in case it's not included in the installation)
2. Run the server:
```bash
docker-compose up
```
3. Add test data to db:
```bash
$ docker-compose up
psql -h localhost -U postgres swefreq -f test/data/browser_test_data.sql
```

[travis-badge]: https://travis-ci.org/NBISweden/swefreq.svg?branch=develop
Expand Down
Loading