pori-python 1.2.0__tar.gz → 1.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {pori_python-1.2.0/pori_python.egg-info → pori_python-1.2.2}/PKG-INFO +1 -1
  2. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/match.py +9 -9
  3. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/util.py +4 -4
  4. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/annotate.py +3 -3
  5. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/connection.py +3 -3
  6. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/constants.py +8 -8
  7. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/inputs.py +8 -6
  8. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/ipr.py +6 -6
  9. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/main.py +8 -8
  10. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/summary.py +7 -7
  11. {pori_python-1.2.0 → pori_python-1.2.2/pori_python.egg-info}/PKG-INFO +1 -1
  12. {pori_python-1.2.0 → pori_python-1.2.2}/setup.cfg +1 -1
  13. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/data.py +79 -79
  14. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_match.py +1 -1
  15. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_annotate.py +6 -8
  16. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_inputs.py +2 -2
  17. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_ipr.py +5 -5
  18. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_main.py +1 -1
  19. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_probe.py +1 -1
  20. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_summary.py +75 -75
  21. {pori_python-1.2.0 → pori_python-1.2.2}/LICENSE +0 -0
  22. {pori_python-1.2.0 → pori_python-1.2.2}/MANIFEST.in +0 -0
  23. {pori_python-1.2.0 → pori_python-1.2.2}/README.md +0 -0
  24. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/__init__.py +0 -0
  25. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/__init__.py +0 -0
  26. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/constants.py +0 -0
  27. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/genes.py +0 -0
  28. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/statement.py +0 -0
  29. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/graphkb/vocab.py +0 -0
  30. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/__init__.py +0 -0
  31. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/content.spec.json +0 -0
  32. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/therapeutic_options.py +0 -0
  33. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/ipr/util.py +0 -0
  34. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/py.typed +0 -0
  35. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python/types.py +0 -0
  36. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python.egg-info/SOURCES.txt +0 -0
  37. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python.egg-info/dependency_links.txt +0 -0
  38. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python.egg-info/entry_points.txt +0 -0
  39. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python.egg-info/requires.txt +0 -0
  40. {pori_python-1.2.0 → pori_python-1.2.2}/pori_python.egg-info/top_level.txt +0 -0
  41. {pori_python-1.2.0 → pori_python-1.2.2}/pyproject.toml +0 -0
  42. {pori_python-1.2.0 → pori_python-1.2.2}/setup.py +0 -0
  43. {pori_python-1.2.0 → pori_python-1.2.2}/tests/__init__.py +0 -0
  44. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/__init__.py +0 -0
  45. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_genes.py +0 -0
  46. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_graphkb.py +0 -0
  47. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_statement.py +0 -0
  48. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_util.py +0 -0
  49. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_graphkb/test_vocab.py +0 -0
  50. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/__init__.py +0 -0
  51. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/constants.py +0 -0
  52. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_connection.py +0 -0
  53. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_upload.py +0 -0
  54. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/test_util.py +0 -0
  55. {pori_python-1.2.0 → pori_python-1.2.2}/tests/test_ipr/util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pori_python
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Home-page: https://github.com/bcgsc/pori_python
5
5
  Author-email: dat@bcgsc.ca
6
6
  Maintainer-email: dat@bcgsc.ca
@@ -135,7 +135,7 @@ def match_category_variant(
135
135
  gene_source: str = "",
136
136
  gene_is_source_id: bool = False,
137
137
  ignore_cache: bool = False,
138
- reference_class: str = 'Feature',
138
+ reference_class: str = "Feature",
139
139
  ) -> List[Variant]:
140
140
  """
141
141
  Returns a list of variants matching the input variant
@@ -155,7 +155,7 @@ def match_category_variant(
155
155
  """
156
156
  # disambiguate the reference to find all equivalent representations
157
157
  references: List[str] = []
158
- if reference_class == 'Feature':
158
+ if reference_class == "Feature":
159
159
  references = convert_to_rid_list(
160
160
  get_equivalent_features(
161
161
  conn,
@@ -169,12 +169,12 @@ def match_category_variant(
169
169
  raise FeatureNotFoundError(
170
170
  f"unable to find the gene ({reference_name}) or any equivalent representations"
171
171
  )
172
- if reference_class == 'Signature':
172
+ if reference_class == "Signature":
173
173
  references = convert_to_rid_list(
174
174
  get_equivalent_terms(
175
175
  conn,
176
176
  reference_name.lower(),
177
- ontology_class='Signature',
177
+ ontology_class="Signature",
178
178
  ignore_cache=ignore_cache,
179
179
  )
180
180
  )
@@ -315,16 +315,16 @@ def equivalent_types(
315
315
 
316
316
  # Convert rid to displayName if needed
317
317
  if looks_like_rid(type1):
318
- type1 = conn.get_records_by_id([type1])[0]['displayName']
318
+ type1 = conn.get_records_by_id([type1])[0]["displayName"]
319
319
  if looks_like_rid(type2):
320
- type2 = conn.get_records_by_id([type2])[0]['displayName']
320
+ type2 = conn.get_records_by_id([type2])[0]["displayName"]
321
321
 
322
322
  # Get type terms from observed variant
323
323
  terms1 = []
324
324
  if strict:
325
325
  try:
326
- terms1.append(get_term_by_name(conn, type1)['@rid'])
327
- except:
326
+ terms1.append(get_term_by_name(conn, type1)["@rid"])
327
+ except Exception:
328
328
  pass
329
329
  else:
330
330
  terms1 = get_terms_set(conn, [type1])
@@ -444,7 +444,7 @@ def compare_positional_variants(
444
444
  return False
445
445
 
446
446
  # Equivalent types
447
- if variant.get('type') and reference_variant.get('type'):
447
+ if variant.get("type") and reference_variant.get("type"):
448
448
  if not equivalent_types(conn, variant["type"], reference_variant["type"]):
449
449
  return False
450
450
 
@@ -9,8 +9,8 @@ import re
9
9
  import time
10
10
  from datetime import datetime
11
11
  from typing import Any, Dict, Iterable, List, Optional, Union, cast
12
- from urllib.parse import urlsplit
13
12
  from urllib3.util.retry import Retry
13
+ from urllib.parse import urlsplit
14
14
 
15
15
  from pori_python.types import ParsedVariant, PositionalVariant, Record
16
16
 
@@ -128,9 +128,9 @@ class GraphKBConnection:
128
128
  @property
129
129
  def load(self) -> Optional[float]:
130
130
  if self.first_request and self.last_request:
131
- return (
132
- self.request_count * 1000 / millis_interval(self.first_request, self.last_request)
133
- )
131
+ msec = millis_interval(self.first_request, self.last_request)
132
+ if msec:
133
+ return self.request_count * 1000 / msec
134
134
  return None
135
135
 
136
136
  def request(self, endpoint: str, method: str = "GET", **kwargs) -> Dict:
@@ -344,12 +344,12 @@ def annotate_signature_variants(
344
344
  # Keep support for 'high mutation burden' until statement datafix
345
345
  if (
346
346
  variant["signatureName"] == TMB_SIGNATURE
347
- and TMB_SIGNATURE != 'high mutation burden'
347
+ and TMB_SIGNATURE != "high mutation burden"
348
348
  ):
349
349
  matched_variants.extend(
350
350
  gkb_match.match_category_variant(
351
351
  graphkb_conn,
352
- 'high mutation burden',
352
+ "high mutation burden",
353
353
  variant["variantTypeName"],
354
354
  reference_class="Signature",
355
355
  )
@@ -381,7 +381,7 @@ def annotate_variants(
381
381
  disease_matches: List[str] = [],
382
382
  signature_variants: List[IprSignatureVariant] = [],
383
383
  small_mutations: List[IprSmallMutationVariant] = [],
384
- structural_variants: List[IprStructuralVariant] = [],
384
+ structural_variants: Sequence[IprStructuralVariant] = [],
385
385
  copy_variants: List[IprCopyVariant] = [],
386
386
  expression_variants: List[IprExprVariant] = [],
387
387
  ) -> List[Hashabledict]:
@@ -107,15 +107,15 @@ class IprConnection:
107
107
  # uploaded.
108
108
 
109
109
  projects = self.get("project")
110
- project_names = [item['name'] for item in projects]
110
+ project_names = [item["name"] for item in projects]
111
111
 
112
112
  # if project is not exist, create one
113
- if content['project'] not in project_names:
113
+ if content["project"] not in project_names:
114
114
  logger.info(
115
115
  f"Project not found - attempting to create project {content['project']}"
116
116
  )
117
117
  try:
118
- self.post("project", {'name': content['project']})
118
+ self.post("project", {"name": content["project"]})
119
119
  except Exception as err:
120
120
  raise Exception(f"Project creation failed due to {err}")
121
121
 
@@ -15,14 +15,14 @@ TMB_SIGNATURE_HIGH_THRESHOLD = (
15
15
  TMB_SIGNATURE_VARIANT_TYPE = "high signature"
16
16
  # Mapping micro-satellite from pipeline terms to GraphKB terms
17
17
  MSI_MAPPING = {
18
- 'microsatellite instability': { # MSI
19
- 'displayName': 'microsatellite instability high signature',
20
- 'signatureName': 'microsatellite instability',
21
- 'variantTypeName': 'high signature',
18
+ "microsatellite instability": { # MSI
19
+ "displayName": "microsatellite instability high signature",
20
+ "signatureName": "microsatellite instability",
21
+ "variantTypeName": "high signature",
22
22
  },
23
- 'microsatellite stable': { # MSS
24
- 'displayName': 'microsatellite stable signature present',
25
- 'signatureName': 'microsatellite stable',
26
- 'variantTypeName': 'signature present',
23
+ "microsatellite stable": { # MSS
24
+ "displayName": "microsatellite stable signature present",
25
+ "signatureName": "microsatellite stable",
26
+ "variantTypeName": "signature present",
27
27
  },
28
28
  }
@@ -257,7 +257,7 @@ def preprocess_copy_variants(rows: Iterable[Dict]) -> List[IprCopyVariant]:
257
257
  if chrom:
258
258
  # check that chr isn't already in the chrband;
259
259
  # this regex from https://vrs.ga4gh.org/en/1.2/terms_and_model.html#id25
260
- if chrband and (re.match("^cen|[pq](ter|([1-9][0-9]*(\.[1-9][0-9]*)?))$", chrband)):
260
+ if chrband and (re.match(r"^cen|[pq](ter|([1-9][0-9]*(\.[1-9][0-9]*)?))$", chrband)):
261
261
  if isinstance(chrom, int):
262
262
  chrom = str(chrom)
263
263
  chrom = chrom.strip("chr")
@@ -479,7 +479,7 @@ def preprocess_hla(rows: Iterable[Dict]) -> Iterable[Dict]:
479
479
 
480
480
 
481
481
  def preprocess_tmb(
482
- tmb_high: float, tmburMutationBurden: Dict = None, genomeTmb: str = None
482
+ tmb_high: float, tmburMutationBurden: Dict = {}, genomeTmb: float | str = ""
483
483
  ) -> Iterable[Dict]:
484
484
  """
485
485
  Process tumour mutation burden (tmb) input(s) into preformatted signature input.
@@ -495,7 +495,7 @@ def preprocess_tmb(
495
495
  tmbur_tmb_val = float(
496
496
  tmburMutationBurden["genomeIndelTmb"] + tmburMutationBurden["genomeSnvTmb"]
497
497
  )
498
- if genomeTmb == None:
498
+ if not genomeTmb and not isinstance(genomeTmb, float):
499
499
  logger.error(
500
500
  "backwards compatibility: deriving genomeTmb from tmburMutationBurden genomeIndelTmb + genomeSnvTmb"
501
501
  )
@@ -505,14 +505,16 @@ def preprocess_tmb(
505
505
 
506
506
  # genomeTmb
507
507
  # SDEV-4811 - mutation burden is now expected to be uploaded in genomeTmb as mutations/megabase
508
- if genomeTmb != None and genomeTmb != "":
508
+ if isinstance(genomeTmb, float):
509
+ tmb_val = genomeTmb
510
+ elif genomeTmb:
509
511
  try:
510
512
  tmb_val = float(genomeTmb)
511
513
  if tmburMutationBurden and tmbur_tmb_val != tmb_val:
512
514
  logger.warning(
513
515
  f"genomeTmb given {tmb_val} does not match tmburMutationBurden TMB {tmbur_tmb_val}"
514
516
  )
515
- except Exception as err:
517
+ except TypeError as err:
516
518
  logger.error(f"genomeTmb parsing failure {genomeTmb}: {err}")
517
519
 
518
520
  # comparaing tmb_val to threshold
@@ -520,7 +522,7 @@ def preprocess_tmb(
520
522
  if tmb_val >= tmb_high:
521
523
  return [
522
524
  {
523
- "displayName": f'{TMB_SIGNATURE} {TMB_SIGNATURE_VARIANT_TYPE}',
525
+ "displayName": f"{TMB_SIGNATURE} {TMB_SIGNATURE_VARIANT_TYPE}",
524
526
  "signatureName": TMB_SIGNATURE,
525
527
  "variantTypeName": TMB_SIGNATURE_VARIANT_TYPE,
526
528
  }
@@ -639,7 +639,7 @@ def get_kb_disease_matches(
639
639
  disease_matches = []
640
640
 
641
641
  if not kb_disease_match:
642
- kb_disease_match = 'cancer'
642
+ kb_disease_match = "cancer"
643
643
  if verbose:
644
644
  logger.warning(f"No disease provided; will use '{kb_disease_match}'")
645
645
 
@@ -657,20 +657,20 @@ def get_kb_disease_matches(
657
657
  base_records = gkb_util.convert_to_rid_list(
658
658
  graphkb_conn.query(
659
659
  gkb_vocab.query_by_name(
660
- 'Disease',
660
+ "Disease",
661
661
  kb_disease_match,
662
662
  )
663
663
  )
664
664
  )
665
665
  if base_records:
666
666
  response = graphkb_conn.post(
667
- f'/subgraphs/Disease',
667
+ "/subgraphs/Disease",
668
668
  {
669
- 'subgraphType': 'tree',
670
- 'base': base_records,
669
+ "subgraphType": "tree",
670
+ "base": base_records,
671
671
  },
672
672
  )
673
- disease_matches = list(response['result']['g']['nodes'].keys())
673
+ disease_matches = list(response["result"]["g"]["nodes"].keys())
674
674
 
675
675
  except Exception:
676
676
  if verbose:
@@ -7,7 +7,7 @@ import jsonschema.exceptions
7
7
  import logging
8
8
  import os
9
9
  from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
10
- from typing import Callable, Dict, List, Sequence, Set
10
+ from typing import Callable, Dict, List, Optional, Sequence, Set
11
11
 
12
12
  from pori_python.graphkb import GraphKBConnection
13
13
  from pori_python.graphkb.genes import get_gene_information
@@ -15,9 +15,9 @@ from pori_python.types import (
15
15
  Hashabledict,
16
16
  IprCopyVariant,
17
17
  IprExprVariant,
18
+ IprFusionVariant,
18
19
  IprSignatureVariant,
19
20
  IprSmallMutationVariant,
20
- IprStructuralVariant,
21
21
  IprVariant,
22
22
  )
23
23
 
@@ -305,7 +305,7 @@ def ipr_report(
305
305
  generate_therapeutics: bool = False,
306
306
  generate_comments: bool = True,
307
307
  match_germline: bool = False,
308
- custom_kb_match_filter: Callable = None,
308
+ custom_kb_match_filter: Optional[Callable] = None,
309
309
  async_upload: bool = False,
310
310
  mins_to_wait: int = 5,
311
311
  include_ipr_variant_text: bool = True,
@@ -383,8 +383,8 @@ def ipr_report(
383
383
  *preprocess_hla(content.get("hlaTypes", [])),
384
384
  *preprocess_tmb(
385
385
  tmb_high,
386
- content.get("tmburMutationBurden", None), # old tmb pipeline
387
- content.get("genomeTmb", None), # newer tmb pipeline
386
+ content.get("tmburMutationBurden", {}), # old tmb pipeline
387
+ content.get("genomeTmb", ""), # newer tmb pipeline
388
388
  ),
389
389
  *preprocess_msi(content.get("msi", None)),
390
390
  ]
@@ -392,7 +392,7 @@ def ipr_report(
392
392
  small_mutations: List[IprSmallMutationVariant] = preprocess_small_mutations(
393
393
  content.get("smallMutations", [])
394
394
  )
395
- structural_variants: List[IprStructuralVariant] = preprocess_structural_variants(
395
+ structural_variants: List[IprFusionVariant] = preprocess_structural_variants(
396
396
  content.get("structuralVariants", [])
397
397
  )
398
398
  copy_variants: List[IprCopyVariant] = preprocess_copy_variants(content.get("copyVariants", []))
@@ -504,7 +504,7 @@ def ipr_report(
504
504
  include_nonspecific_template=include_nonspecific_template,
505
505
  )
506
506
  comments_list.append(ipr_comments)
507
- comments = {'comments': "\n".join(comments_list)}
507
+ comments = {"comments": "\n".join(comments_list)}
508
508
 
509
509
  # REFORMATTING KBMATCHES
510
510
  # kbMatches -> kbMatches, kbMatchedStatements & kbStatementMatchedConditions
@@ -549,7 +549,7 @@ def ipr_report(
549
549
 
550
550
  ipr_spec = ipr_conn.get_spec()
551
551
  output = clean_unsupported_content(output, ipr_spec)
552
- ipr_result = None
552
+ ipr_result = {}
553
553
  upload_error = None
554
554
 
555
555
  # UPLOAD TO IPR
@@ -9,8 +9,8 @@ from pori_python.graphkb import GraphKBConnection
9
9
  from pori_python.graphkb.constants import RELEVANCE_BASE_TERMS
10
10
  from pori_python.graphkb.statement import categorize_relevance
11
11
  from pori_python.graphkb.util import convert_to_rid_list
12
- from pori_python.ipr.inputs import create_graphkb_sv_notation
13
12
  from pori_python.ipr.connection import IprConnection
13
+ from pori_python.ipr.inputs import create_graphkb_sv_notation
14
14
  from pori_python.types import (
15
15
  Hashabledict,
16
16
  IprVariant,
@@ -430,32 +430,32 @@ def get_ipr_analyst_comments(
430
430
  project_matches = [
431
431
  item
432
432
  for item in itemlist
433
- if 'project' in item.keys() and item['project']['name'] == project_name
433
+ if "project" in item.keys() and item["project"]["name"] == project_name
434
434
  ]
435
435
  if project_matches:
436
436
  itemlist = project_matches
437
437
  elif include_nonspecific_project:
438
- itemlist = [item for item in itemlist if 'project' not in item.keys()]
438
+ itemlist = [item for item in itemlist if "project" not in item.keys()]
439
439
  else:
440
440
  itemlist = []
441
441
 
442
442
  template_matches = [
443
443
  item
444
444
  for item in itemlist
445
- if 'template' in item.keys() and item['template']['name'] == report_type
445
+ if "template" in item.keys() and item["template"]["name"] == report_type
446
446
  ]
447
447
  if template_matches:
448
448
  itemlist = template_matches
449
449
  elif include_nonspecific_template:
450
- itemlist = [item for item in itemlist if 'template' not in item.keys()]
450
+ itemlist = [item for item in itemlist if "template" not in item.keys()]
451
451
  else:
452
452
  itemlist = []
453
453
 
454
- disease_matches = [item for item in itemlist if disease_name in item['cancerType']]
454
+ disease_matches = [item for item in itemlist if disease_name in item["cancerType"]]
455
455
  if disease_matches:
456
456
  itemlist = disease_matches
457
457
  elif include_nonspecific_disease:
458
- itemlist = [item for item in itemlist if not item['cancerType']]
458
+ itemlist = [item for item in itemlist if not item["cancerType"]]
459
459
  else:
460
460
  itemlist = []
461
461
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pori_python
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Home-page: https://github.com/bcgsc/pori_python
5
5
  Author-email: dat@bcgsc.ca
6
6
  Maintainer-email: dat@bcgsc.ca
@@ -17,7 +17,7 @@ known_standard_library = requests
17
17
 
18
18
  [metadata]
19
19
  name = pori_python
20
- version = 1.2.0
20
+ version = 1.2.2
21
21
  url = https://github.com/bcgsc/pori_python
22
22
  author_email = dat@bcgsc.ca
23
23
  maintainer_email = dat@bcgsc.ca
@@ -81,118 +81,118 @@ structuralVariants = {
81
81
  # pos 1: expected equivalences
82
82
  ensemblProteinSample = [
83
83
  (
84
- 'EGFR',
84
+ "EGFR",
85
85
  [
86
- 'EGFR',
87
- 'ERBB',
88
- 'ENSG00000146648',
89
- 'ENSG00000146648.17',
90
- 'ENST00000275493',
91
- 'ENST00000275493.6',
92
- 'NM_001346897',
93
- 'NM_001346897.2',
94
- 'NP_001333826',
95
- 'NP_001333826.1',
86
+ "EGFR",
87
+ "ERBB",
88
+ "ENSG00000146648",
89
+ "ENSG00000146648.17",
90
+ "ENST00000275493",
91
+ "ENST00000275493.6",
92
+ "NM_001346897",
93
+ "NM_001346897.2",
94
+ "NP_001333826",
95
+ "NP_001333826.1",
96
96
  ],
97
97
  ),
98
98
  (
99
- 'NM_001346897',
99
+ "NM_001346897",
100
100
  [
101
- 'EGFR',
102
- 'ERBB',
103
- 'ENSG00000146648',
104
- 'ENSG00000146648.17',
105
- 'NM_001346897',
106
- 'NM_001346897.2',
107
- 'NP_001333826',
108
- 'NP_001333826.1',
101
+ "EGFR",
102
+ "ERBB",
103
+ "ENSG00000146648",
104
+ "ENSG00000146648.17",
105
+ "NM_001346897",
106
+ "NM_001346897.2",
107
+ "NP_001333826",
108
+ "NP_001333826.1",
109
109
  ],
110
110
  ),
111
111
  (
112
- 'NM_001346897.2',
112
+ "NM_001346897.2",
113
113
  [
114
- 'EGFR',
115
- 'ERBB',
116
- 'ENSG00000146648',
117
- 'ENSG00000146648.17',
118
- 'NM_001346897',
119
- 'NM_001346897.2',
120
- 'NP_001333826',
121
- 'NP_001333826.1',
114
+ "EGFR",
115
+ "ERBB",
116
+ "ENSG00000146648",
117
+ "ENSG00000146648.17",
118
+ "NM_001346897",
119
+ "NM_001346897.2",
120
+ "NP_001333826",
121
+ "NP_001333826.1",
122
122
  ],
123
123
  ),
124
124
  (
125
- 'NP_001333826',
125
+ "NP_001333826",
126
126
  [
127
- 'EGFR',
128
- 'ERBB',
129
- 'ENSG00000146648', # Warn: Versionized ENSG won't be returned due to API limitations
130
- 'NM_001346897',
131
- 'NM_001346897.2',
132
- 'NP_001333826',
133
- 'NP_001333826.1',
127
+ "EGFR",
128
+ "ERBB",
129
+ "ENSG00000146648", # Warn: Versionized ENSG won't be returned due to API limitations
130
+ "NM_001346897",
131
+ "NM_001346897.2",
132
+ "NP_001333826",
133
+ "NP_001333826.1",
134
134
  ],
135
135
  ),
136
136
  (
137
- 'NP_001333826.1',
137
+ "NP_001333826.1",
138
138
  [
139
- 'EGFR',
140
- 'ERBB',
141
- 'ENSG00000146648', # Warn: Versionized ENSG won't be returned due to API limitations
142
- 'NM_001346897',
143
- 'NM_001346897.2',
144
- 'NP_001333826',
145
- 'NP_001333826.1',
139
+ "EGFR",
140
+ "ERBB",
141
+ "ENSG00000146648", # Warn: Versionized ENSG won't be returned due to API limitations
142
+ "NM_001346897",
143
+ "NM_001346897.2",
144
+ "NP_001333826",
145
+ "NP_001333826.1",
146
146
  ],
147
147
  ),
148
148
  (
149
- 'ENSG00000146648',
149
+ "ENSG00000146648",
150
150
  [
151
- 'EGFR',
152
- 'ERBB',
153
- 'ENSG00000146648',
154
- 'ENSG00000146648.17',
155
- 'ENST00000275493',
156
- 'ENST00000275493.6',
157
- 'NM_001346897',
158
- 'NM_001346897.2',
159
- 'NP_001333826', # Warn: Versionized NP won't be returned due to API limitations
151
+ "EGFR",
152
+ "ERBB",
153
+ "ENSG00000146648",
154
+ "ENSG00000146648.17",
155
+ "ENST00000275493",
156
+ "ENST00000275493.6",
157
+ "NM_001346897",
158
+ "NM_001346897.2",
159
+ "NP_001333826", # Warn: Versionized NP won't be returned due to API limitations
160
160
  ],
161
161
  ),
162
162
  (
163
- 'ENSG00000146648.17',
163
+ "ENSG00000146648.17",
164
164
  [
165
- 'EGFR',
166
- 'ERBB',
167
- 'ENSG00000146648',
168
- 'ENSG00000146648.17',
169
- 'ENST00000275493',
170
- 'ENST00000275493.6',
171
- 'NM_001346897',
172
- 'NM_001346897.2',
173
- 'NP_001333826', # Warn: Versionized NP won't be returned due to API limitations
165
+ "EGFR",
166
+ "ERBB",
167
+ "ENSG00000146648",
168
+ "ENSG00000146648.17",
169
+ "ENST00000275493",
170
+ "ENST00000275493.6",
171
+ "NM_001346897",
172
+ "NM_001346897.2",
173
+ "NP_001333826", # Warn: Versionized NP won't be returned due to API limitations
174
174
  ],
175
175
  ),
176
176
  (
177
- 'ENST00000275493',
177
+ "ENST00000275493",
178
178
  [
179
- 'EGFR',
180
- 'ERBB',
181
- 'ENSG00000146648',
182
- 'ENSG00000146648.17',
183
- 'ENST00000275493',
184
- 'ENST00000275493.6',
179
+ "EGFR",
180
+ "ERBB",
181
+ "ENSG00000146648",
182
+ "ENSG00000146648.17",
183
+ "ENST00000275493",
184
+ "ENST00000275493.6",
185
185
  ],
186
186
  ),
187
187
  (
188
- 'ENST00000275493.6',
188
+ "ENST00000275493.6",
189
189
  [
190
- 'EGFR',
191
- 'ERBB',
192
- 'ENSG00000146648',
193
- 'ENSG00000146648.17',
194
- 'ENST00000275493',
195
- 'ENST00000275493.6',
190
+ "EGFR",
191
+ "ERBB",
192
+ "ENSG00000146648",
193
+ "ENSG00000146648.17",
194
+ "ENST00000275493",
195
+ "ENST00000275493.6",
196
196
  ],
197
197
  ),
198
198
  ]
@@ -109,7 +109,7 @@ class TestGetEquivalentFeatures:
109
109
  def test_ensembl_protein(self, conn):
110
110
  for feature, expected in ensemblProteinSample:
111
111
  equivalent_features = match.get_equivalent_features(conn, feature)
112
- equivalent_features = [el['displayName'] for el in equivalent_features]
112
+ equivalent_features = [el["displayName"] for el in equivalent_features]
113
113
  for equivalent_feature in expected:
114
114
  assert equivalent_feature in equivalent_features
115
115
 
@@ -12,6 +12,7 @@ from pori_python.ipr.constants import (
12
12
  )
13
13
  from pori_python.ipr.inputs import preprocess_signature_variants
14
14
  from pori_python.types import IprSmallMutationVariant
15
+
15
16
  from .test_ipr import DISEASE_RIDS
16
17
 
17
18
  EXCLUDE_BCGSC_TESTS = os.environ.get("EXCLUDE_BCGSC_TESTS") == "1"
@@ -103,7 +104,6 @@ def graphkb_conn():
103
104
  class TestAnnotation:
104
105
  def test_annotate_nonsense_vs_missense(self, graphkb_conn):
105
106
  """Verify missense (point mutation) is not mistaken for a nonsense (stop codon) mutation."""
106
- disease = "cancer"
107
107
  for key in ("prot_only", "cds_only", "genome_only", "pref"):
108
108
  matched = annotate_positional_variants(graphkb_conn, [TP53_MUT_DICT[key]], DISEASE_RIDS)
109
109
  # nonsense - stop codon - should not match. This is missense not nonsense (#164:933).
@@ -113,7 +113,6 @@ class TestAnnotation:
113
113
 
114
114
  def test_annotate_nonsense_vs_missense_protein(self, graphkb_conn):
115
115
  """Verify missense (point mutation) is not mistaken for a nonsense (stop codon) mutation."""
116
- disease = "cancer"
117
116
  for key in ("prot_only", "pref"):
118
117
  matched = annotate_positional_variants(graphkb_conn, [TP53_MUT_DICT[key]], DISEASE_RIDS)
119
118
  # nonsense - stop codon - should not match. This is missense not nonsense (#164:933).
@@ -123,7 +122,7 @@ class TestAnnotation:
123
122
 
124
123
  def test_annotate_signature_variants_cosmic(self, graphkb_conn):
125
124
  """Test a Cosmic Signature CVs with known GKB statements"""
126
- signature = 'SBS10B'
125
+ signature = "SBS10B"
127
126
  cosmic = annotate_signature_variants(
128
127
  graphkb_conn,
129
128
  DISEASE_RIDS,
@@ -142,7 +141,7 @@ class TestAnnotation:
142
141
  @pytest.mark.skip(reason="no GKB statement for dMMR Signature CVs yet")
143
142
  def test_annotate_signature_variants_dmmr(self, graphkb_conn):
144
143
  """Test a dMMR (from Cosmic) Signature CVs with known GKB statements"""
145
- signature = 'DMMR'
144
+ signature = "DMMR"
146
145
  dmmr = annotate_signature_variants(
147
146
  graphkb_conn,
148
147
  DISEASE_RIDS,
@@ -161,7 +160,7 @@ class TestAnnotation:
161
160
  @pytest.mark.skip(reason="no GKB statement for HLA Signature CVs yet")
162
161
  def test_annotate_signature_variants_hla(self, graphkb_conn):
163
162
  """Test an HLA Signature CVs with known GKB statements"""
164
- signature = 'HLA-A*02:01'
163
+ signature = "HLA-A*02:01"
165
164
  hla = annotate_signature_variants(
166
165
  graphkb_conn,
167
166
  DISEASE_RIDS,
@@ -200,7 +199,7 @@ class TestAnnotation:
200
199
  msi = annotate_signature_variants(
201
200
  graphkb_conn,
202
201
  DISEASE_RIDS,
203
- preprocess_signature_variants([MSI_MAPPING.get('microsatellite instability')]),
202
+ preprocess_signature_variants([MSI_MAPPING.get("microsatellite instability")]),
204
203
  )
205
204
  assert len(msi) != 0
206
205
 
@@ -217,7 +216,7 @@ class TestAnnotation:
217
216
  for key, alt_rep in TP53_MUT_DICT.items():
218
217
  if key == ref_key:
219
218
  continue
220
- if key in ('cds_only', 'genome_only'):
219
+ if key in ("cds_only", "genome_only"):
221
220
  # KBDEV-1259. Temporarely disabled until issue resolution.
222
221
  continue
223
222
  alt = annotate_positional_variants(graphkb_conn, [alt_rep], DISEASE_RIDS)
@@ -236,7 +235,6 @@ class TestAnnotation:
236
235
 
237
236
  def test_wt_not_matched(self, graphkb_conn):
238
237
  """Verify wildtypes are not matched to mutations."""
239
- disease = "cancer"
240
238
  matches = annotate_positional_variants(
241
239
  graphkb_conn, [KBDEV1231_TP53_ERR_MATCH_WT], DISEASE_RIDS
242
240
  )
@@ -48,7 +48,7 @@ EXPECTED_HLA = {
48
48
  "HLA-C*06",
49
49
  }
50
50
  EXPECTED_TMB = {TMB_SIGNATURE}
51
- EXPECTED_MSI = {MSI_MAPPING.get('microsatellite instability')['signatureName']}
51
+ EXPECTED_MSI = {MSI_MAPPING.get("microsatellite instability")["signatureName"]}
52
52
 
53
53
 
54
54
  def read_data_file(filename):
@@ -209,7 +209,7 @@ class TestPreProcessSignatureVariants:
209
209
  # Preprocessing records from file
210
210
  cosmic = preprocess_cosmic(
211
211
  [
212
- r['signature']
212
+ r["signature"]
213
213
  for r in pd.read_csv(os.path.join(DATA_DIR, "cosmic_variants.tab"), sep="\t").to_dict(
214
214
  "records"
215
215
  )
@@ -215,7 +215,7 @@ def graphkb_conn():
215
215
  def query_side_effect(*args, **kwargs):
216
216
  if args:
217
217
  # for TestGetKbDiseaseMatches
218
- return [{'@rid': '#123:45'}]
218
+ return [{"@rid": "#123:45"}]
219
219
  query_index["value"] += 1
220
220
  idx = query_index["value"]
221
221
  return query_return_values[idx] if idx < len(query_return_values) else []
@@ -269,15 +269,15 @@ class TestGetKbDiseaseMatches:
269
269
  def test_get_kb_disease_matches_default_disease(self, graphkb_conn) -> None:
270
270
  get_kb_disease_matches(graphkb_conn) # default to 'cancer'
271
271
  assert graphkb_conn.post.called
272
- assert graphkb_conn.post.call_args_list[0].args[0] == '/subgraphs/Disease'
272
+ assert graphkb_conn.post.call_args_list[0].args[0] == "/subgraphs/Disease"
273
273
 
274
274
  def test_get_kb_disease_matches_disease_with_subgraphs(self, graphkb_conn) -> None:
275
- get_kb_disease_matches(graphkb_conn, 'Breast Cancer')
275
+ get_kb_disease_matches(graphkb_conn, "Breast Cancer")
276
276
  assert graphkb_conn.post.called
277
- assert graphkb_conn.post.call_args_list[0].args[0] == '/subgraphs/Disease'
277
+ assert graphkb_conn.post.call_args_list[0].args[0] == "/subgraphs/Disease"
278
278
 
279
279
  def test_get_kb_disease_matches_get_term_tree(self, graphkb_conn) -> None:
280
- get_kb_disease_matches(graphkb_conn, 'Breast Cancer', useSubgraphsRoute=False)
280
+ get_kb_disease_matches(graphkb_conn, "Breast Cancer", useSubgraphsRoute=False)
281
281
  assert not graphkb_conn.post.called
282
282
 
283
283
 
@@ -72,7 +72,7 @@ def report_upload_content(tmp_path_factory) -> Dict:
72
72
  )
73
73
 
74
74
  def side_effect_function(*args, **kwargs):
75
- if 'templates' in args[0]:
75
+ if "templates" in args[0]:
76
76
  return [{"name": "genomic", "ident": "001"}]
77
77
  elif args[0] == "project":
78
78
  return [{"name": "TEST", "ident": "001"}]
@@ -5,8 +5,8 @@ from typing import Dict
5
5
  from unittest.mock import MagicMock, patch
6
6
 
7
7
  from pori_python.ipr.connection import IprConnection
8
- from pori_python.ipr import main
9
8
  from pori_python.ipr.main import create_report
9
+
10
10
  from .constants import EXCLUDE_INTEGRATION_TESTS
11
11
 
12
12
  EXCLUDE_BCGSC_TESTS = os.environ.get("EXCLUDE_BCGSC_TESTS") == "1"
@@ -1,11 +1,11 @@
1
- from unittest.mock import MagicMock
2
1
  from copy import copy
2
+ from unittest.mock import MagicMock
3
3
 
4
4
  from pori_python.ipr.summary import (
5
5
  GRAPHKB_GUI,
6
+ get_ipr_analyst_comments,
6
7
  get_preferred_drug_representation,
7
8
  substitute_sentence_template,
8
- get_ipr_analyst_comments,
9
9
  )
10
10
 
11
11
 
@@ -162,74 +162,74 @@ class TestSubstituteSentenceTemplate:
162
162
  mock_ipr_results = [
163
163
  [
164
164
  {
165
- 'text': '<p>no cancerType</p>',
166
- 'variantName': 'ERBB2 amplification',
167
- 'cancerType': [],
168
- 'template': {'name': 'test3'},
169
- 'project': {'name': 'test2'},
165
+ "text": "<p>no cancerType</p>",
166
+ "variantName": "ERBB2 amplification",
167
+ "cancerType": [],
168
+ "template": {"name": "test3"},
169
+ "project": {"name": "test2"},
170
170
  },
171
171
  {
172
- 'text': '<p>normal</p>',
173
- 'variantName': 'ERBB2 amplification',
174
- 'cancerType': ['test1', 'test'],
175
- 'template': {'name': 'test3'},
176
- 'project': {'name': 'test2'},
172
+ "text": "<p>normal</p>",
173
+ "variantName": "ERBB2 amplification",
174
+ "cancerType": ["test1", "test"],
175
+ "template": {"name": "test3"},
176
+ "project": {"name": "test2"},
177
177
  },
178
178
  {
179
- 'text': '<p>no project</p>',
180
- 'variantName': 'ERBB2 amplification',
181
- 'cancerType': ['test1', 'test'],
182
- 'template': {'name': 'test3'},
179
+ "text": "<p>no project</p>",
180
+ "variantName": "ERBB2 amplification",
181
+ "cancerType": ["test1", "test"],
182
+ "template": {"name": "test3"},
183
183
  },
184
184
  {
185
- 'text': '<p>no template</p>',
186
- 'variantName': 'ERBB2 amplification',
187
- 'cancerType': ['test1', 'test'],
188
- 'project': {'name': 'test2'},
185
+ "text": "<p>no template</p>",
186
+ "variantName": "ERBB2 amplification",
187
+ "cancerType": ["test1", "test"],
188
+ "project": {"name": "test2"},
189
189
  },
190
190
  ],
191
191
  [
192
192
  {
193
- 'text': '<p>normal, second variant</p>',
194
- 'variantName': 'second variant',
195
- 'cancerType': ['test1', 'test'],
196
- 'template': {'name': 'test3'},
197
- 'project': {'name': 'test2'},
193
+ "text": "<p>normal, second variant</p>",
194
+ "variantName": "second variant",
195
+ "cancerType": ["test1", "test"],
196
+ "template": {"name": "test3"},
197
+ "project": {"name": "test2"},
198
198
  },
199
199
  ],
200
200
  ]
201
201
 
202
- no_comments_found_output = 'No comments found in IPR for variants in this report'
202
+ no_comments_found_output = "No comments found in IPR for variants in this report"
203
203
 
204
204
 
205
205
  class TestVariantTextFromIPR:
206
206
  def test_gets_fully_matched_output_when_possible(self):
207
207
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
208
- matches = [{'kbVariant': 'ERBB2 amplification'}]
208
+ matches = [{"kbVariant": "ERBB2 amplification"}]
209
209
  ipr_summary = get_ipr_analyst_comments(
210
210
  ipr_conn,
211
211
  matches=matches,
212
- disease_name='test1',
213
- project_name='test2',
214
- report_type='test3',
212
+ disease_name="test1",
213
+ project_name="test2",
214
+ report_type="test3",
215
215
  include_nonspecific_project=False,
216
216
  include_nonspecific_disease=True,
217
217
  include_nonspecific_template=True,
218
218
  )
219
- summary_lines = ipr_summary.split('\n')
220
- assert summary_lines[1] == '<h2>ERBB2 amplification (test1,test)</h2>'
221
- assert summary_lines[2] == '<p><p>normal</p></p>'
219
+ summary_lines = ipr_summary.split("\n")
220
+ assert summary_lines[1] == "<h2>ERBB2 amplification (test1,test)</h2>"
221
+ assert summary_lines[2] == "<p><p>normal</p></p>"
222
222
  assert len(summary_lines) == 3
223
223
 
224
224
  def test_omits_nonspecific_project_matches_when_specified(self):
225
225
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
226
- matches = [{'kbVariant': 'ERBB2 amplification'}]
226
+ matches = [{"kbVariant": "ERBB2 amplification"}]
227
227
  ipr_summary = get_ipr_analyst_comments(
228
228
  ipr_conn,
229
229
  matches=matches,
230
- disease_name='test1',
231
- project_name='notfound',
232
- report_type='test3',
230
+ disease_name="test1",
231
+ project_name="notfound",
232
+ report_type="test3",
233
233
  include_nonspecific_project=False,
234
234
  include_nonspecific_disease=True,
235
235
  include_nonspecific_template=True,
@@ -238,13 +238,13 @@ class TestVariantTextFromIPR:
238
238
 
239
239
  def test_omits_nonspecific_template_matches_when_specified(self):
240
240
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
241
- matches = [{'kbVariant': 'ERBB2 amplification'}]
241
+ matches = [{"kbVariant": "ERBB2 amplification"}]
242
242
  ipr_summary = get_ipr_analyst_comments(
243
243
  ipr_conn,
244
244
  matches=matches,
245
- disease_name='test1',
246
- project_name='test2',
247
- report_type='notfound',
245
+ disease_name="test1",
246
+ project_name="test2",
247
+ report_type="notfound",
248
248
  include_nonspecific_project=True,
249
249
  include_nonspecific_disease=True,
250
250
  include_nonspecific_template=False,
@@ -253,13 +253,13 @@ class TestVariantTextFromIPR:
253
253
 
254
254
  def test_omits_nonspecific_disease_matches_when_specified(self):
255
255
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
256
- matches = [{'kbVariant': 'ERBB2 amplification'}]
256
+ matches = [{"kbVariant": "ERBB2 amplification"}]
257
257
  ipr_summary = get_ipr_analyst_comments(
258
258
  ipr_conn,
259
259
  matches=matches,
260
- disease_name='notfound',
261
- project_name='test2',
262
- report_type='test3',
260
+ disease_name="notfound",
261
+ project_name="test2",
262
+ report_type="test3",
263
263
  include_nonspecific_project=True,
264
264
  include_nonspecific_disease=False,
265
265
  include_nonspecific_template=True,
@@ -268,86 +268,86 @@ class TestVariantTextFromIPR:
268
268
 
269
269
  def test_includes_nonspecific_project_matches_when_specified(self):
270
270
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
271
- matches = [{'kbVariant': 'ERBB2 amplification'}]
271
+ matches = [{"kbVariant": "ERBB2 amplification"}]
272
272
  ipr_summary = get_ipr_analyst_comments(
273
273
  ipr_conn,
274
274
  matches=matches,
275
- disease_name='test1',
276
- project_name='notfound',
277
- report_type='test3',
275
+ disease_name="test1",
276
+ project_name="notfound",
277
+ report_type="test3",
278
278
  include_nonspecific_project=True,
279
279
  include_nonspecific_disease=False,
280
280
  include_nonspecific_template=False,
281
281
  )
282
- summary_lines = ipr_summary.split('\n')
283
- assert summary_lines[2] == '<p><p>no project</p></p>'
282
+ summary_lines = ipr_summary.split("\n")
283
+ assert summary_lines[2] == "<p><p>no project</p></p>"
284
284
  assert len(summary_lines) == 3
285
285
 
286
286
  def test_includes_nonspecific_template_matches_when_specified(self):
287
287
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
288
- matches = [{'kbVariant': 'ERBB2 amplification'}]
288
+ matches = [{"kbVariant": "ERBB2 amplification"}]
289
289
  ipr_summary = get_ipr_analyst_comments(
290
290
  ipr_conn,
291
291
  matches=matches,
292
- disease_name='test1',
293
- project_name='test2',
294
- report_type='notfound',
292
+ disease_name="test1",
293
+ project_name="test2",
294
+ report_type="notfound",
295
295
  include_nonspecific_project=False,
296
296
  include_nonspecific_disease=False,
297
297
  include_nonspecific_template=True,
298
298
  )
299
- summary_lines = ipr_summary.split('\n')
300
- assert summary_lines[2] == '<p><p>no template</p></p>'
299
+ summary_lines = ipr_summary.split("\n")
300
+ assert summary_lines[2] == "<p><p>no template</p></p>"
301
301
  assert len(summary_lines) == 3
302
302
 
303
303
  def test_includes_nonspecific_disease_matches_when_specified(self):
304
304
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
305
- matches = [{'kbVariant': 'ERBB2 amplification'}]
305
+ matches = [{"kbVariant": "ERBB2 amplification"}]
306
306
  ipr_summary = get_ipr_analyst_comments(
307
307
  ipr_conn,
308
308
  matches=matches,
309
- disease_name='notfound',
310
- project_name='test2',
311
- report_type='test3',
309
+ disease_name="notfound",
310
+ project_name="test2",
311
+ report_type="test3",
312
312
  include_nonspecific_project=False,
313
313
  include_nonspecific_disease=True,
314
314
  include_nonspecific_template=False,
315
315
  )
316
- summary_lines = ipr_summary.split('\n')
317
- assert summary_lines[1] == '<h2>ERBB2 amplification (no specific cancer types)</h2>'
318
- assert summary_lines[2] == '<p><p>no cancerType</p></p>'
316
+ summary_lines = ipr_summary.split("\n")
317
+ assert summary_lines[1] == "<h2>ERBB2 amplification (no specific cancer types)</h2>"
318
+ assert summary_lines[2] == "<p><p>no cancerType</p></p>"
319
319
  assert len(summary_lines) == 3
320
320
 
321
321
  def test_prepare_section_for_multiple_variants(self):
322
322
  ipr_conn = MagicMock(get=MagicMock(side_effect=copy(mock_ipr_results)))
323
323
  # NB this test relies on matches being processed in this order
324
- matches = [{'kbVariant': 'ERBB2 amplification'}, {'kbVariant': 'second variant'}]
324
+ matches = [{"kbVariant": "ERBB2 amplification"}, {"kbVariant": "second variant"}]
325
325
  ipr_summary = get_ipr_analyst_comments(
326
326
  ipr_conn,
327
327
  matches=matches,
328
- disease_name='test1',
329
- project_name='test2',
330
- report_type='test3',
328
+ disease_name="test1",
329
+ project_name="test2",
330
+ report_type="test3",
331
331
  include_nonspecific_project=False,
332
332
  include_nonspecific_disease=False,
333
333
  include_nonspecific_template=False,
334
334
  )
335
- summary_lines = ipr_summary.split('\n')
335
+ summary_lines = ipr_summary.split("\n")
336
336
  assert len(summary_lines) == 5
337
337
  assert (
338
- '\n'.join(summary_lines[1:])
339
- == '<h2>ERBB2 amplification (test1,test)</h2>\n<p><p>normal</p></p>\n<h2>second variant (test1,test)</h2>\n<p><p>normal, second variant</p></p>'
338
+ "\n".join(summary_lines[1:])
339
+ == "<h2>ERBB2 amplification (test1,test)</h2>\n<p><p>normal</p></p>\n<h2>second variant (test1,test)</h2>\n<p><p>normal, second variant</p></p>"
340
340
  )
341
341
 
342
342
  def test_empty_section_when_no_variant_match(self):
343
343
  ipr_conn = MagicMock(get=MagicMock(side_effect=[[], []]))
344
- matches = [{'kbVariant': 'notfound1'}, {'kbVariant': 'notfound2'}]
344
+ matches = [{"kbVariant": "notfound1"}, {"kbVariant": "notfound2"}]
345
345
  ipr_summary = get_ipr_analyst_comments(
346
346
  ipr_conn,
347
347
  matches=matches,
348
- disease_name='test1',
349
- project_name='test2',
350
- report_type='test3',
348
+ disease_name="test1",
349
+ project_name="test2",
350
+ report_type="test3",
351
351
  include_nonspecific_project=False,
352
352
  include_nonspecific_disease=False,
353
353
  include_nonspecific_template=False,
File without changes
File without changes
File without changes
File without changes
File without changes