Skip to content

Commit f9824db

Browse files
committed
lint with black
1 parent 67328d2 commit f9824db

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

pori_python/ipr/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -450,16 +450,16 @@ def ipr_report(
450450

451451
if generate_comments:
452452
graphkb_comments = auto_analyst_comments(
453-
graphkb_conn, gkb_matches, disease_name=kb_disease_match, variants=all_variants
454-
)
453+
graphkb_conn, gkb_matches, disease_name=kb_disease_match, variants=all_variants
454+
)
455455

456456
ipr_comments = ipr_analyst_comments(
457-
ipr_conn,
458-
gkb_matches,
459-
disease_name=kb_disease_match,
460-
project_name=content['project'],
461-
report_type=content['template']
462-
)
457+
ipr_conn,
458+
gkb_matches,
459+
disease_name=kb_disease_match,
460+
project_name=content['project'],
461+
report_type=content['template'],
462+
)
463463
comments = {"comments": "\n".join([ipr_comments, graphkb_comments])}
464464
else:
465465
comments = {"comments": ""}

pori_python/ipr/summary.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,22 @@ def section_statements_by_genes(
343343
return genes
344344

345345

346+
def prep_single_ipr_variant_comment(item):
347+
cancer_type = ','.join(item['cancerType'])
348+
if not cancer_type:
349+
cancer_type = 'no specific cancer types'
350+
cancer_type = f' ({cancer_type})'
351+
section = [f"<h2>{item['variantName']}{cancer_type}</h2>"]
352+
section.append(f"<p>{item['text']}</p>")
353+
return section
354+
355+
346356
def ipr_analyst_comments(
347357
ipr_conn: IprConnection,
348358
matches: Sequence[KbMatch] | Sequence[Hashabledict],
349359
disease_name: str,
350360
project_name: str,
351-
report_type: str
361+
report_type: str,
352362
):
353363
output: List[str] = [
354364
"<h3>The comments below were automatically drawn from curated text stored in IPR for variant matches in this report, and have not been manually reviewed</h3>"
@@ -358,37 +368,27 @@ def ipr_analyst_comments(
358368

359369
templates = ipr_conn.get(f'templates?name={report_type}')
360370
# if this is genomic expect two results - one 'pharmacogenomic'
361-
template_ident = [item for item in templates if item['name']==report_type][0]['ident']
371+
template_ident = [item for item in templates if item['name'] == report_type][0]['ident']
362372

363373
projects = ipr_conn.get(f'project')
364-
project_ident = [item for item in projects if item['name']==project_name][0]['ident']
374+
project_ident = [item for item in projects if item['name'] == project_name][0]['ident']
365375

366376
match_set = list(set([item['kbVariant'] for item in matches]))
367377

368-
def prep_single_variant_comment(item):
369-
cancer_type = ','.join(item['cancerType'])
370-
if not cancer_type:
371-
cancer_type = 'no specific cancer types'
372-
cancer_type = f' ({cancer_type})'
373-
section = [f"<h2>{item['variantName']}{cancer_type}</h2>"]
374-
section.append(f"<p>{item['text']}</p>")
375-
return section
376-
377378
for variant in match_set:
378-
itemlist = ipr_conn.get('variant-text', data={
379-
'variantName': variant,
380-
'template': template_ident,
381-
'project': project_ident
382-
})
379+
itemlist = ipr_conn.get(
380+
'variant-text',
381+
data={'variantName': variant, 'template': template_ident, 'project': project_ident},
382+
)
383383
if itemlist:
384384
for item in itemlist:
385385
if not item['cancerType'] or disease_name in item['cancerType']:
386-
section = prep_single_variant_comment(item)
386+
section = prep_single_ipr_variant_comment(item)
387387
output.extend(section)
388388
else:
389389
ipr_conn.get('variant-text')
390390
if not output:
391-
output = ['No comments found in IPR for these variants']
391+
output = ['No comments found in IPR for variants in this report']
392392
return "\n".join(output)
393393

394394

0 commit comments

Comments
 (0)