Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Feb 23, 2024
1 parent c9fdb6d commit d211eac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/annotation_service/annotation_jobs/heredicare_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def save_to_db(self, info, variant_id, conn):
err_msg += "There was an error during variant retrieval from heredicare: " + str(message)
status_code = 1
else:
print(heredicare_variant)
#print(heredicare_variant)
n_fam = heredicare_variant["N_FAM"]
n_pat = heredicare_variant["N_PAT"]
consensus_class = heredicare_variant["PATH_TF"] if heredicare_variant["PATH_TF"] != "-1" else None
Expand All @@ -86,7 +86,6 @@ def save_to_db(self, info, variant_id, conn):
for key in heredicare_variant:
if key.startswith("PATH_Z") and heredicare_variant[key] is not None:
zid = int(key[6:])
print(zid)
classification = heredicare_variant[key] if heredicare_variant[key] != "-1" else None
conn.insert_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment = None) # TODO! COMMENT!

Expand Down
29 changes: 7 additions & 22 deletions src/annotation_service/annotation_jobs/spliceai_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,26 @@ def execute(self, inpath, annotated_inpath, **kwargs):

self.print_executing()


spliceai_code, spliceai_stderr, splicai_stdout = self.annotate_missing_spliceai(inpath, annotated_inpath)


self.handle_result(inpath, annotated_inpath, spliceai_code)

return spliceai_code, spliceai_stderr, splicai_stdout


def save_to_db(self, info, variant_id, conn):
for prefix in ['snv', 'indel']:
self.insert_annotation(variant_id, info, prefix + '_SpliceAI=', 7, conn, value_modifier_function= lambda value : ','.join(['|'.join(x.split('|')[1:]) for x in value.replace(',', '&').split('&')]) )
self.insert_annotation(variant_id, info, prefix + '_SpliceAI=', 8, conn, value_modifier_function= lambda value : ','.join([str(max([float(x) for x in x.split('|')[2:6]])) for x in value.replace(',', '&').split('&')]) )
recent_annotation_ids = conn.get_recent_annotation_type_ids()

for prefix in ['snv_', 'indel_', '']:
self.insert_annotation(variant_id, info, prefix + 'SpliceAI=', recent_annotation_ids["spliceai_details"], conn, value_modifier_function= lambda value : ','.join(['|'.join(x.split('|')[1:]) for x in value.replace(',', '&').split('&')]) )
self.insert_annotation(variant_id, info, prefix + 'SpliceAI=', recent_annotation_ids["spliceai_max_delta"], conn, value_modifier_function= lambda value : ','.join([str(max([float(x) for x in x.split('|')[2:6]])) for x in value.replace(',', '&').split('&')]) )

return 0, ""




def annotate_missing_spliceai(self, input_vcf_path, output_vcf_path):
#input_file = open(input_vcf_path, 'r')
#temp_path = tempfile.gettempdir() + '/' + str(uuid.uuid4()) + '.vcf'
#temp_file = open(temp_path, 'w')

found_spliceai_header = False
need_annotation = False
Expand All @@ -54,7 +52,6 @@ def annotate_missing_spliceai(self, input_vcf_path, output_vcf_path):
with open(input_vcf_path, 'r') as input_file:
for line in input_file:
if line.startswith('#'):
#temp_file.write(line)
if line.startswith('##INFO=<ID=snv_SpliceAI') or line.startswith('##INFO=<ID=indel_SpliceAI') :
found_spliceai_header = True
continue
Expand All @@ -63,19 +60,10 @@ def annotate_missing_spliceai(self, input_vcf_path, output_vcf_path):
continue

need_annotation = True
#temp_file.write(line)
#temp_file.close()

if not found_spliceai_header:
errors.append("SpliceAI WARNING: did not find a SpliceAI INFO entry in input vcf, did you annotate the file using a precomputed file before?")
if need_annotation:
#returncode, stderr, stdout = functions.execute_command(['sed', '-i', '/SpliceAI/d', input_vcf_path], "sed")
#if returncode != 0:
# errors.append(stderr)
#returncode, stderr, stdout = functions.execute_command(['chmod', '777', input_vcf_path], 'chmod')
#if returncode != 0:
# errors.append(stderr)
#returncode, stderr, stdout = functions.execute_command(["ls", "-l", "/tmp"], "ls")
#print(stdout)
spliceai_code, spliceai_stderr, spliceai_stdout = self.annotate_spliceai_algorithm(input_vcf_path, output_vcf_path)
if 'SpliceAI runtime ERROR:' in spliceai_stderr:
errors.append(spliceai_stderr)
Expand All @@ -84,7 +72,6 @@ def annotate_missing_spliceai(self, input_vcf_path, output_vcf_path):

# need to insert some code here to merge the newly annotated variants and previously
# annotated ones from the db if there are files which contain more than one variant!
#input_file.close()



Expand Down Expand Up @@ -116,5 +103,3 @@ def annotate_spliceai_algorithm(self, input_vcf_path, output_vcf_path):





1 change: 1 addition & 0 deletions src/frontend_celery/webapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ <h4>Changelog</h4>
<li>A selected criterium would automatically uncheck if a mutually exclusive criterium was unselected and the mutually exclusive criterium itself is mutually exclusive with the selected criterium</li>
<li>Fixed default strength for supporting criteria in ACMG standard scheme</li>
<li>Fixed wrapping of PVS1_mod criterium</li>
<li>Fixed a bug where the SpliceAI scores would not show on longer indels</li>
</ul>
</div>
<div class="underline">v 1.8 (21.02.2024)</div>
Expand Down

0 comments on commit d211eac

Please sign in to comment.