Skip to content

Commit

Permalink
added specific variants reannotate & improved heredicare job
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Jul 26, 2024
1 parent 466434c commit 2048c16
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
23 changes: 11 additions & 12 deletions src/annotation_service/annotation_jobs/heredicare_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,20 @@ def annotate_heredicare(self, variant_id, conn):
err_msg += "The date could not be saved in the database. Format should be dd.mm.yyyy, but was: " + str(classification_date)
status_code = 1

heredicare_annotation_id = None
if status_code == 0:
heredicare_annotation_id = conn.insert_update_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment, lr_cooc, lr_coseg, lr_family)

for key in heredicare_variant:
if key.startswith("PATH_Z"):
zid = int(key[6:])
heredicare_center_classification_raw = heredicare_variant[key]
if heredicare_center_classification_raw is not None and heredicare_variant[key] == "-1":
heredicare_center_classification_raw = None
classification, comment = self.preprocess_heredicare_center_classification(heredicare_center_classification_raw)
if classification is not None:
conn.insert_update_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment)
else:
conn.delete_heredicare_center_classification(heredicare_annotation_id, zid)
for key in heredicare_variant:
if key.startswith("PATH_Z"):
zid = int(key[6:])
heredicare_center_classification_raw = heredicare_variant[key]
if heredicare_center_classification_raw is not None and heredicare_variant[key] == "-1":
heredicare_center_classification_raw = None
classification, comment = self.preprocess_heredicare_center_classification(heredicare_center_classification_raw)
if classification is not None:
conn.insert_update_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment)
else:
conn.delete_heredicare_center_classification(heredicare_annotation_id, zid)

return status_code, err_msg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ <h4>Warnings</h4>
<button type="button" class="btn btn-outline-primary reannotate_variants_button" data-bs-toggle="modal" data-bs-target="#reannotate-variants-modal" modal_text="ALL VARIANTS MISSING AN ANNOTATION" value="unannotated">unannotated variants</button>
</span>
</div>
<div class="form-group d-flex sst">
<span class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" title="Pressing this button requests an annotation of specific variants in HerediVar. Please specify HerediVar variant_ids.">
<button type="button" class="btn btn-outline-primary reannotate_variants_button width_small" data-bs-toggle="modal" data-bs-target="#reannotate-variants-modal" modal_text="SPECIFIC VARIANTS" value="specific">specific variants</button>
</span>
<input class="form-control" type="text" name="specific_variants" placeholder="variant_id_1;variant_id_2;...">
</div>

</form>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h4 class="card-subcaption">Status details</h4>

<p class="card-text">


<div>Refresh page so see changes</div>
<div>

<div id="tabnav-head" class="row align-items-end nsl nsr">
Expand Down
9 changes: 6 additions & 3 deletions src/frontend_celery/webapp/user/user_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def admin_dashboard():
variant_ids = annotation_stati['aborted']
elif reannotate_which == 'unannotated':
variant_ids = annotation_stati['unannotated']
elif reannotate_which == 'specific':
raw = request.form.get('specific_variants', '')
variant_ids = search_utils.preprocess_query(raw, pattern = "\d+")

tasks.annotate_all_variants.apply_async(args=[variant_ids, selected_job_config, session['user']['user_id'], session['user']['roles']])
current_app.logger.info(session['user']['preferred_username'] + " issued a reannotation of " + reannotate_which + " variants")
Expand Down Expand Up @@ -411,21 +414,21 @@ def extract_stati_vis(request_args, allowed_stati):
raw = request_args.getlist('status')#
raw = ';'.join(raw)
regex_inner = '|'.join(allowed_stati)
processed = preprocess_query(raw, r'(' + regex_inner + r')?')
processed = search_utils.preprocess_query(raw, r'(' + regex_inner + r')?')
if processed is None:
flash("You have an error in your status queries. Results are not filtered by stati.", "alert-danger")
return processed

def extract_comments_vis(request_args):
raw = request_args.get('comment', '')
processed = preprocess_query(raw, pattern=r".*", seps = "[;]", remove_whitespace = False)
processed = search_utils.preprocess_query(raw, pattern=r".*", seps = "[;]", remove_whitespace = False)
if processed is None:
flash("You have an error in your comment query(s). Results are not filtered by comment.", "alert-danger")
return processed

def extract_vids_vids(request_args):
raw = request_args.get('vid', '')
processed = preprocess_query(raw, pattern=r"\d+")
processed = search_utils.preprocess_query(raw, pattern=r"\d+")
if processed is None:
flash("You have an error in your VID query(s). Results are not filtered by VIDs.", "alert-danger")
return processed
Expand Down

0 comments on commit 2048c16

Please sign in to comment.