Skip to content

Commit

Permalink
Merge pull request #64 from mobidic/dev
Browse files Browse the repository at this point in the history
Merge for v1.1.8
  • Loading branch information
Char-Al authored Nov 8, 2023
2 parents 69e18b8 + 01661b7 commit 2626b0a
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 107 deletions.
10 changes: 5 additions & 5 deletions seal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# (c) 2023, Charles VAN GOETHEM <c-vangoethem (at) chu-montpellier (dot) fr>
#
# This file is part of SEAL
#
#
# SEAL db - Simple, Efficient And Lite database for NGS
# Copyright (C) 2023 Charles VAN GOETHEM - MoBiDiC - CHU Montpellier
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand Down Expand Up @@ -71,7 +71,7 @@ def before_request():
session.permanent = True
session.modified = True
g.user = current_user
if app.config["MAINTENANCE"] and request.path != url_for('maintenance'):
if app.config["MAINTENANCE"] and request.path != url_for('maintenance'):
return redirect(url_for('maintenance'))


Expand Down
10 changes: 5 additions & 5 deletions seal/admin.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# (c) 2023, Charles VAN GOETHEM <c-vangoethem (at) chu-montpellier (dot) fr>
#
# This file is part of SEAL
#
#
# SEAL db - Simple, Efficient And Lite database for NGS
# Copyright (C) 2023 Charles VAN GOETHEM - MoBiDiC - CHU Montpellier
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand Down Expand Up @@ -282,7 +282,7 @@ def validate_form(self, form):
column_editable_list = ['username', 'mail', 'filter', 'api_key_md',
'logged', 'admin', 'bioinfo', 'technician',
'biologist', 'sidebar'],
form_excluded_columns = ['comments_variants', 'comments_samples',
form_excluded_columns = ['comments_variants', 'comments_samples',
'historics', 'transcripts']
)
)
Expand Down
2 changes: 1 addition & 1 deletion seal/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FLASK:
SQLALCHEMY_TRACK_MODIFICATIONS: true
SCHEDULER_API_ENABLED: true
SCHEDULER_TIMEZONE: 'Europe/Paris'
SCHEDULER_JOB_DEFAULTS:
SCHEDULER_JOB_DEFAULTS:
coalesce: false
max_instances: 1
MAINTENANCE: false # Set to true or false
Expand Down
8 changes: 4 additions & 4 deletions seal/forms.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# (c) 2023, Charles VAN GOETHEM <c-vangoethem (at) chu-montpellier (dot) fr>
#
# This file is part of SEAL
#
#
# SEAL db - Simple, Efficient And Lite database for NGS
# Copyright (C) 2023 Charles VAN GOETHEM - MoBiDiC - CHU Montpellier
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand Down
10 changes: 5 additions & 5 deletions seal/models.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# (c) 2023, Charles VAN GOETHEM <c-vangoethem (at) chu-montpellier (dot) fr>
#
# This file is part of SEAL
#
#
# SEAL db - Simple, Efficient And Lite database for NGS
# Copyright (C) 2023 Charles VAN GOETHEM - MoBiDiC - CHU Montpellier
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand Down Expand Up @@ -313,7 +313,7 @@ def __str__(self):

def inBed(self):
if self.sample.bed:
return self.sample.bed.varInBed(self.variant)
return self.sample.bed.varInBed(self.variant)
else:
return True

Expand Down
83 changes: 41 additions & 42 deletions seal/routes.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# (c) 2023, Charles VAN GOETHEM <c-vangoethem (at) chu-montpellier (dot) fr>
#
# This file is part of SEAL
#
#
# SEAL db - Simple, Efficient And Lite database for NGS
# Copyright (C) 2023 Charles VAN GOETHEM - MoBiDiC - CHU Montpellier
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand Down Expand Up @@ -224,8 +224,7 @@ def handle_csrf_error(e):
"""
flash(f"{e.name} : {e.description} Please Retry.", 'warning')

next_page = request.args.get('next')
return redirect_dest(next_page)
return redirect_dest()


@app.errorhandler(400)
Expand Down Expand Up @@ -517,7 +516,7 @@ def account():
"""
update_account_form = UpdateAccountForm()
update_password_form = UpdatePasswordForm()
if ("submit_update" in request.form
if ("submit_update" in request.form
and update_account_form.validate_on_submit()):
if update_account_form.image_file.data:
picture_file = save_picture(update_account_form.image_file.data)
Expand All @@ -529,15 +528,15 @@ def account():
current_user.mail = None

if update_account_form.api_key_md.data != '':
current_user.api_key_md = update_account_form.api_key_md.data
current_user.api_key_md = update_account_form.api_key_md.data
else:
current_user.api_key_md = None

current_user.username = update_account_form.username.data
db.session.commit()

flash('Your account has been updated!', 'success')
elif ("submit_password" in request.form
elif ("submit_password" in request.form
and update_password_form.validate_on_submit()):
pwd = update_password_form.new_password.data
current_user.password = bcrypt.generate_password_hash(pwd).decode('utf-8')
Expand Down Expand Up @@ -571,7 +570,7 @@ def first_connexion():
next_page = request.args.get('next')
if current_user.logged:
return redirect_dest()
if ("submit_password" in request.form
if ("submit_password" in request.form
and update_password_form.validate_on_submit()):
pwd = update_password_form.new_password.data
current_user.password = bcrypt.generate_password_hash(pwd).decode('utf-8')
Expand Down Expand Up @@ -898,7 +897,7 @@ def json_samples():
samples = Sample.query
if not current_user.admin:
filter_samples_teams = or_(
Sample.teams.any(Team.id.in_([t.id for t in current_user.teams])),
Sample.teams.any(Team.id.in_([t.id for t in current_user.teams])),
Sample.teams == None
)
samples = samples.filter(filter_samples_teams)
Expand Down Expand Up @@ -1223,7 +1222,7 @@ def json_transcripts():
- gene: the gene name.
- source: the source of the feature.
- protein: the protein product of the transcript.
- canonical: a flag indicating whether this transcript is the
- canonical: a flag indicating whether this transcript is the
canonical transcript of its gene.
- hgnc: the HGNC identifier for the gene.
- val: a boolean indicating whether the current user has this
Expand Down Expand Up @@ -1491,7 +1490,7 @@ def json_variant(id, version=-1, sample=None):
current_family = False
current = False
if v2s.sample.status >= 1:
if (sample and v2s.sample.familyid == sample.familyid
if (sample and v2s.sample.familyid == sample.familyid
and sample.familyid is not None):
current_family = True
if sample and v2s.sample.id == sample.id:
Expand Down Expand Up @@ -1641,9 +1640,9 @@ def toggle_varStatus():

report = "Report" if v2s.reported else "Unreport"
history = History(
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
action=f"{report} variant : {id_var}")
db.session.add(history)
db.session.commit()
Expand All @@ -1669,9 +1668,9 @@ def toggle_varhide():

report = "Hide" if v2s.hide else "Show"
history = History(
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
action=f"{report} variant : {id_var}")
db.session.add(history)
db.session.commit()
Expand Down Expand Up @@ -1700,9 +1699,9 @@ def toggle_varhideall():

report = "Hide" if v2s.hide else "Show"
history = History(
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample_id,
user_ID=current_user.id,
date=datetime.now(),
action=f"{report} variant : {v2s.variant_ID}")
db.session.add(history)
db.session.commit()
Expand All @@ -1725,9 +1724,9 @@ def toggle_sampleIndex():
sample.index = False if sample.index else True

history = History(
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
action=f"Toggle index : '{str(old)}' -> '{str(sample.index)}'")
db.session.add(history)
db.session.commit()
Expand All @@ -1750,9 +1749,9 @@ def toggle_sampleAffected():
sample.affected = False if sample.affected else True

history = History(
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
action=f"Toggle affected : '{str(old)}' -> '{str(sample.affected)}'")
db.session.add(history)
db.session.commit()
Expand All @@ -1778,9 +1777,9 @@ def toggle_sampleFilter():

if sample.filter != old_filter:
history = History(
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
action=f"Change filter : '{str(old_filter)}' -> '{str(sample.filter)}'")
db.session.add(history)
db.session.commit()
Expand All @@ -1805,9 +1804,9 @@ def toggle_samplePanel():

if sample.bed != old_bed:
history = History(
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
sample_ID=sample.id,
user_ID=current_user.id,
date=datetime.now(),
action=f"Change panel : '{str(old_bed)}' -> '{str(sample.bed)}'")
db.session.add(history)
db.session.commit()
Expand Down Expand Up @@ -1871,8 +1870,8 @@ def toggle_sampleStatus():

if sample.status != old_status:
history = History(
sample_ID=sample.id,
user_ID=current_user.id, date=datetime.now(),
sample_ID=sample.id,
user_ID=current_user.id, date=datetime.now(),
action=f"Status : '{status_dict[old_status]}' -> '{status_dict[sample.status]}'")
db.session.add(history)
db.session.commit()
Expand All @@ -1889,9 +1888,9 @@ def add_comment_variant():
str: A message indicating the comment was added.
"""
comment = Comment_variant(
comment=urllib.parse.unquote(request.form["comment"]),
variantid=request.form["id"],
date=datetime.now(),
comment=urllib.parse.unquote(request.form["comment"]),
variantid=request.form["id"],
date=datetime.now(),
userid=current_user.id)
db.session.add(comment)
db.session.commit()
Expand All @@ -1908,9 +1907,9 @@ def add_comment_sample():
str: A message indicating the comment was added.
"""
comment = Comment_sample(
comment=urllib.parse.unquote(request.form["comment"]),
sampleid=request.form["id"],
date=datetime.now(),
comment=urllib.parse.unquote(request.form["comment"]),
sampleid=request.form["id"],
date=datetime.now(),
userid=current_user.id)
db.session.add(comment)
db.session.commit()
Expand Down
Loading

0 comments on commit 2626b0a

Please sign in to comment.